Commit fe966544 authored by zhuwei's avatar zhuwei

设置原盘重盘

parent c71c7027
......@@ -772,4 +772,24 @@ class Member extends Basic{
return $this->response(200, '', ['list'=>$list, 'total'=>$total]);
}
/**
* 设置原盘重盘
* @return \think\Response
*/
public function setUserBindType()
{
if ( empty($this->params['user_id'])) {
return $this->response(101, 'user_id不能为空');
}
$s_index_user = new UserService();
$res = $s_index_user->setUserBindType($this->params['user_id']);
if ($res) {
return $this->response("200", "绑定成功");
} else {
return $this->response("300", '失败');
}
}
}
......@@ -1007,4 +1007,28 @@ class UserService
return true;
}
/**
* 设置原盘重盘
* @param $user_id
* @return bool
*/
public function setUserBindType($user_id)
{
// 根据userid把绑定关系查出来
$s_user_call = new UserCallStintService();
$user_list = $s_user_call->getUserBindList($user_id);
if(!$user_list or (count($user_list) < 2)){
return false;
}
foreach($user_list as $k => $v) {
if($v == $user_id){// 将当前user_id设置为原盘 0:未设置 1:原盘 2:重盘
$this->user->updateUsers($v, ['bind_type'=>1]);
}else{// 其他设置为重盘
$this->user->updateUsers($v, ['bind_type'=>2]);
}
}
return true;
}
}
\ No newline at end of file
......@@ -506,6 +506,8 @@ Route::group('index', [
'getUserBindHistory' => ['index/member/getUserBindHistory', ['method' => 'get|post']],
'lookUserLog' => ['index/member/lookUserLog', ['method' => 'get|post']], //客户查看日志
'setUserBindType' => ['index/member/setUserBindType', ['method' => 'get|post']],
'saveActivity' => ['index/Activity/saveActivity', ['method' => 'POST|GET']],//新增或修改活动
'getActivityList' => ['index/Activity/getActivityList', ['method' => 'POST|GET']],//获取活动
'couponList' => ['index/Coupon/couponList', ['method' => 'GET']],//获取活动
......
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