123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace api\oa\controller;
- use think\Db;
- class OaCheckAgentController extends OacallbackController {
- function _initialize() {
- parent::_initialize();
- $this->checkLegion();
- if (isset($this->param['agent_name'])) {
- $this->checkAgentname();
- $this->checkAgentByAgentNameAndLegionName($this->param['legion_name'], $this->param['agent_name']);
- } else {
- $this->checkAgentByAgentName($this->param['legion_name']);
- }
- }
- /**
- * @return $this
- */
- function checkAgentname() {
- if (empty($this->param['agent_name'])) {
- return $this->oa_class->hs_api_responce('410', '推广员名称为空');
- }
- }
- /**
- * @return $this
- */
- function checkLegion() {
- if (empty($this->param['legion_name'])) {
- return $this->oa_class->hs_api_responce('411', '军团长名称为空');
- }
- }
- /**
- * 检测军团长
- *
- * @param $legion_name
- *
- * @return $this
- */
- function checkAgentByAgentName($legion_name) {
- $_oa_agent_class = new \huolib\oa\OaAgent();
- $_oa_agent_class->checkAgentByAgentName($legion_name);
- }
- /**
- * 检测军团长和推广员是否存在并且关系正确
- *
- * @param string $legion_name
- * @param string $agent_name
- *
- */
- function checkAgentByAgentnameAndLegionname($legion_name = '', $agent_name = '') {
- $_oa_agent_class = new \huolib\oa\OaAgent();
- $_oa_agent_class->checkAgentByAgentNameAndLegionName($legion_name, $agent_name);
- }
- }
|