Commit 9c14fd23 authored by zhuwei's avatar zhuwei

解除绑定关系优化

parent a22343ee
...@@ -620,6 +620,12 @@ class UserService ...@@ -620,6 +620,12 @@ class UserService
// 客户bind_id不等于0才能解绑并记录日志 // 客户bind_id不等于0才能解绑并记录日志
$user_info = $this->user->getUserById($field = 'bind_id', $user_id); $user_info = $this->user->getUserById($field = 'bind_id', $user_id);
if($user_info['bind_id'] == 0){ if($user_info['bind_id'] == 0){
$band_count = $this->user->getUserCountByBandId($field = 'id', $user_id);
if($band_count == 1){
$params_['bind_id'] = 0;
$this->user->updateUsers($now_user_id,$params_);
return 0;
}
return 3; return 3;
}else{ }else{
// 解绑操作记录 // 解绑操作记录
...@@ -627,7 +633,7 @@ class UserService ...@@ -627,7 +633,7 @@ class UserService
} }
$params_['bind_id'] = 0; $params_['bind_id'] = 0;
$res = $this->user->updateUsers($user_id,$params_); $this->user->updateUsers($user_id,$params_);
return 0; return 0;
} }
......
...@@ -740,6 +740,14 @@ class Users extends Model ...@@ -740,6 +740,14 @@ class Users extends Model
->find(); ->find();
} }
public function getUserCountByBandId($field = '*', $bind_id, $where = '')
{
return $this->field($field)
->where('bind_id', $bind_id)
->where($where)
->count();
}
public function getAgentByUserId($field, $params) public function getAgentByUserId($field, $params)
{ {
return Db::name($this->table) return Db::name($this->table)
......
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