1
This commit is contained in:
@@ -1458,6 +1458,40 @@ class User extends Base
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function addUserMajor(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"user_id"=>"require",
|
||||
"major_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$check = $this->major_to_user_obj->where("user_id",$data['user_id'])->where("major_id",$data['major_id'])->where("state",0)->find();
|
||||
if($check){
|
||||
return jsonError("Repeat addition");
|
||||
}
|
||||
$insert['user_id'] = $data['user_id'];
|
||||
$insert['major_id'] = $data['major_id'];
|
||||
$insert['ctime'] = time();
|
||||
$this->major_to_user_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function delUserMajor(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"mtu_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->major_to_user_obj->where("mtu_id",$data['mtu_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户所有客座专刊
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user