request->post(); $rule = new Validate([ 'user_id'=>'require' ]); if(!$rule->check($data)){ return jsonError($rule->getError()); } $list = $this->promotion_obj->where('user_id',$data['user_id'])->select(); $re['list'] = $list; return jsonSuccess($list); } /**获取用户库列表 * @return void */ public function getHumenLib(){ $lib[] = "user"; $lib[] = "author"; $lib[] = "ash"; $re['list'] = $lib; return jsonSuccess($re); } /**筛选用户库目标数量 * @return void * @throws Exception */ public function getLibUsers(){ $data = $this->request->post(); $rule = new Validate([ "lib"=>"require", 'category'=>"require", "body"=>"require" ]); if(!$rule->check($data)){ return jsonError($rule->getError()); } $count = 0; if($data['lib']=="user"){//用户库选择为正式库 $where['t_user.state'] = 0; $where['t_user.no_email'] = 0; if($data['category']=="major"){ $where['t_user_reviewer_info.major'] = ['in',$this->majorids($data['body'])]; }else{ $where["t_user_reviewer_info.field"] = ["like","%".$data['body']."%"]; } $count=$this->user_obj->join("t_user_reviewer_info","t_user.user_id = t_user_reviewer_info.reviewer_id","left")->where($where)->count(); }elseif($data['lib']=="author"){//用户库选择为作者库 $where['t_user.state'] = 0; $where['t_user.no_email'] = 0; if($data['category']=="major"){ $where['t_user_reviewer_info.major'] = ['in',$this->majorids($data['body'])]; }else{ $where["t_user_reviewer_info.field"] = ["like","%".$data['body']."%"]; } $exist = "select * from t_user_author where user_id = t_user.user_id"; $count=$this->user_obj->join("t_user_reviewer_info","t_user.user_id = t_user_reviewer_info.reviewer_id","left")->where($where)->whereExists($exist)->count(); }else{//灰库 $where["t_user_ash.state"] = 0 ; $where['t_user_ash.no_email'] = 0; if($data['category']=="major"){ $where['t_user_ash.major'] = ['in',$this->majorids($data['body'])]; }else { $where['t_use_ash.field'] = ['like',"%".$data['body']."%"]; } $count=$this->user_ash_obj->where($where)->count(); } $re['count'] = $count; return jsonSuccess($re); } /**退订推广邮件 * @return void */ public function NoEmail(){ } /**获取邮件模版列表 * @return void */ public function getEmailModel(){ } }