This commit is contained in:
wangjinlei
2025-02-11 09:19:24 +08:00
parent fb647bd6fa
commit aff3123377
6 changed files with 68 additions and 13 deletions

View File

@@ -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([]);
}
/**
* 获取用户所有客座专刊
*/