Commit fb150631 authored by zhuwei's avatar zhuwei

修改

parent dd6a2278
...@@ -946,32 +946,37 @@ class User extends Basic ...@@ -946,32 +946,37 @@ class User extends Basic
$s_index_user = new UserService(); $s_index_user = new UserService();
//新增 //新增
$add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id']); $add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id']);
switch ($add_res) { if ($add_res === true) {
case 1 : return $this->response("200", "绑定成功");
return $this->response("300", "参数不全"); } else {
break; return $this->response("300", $add_res);
case 2 : }
return $this->response("300", "当前客户已经存在绑定关系"); // switch ($add_res) {
break; // case 1 :
case 3 : // return $this->response("300", "参数不全");
return $this->response("300", "当前客户已经存在绑定关系"); // break;
break; // case 2 :
case 4 : // return $this->response("300", "当前客户已经存在绑定关系");
return $this->response("300", "绑定客户关系数超限"); // break;
break; // case 3 :
case 5 : // return $this->response("300", "当前客户已经存在绑定关系");
return $this->response("300", "绑定失败"); // break;
break; // case 4 :
case 6 : // return $this->response("300", "绑定客户关系数超限");
return $this->response("300", "不得绑定自己"); // break;
break; // case 5 :
case 0 : // return $this->response("300", "绑定失败");
return $this->response("200", "绑定成功"); // break;
break; // case 6 :
default : // return $this->response("300", "不得绑定自己");
return $this->response("300", "绑定失败"); // break;
// case 0 :
} // return $this->response("200", "绑定成功");
// break;
// default :
// return $this->response("300", "绑定失败");
//
// }
} }
......
...@@ -591,32 +591,37 @@ class Member extends Basic{ ...@@ -591,32 +591,37 @@ class Member extends Basic{
$s_index_user = new UserService(); $s_index_user = new UserService();
//新增 //新增
$add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id']); $add_res = $s_index_user->addUserBind($this->params['user_id'],$this->params['bind_id']);
switch ($add_res) { if ($add_res === true) {
case 1 : return $this->response("200", "绑定成功");
return $this->response("300", "参数不全"); } else {
break; return $this->response("300", $add_res);
case 2 :
return $this->response("300", "当前客户已经存在绑定关系");
break;
case 3 :
return $this->response("300", "当前客户已经存在绑定关系");
break;
case 4 :
return $this->response("300", "绑定客户关系数超限");
break;
case 5 :
return $this->response("300", "绑定失败");
break;
case 6 :
return $this->response("300", "不得绑定自己");
break;
case 0 :
return $this->response("200", "绑定成功");
break;
default :
return $this->response("300", "绑定失败");
} }
// switch ($add_res) {
// case 1 :
// return $this->response("300", "参数不全");
// break;
// case 2 :
// return $this->response("300", "当前客户已经存在绑定关系");
// break;
// case 3 :
// return $this->response("300", "当前客户已经存在绑定关系");
// break;
// case 4 :
// return $this->response("300", "绑定客户关系数超限");
// break;
// case 5 :
// return $this->response("300", "绑定失败");
// break;
// case 6 :
// return $this->response("300", "不得绑定自己");
// break;
// case 0 :
// return $this->response("200", "绑定成功");
// break;
// default :
// return $this->response("300", "绑定失败");
//
// }
} }
......
...@@ -615,11 +615,11 @@ class UserService ...@@ -615,11 +615,11 @@ class UserService
*/ */
public function addUserBind($user_id,$bind_id){ public function addUserBind($user_id,$bind_id){
if(!$user_id or !$bind_id){ if(!$user_id or !$bind_id){
return 1; return '参数不全';
} }
if($user_id == $bind_id){ if($user_id == $bind_id){
return 6; return '不得绑定自己';
} }
// 先查当前用户bind_id是否等于0 user_id 当前详情页客户 // 先查当前用户bind_id是否等于0 user_id 当前详情页客户
...@@ -628,33 +628,32 @@ class UserService ...@@ -628,33 +628,32 @@ class UserService
//排除主账号 //排除主账号
$user_bind_count = $this->user->getBindCount($bind_id); $user_bind_count = $this->user->getBindCount($bind_id);
if($user_bind_count > 0){ if($user_bind_count > 0){
return 2;//当前客户已经存在绑定关系 return '当前客户已经存在绑定关系';//当前客户已经存在绑定关系
}
$user_id = $bind_id;
$bind_id_ = $user_info['bind_id'];
}else{
$user_bind = $this->userBindInfo($user_id);
if(count($user_bind) > 0){
return 3;//存在绑定关系
} }
$params_user_id = $bind_id;
$params_bind_id = $user_info['bind_id'];
}else{//=o 主账号
$b_user_info = $this->user->getUserById($field = 'bind_id', $bind_id); $b_user_info = $this->user->getUserById($field = 'bind_id', $bind_id);
if($b_user_info['bind_id'] == 0){ if($b_user_info['bind_id'] == 0){
$bind_id_ = $bind_id; //排除主账号
}else{ $user_bind_count = $this->user->getBindCount($bind_id);
$bind_id_ = $b_user_info['bind_id']; if($user_bind_count > 0){
return '当前客户已经存在绑定关系';//当前客户已经存在绑定关系
}
} }
$params_user_id = $bind_id;
$params_bind_id = $user_id;
} }
$bind_count = $this->userBindInfo($bind_id_); $bind_count = $this->userBindInfo($params_bind_id);
if(count($bind_count) > 3){ if(count($bind_count) > 3){
return 4; return '绑定客户关系数超限';
} }
$params_['bind_id'] = $bind_id_; $params_['bind_id'] = $params_bind_id;
$res = $this->user->updateUsers($user_id,$params_); $res = $this->user->updateUsers($params_user_id,$params_);
if($res ==1){ if($res ==1){
return 0; return true;
}else{ }else{
return 5; return '绑定失败';
} }
} }
......
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