Commit 253c3f7a authored by clone's avatar clone

验证是否以解绑,在商铺详情页和客户详情页调用

parent eda188ff
...@@ -113,7 +113,6 @@ class Broker extends Basic ...@@ -113,7 +113,6 @@ class Broker extends Basic
return $this->response("101", $checkResult); return $this->response("101", $checkResult);
} }
$field = 'id,store_id,auth_group_id,district_id,level,name,phone,password,sex,img,inviter_id,status'; $field = 'id,store_id,auth_group_id,district_id,level,name,phone,password,sex,img,inviter_id,status';
$where['phone'] = $params['phone']; $where['phone'] = $params['phone'];
$where['id'] = [ '<>', 1 ]; $where['id'] = [ '<>', 1 ];
...@@ -134,7 +133,7 @@ class Broker extends Basic ...@@ -134,7 +133,7 @@ class Broker extends Basic
return $this->response(101, '密码错误'); return $this->response(101, '密码错误');
} }
//判断设备id是否存在 //判断设备id是否存在
$is_login = $this->judgeBand($params["device_id"], $agents_data['id'], $params["model"]); $is_login = $this->judgeBand($params["device_id"], $agents_data['id'], $params["model"], 0);
if (!$is_login) { if (!$is_login) {
return $this->response("101", "该账号没有绑定该手机,请致电人事进行绑定。"); return $this->response("101", "该账号没有绑定该手机,请致电人事进行绑定。");
} }
...@@ -161,14 +160,39 @@ class Broker extends Basic ...@@ -161,14 +160,39 @@ class Broker extends Basic
return $this->response(200, $data['msg'], $data['data']); return $this->response(200, $data['msg'], $data['data']);
} }
/**
* 判断经济人是否在后台被解绑
* @return \think\Response
*/
public function verifyAgentStatus()
{
$params = $this->params;
/* $params = array(
"agent_id" => 12,
"device_id" => "123123131"
);*/
$checkResult = $this->validate($params, "PerformanceValidate.verifyAgentStatus");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$is_visit = $this->judgeBand($params["device_id"], $params["agent_id"], "", 1);
if($is_visit){
return $this->response("200","success",[]);
}else{
return $this->response("101","该账号没有绑定该手机,请致电人事进行绑定。");
}
}
/** /**
* 判断设备绑定关系 * 判断设备绑定关系
* @param string $device_id * @param string $device_id
* @param int $agent_id * @param int $agent_id
* @param string $model * @param string $model
* @param int $type 0提交记录到后台, 1仅仅判断
* @return bool * @return bool
*/ */
private function judgeBand(string $device_id, int $agent_id, string $model): bool private function judgeBand(string $device_id, int $agent_id, string $model, int $type): bool
{ {
//todo 查询是否绑定过设备id,if没有绑定则直接登陆新增绑定关系,if有绑定,则判断登陆的设备id是否存在于关系列表中,存在并且状态正常则登陆, //todo 查询是否绑定过设备id,if没有绑定则直接登陆新增绑定关系,if有绑定,则判断登陆的设备id是否存在于关系列表中,存在并且状态正常则登陆,
//todo 否则提示联系管理员开通 //todo 否则提示联系管理员开通
...@@ -179,6 +203,7 @@ class Broker extends Basic ...@@ -179,6 +203,7 @@ class Broker extends Basic
$result = $aBD->getDeviceByAgentId($params); $result = $aBD->getDeviceByAgentId($params);
if (count($result) <= 0) { if (count($result) <= 0) {
//新增设备绑定关系 //新增设备绑定关系
if ($type == 0)
$aBD->addDevice([ "device_id" => $device_id, "agent_id" => $agent_id, "model" => $model, "is_forbidden" => 0 ]); $aBD->addDevice([ "device_id" => $device_id, "agent_id" => $agent_id, "model" => $model, "is_forbidden" => 0 ]);
return true; return true;
} }
...@@ -188,6 +213,7 @@ class Broker extends Basic ...@@ -188,6 +213,7 @@ class Broker extends Basic
} }
} }
//新增申请绑定关系 //新增申请绑定关系
if ($type == 0)
$aBD->addDevice([ "device_id" => $device_id, "agent_id" => $agent_id, "model" => $model, "is_forbidden" => 1 ]); $aBD->addDevice([ "device_id" => $device_id, "agent_id" => $agent_id, "model" => $model, "is_forbidden" => 1 ]);
return false; return false;
......
...@@ -37,5 +37,6 @@ class PerformanceValidate extends Validate ...@@ -37,5 +37,6 @@ class PerformanceValidate extends Validate
'verify' => [ 'type', 'agent_id' ], 'verify' => [ 'type', 'agent_id' ],
'verifyOther' => [ 'agent_id' ], 'verifyOther' => [ 'agent_id' ],
'login' => [ 'phone', 'pwd', 'device_id' ], 'login' => [ 'phone', 'pwd', 'device_id' ],
'verifyStatus' => [ 'phone', 'device_id' ],
]; ];
} }
\ No newline at end of file
...@@ -375,6 +375,7 @@ Route::group('broker', [ ...@@ -375,6 +375,7 @@ Route::group('broker', [
'login' => [ 'api_broker/Broker/login', [ 'method' => 'post' ] ], //经纪人登陆 废弃 'login' => [ 'api_broker/Broker/login', [ 'method' => 'post' ] ], //经纪人登陆 废弃
'loginV2' => [ 'api_broker/Broker/loginV2', [ 'method' => 'post' ] ], //经纪人登陆 'loginV2' => [ 'api_broker/Broker/loginV2', [ 'method' => 'post' ] ], //经纪人登陆
'verifyAgentStatus' => [ 'api_broker/Broker/verifyAgentStatus', [ 'method' => 'post' ] ], //判断经纪人是否被解绑
'editAgent' => [ 'api_broker/Broker/editAgent', [ 'method' => 'post' ] ], //经纪人修改密码 'editAgent' => [ 'api_broker/Broker/editAgent', [ 'method' => 'post' ] ], //经纪人修改密码
'forgetPwd' => [ 'api_broker/Broker/forgetPwd', [ 'method' => 'post' ] ], //经纪人忘记密码 'forgetPwd' => [ 'api_broker/Broker/forgetPwd', [ 'method' => 'post' ] ], //经纪人忘记密码
'uploadHeadImg' => [ 'api_broker/Broker/uploadHeadImg', [ 'method' => 'post' ] ], //经纪人上传头像 'uploadHeadImg' => [ 'api_broker/Broker/uploadHeadImg', [ 'method' => 'post' ] ], //经纪人上传头像
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment