作者 景龙
1 个管道 的构建 通过 耗费 18 秒

增加报修改造,培训演习极光推送

@@ -37,10 +37,55 @@ return array ( @@ -37,10 +37,55 @@ return array (
37 'master_secret' => 'f78f6271b36a05bffc66d31b', 37 'master_secret' => 'f78f6271b36a05bffc66d31b',
38 //推送消息提示 38 //推送消息提示
39 'title' => '推送消息提醒', 39 'title' => '推送消息提醒',
  40 +
  41 +
40 //报修甲方发起,提醒乙方员工 42 //报修甲方发起,提醒乙方员工
41 'repair_content_add_a' => '甲方发起一个报修申请,等待您前往确认', 43 'repair_content_add_a' => '甲方发起一个报修申请,等待您前往确认',
42 //报修乙方发起,提醒甲方员工 44 //报修乙方发起,提醒甲方员工
43 'repair_content_add_b' => '乙方发起一个报修申请,等待您前往确认', 45 'repair_content_add_b' => '乙方发起一个报修申请,等待您前往确认',
  46 + //报修甲方员工确认,提醒乙方员工
  47 + 'repair_content_confirm_a' => '甲方员工已确认信息,等待设备维修',
  48 + //报修乙方员工确认,提醒甲方员工
  49 + 'repair_content_confirm_b' => '乙方员工已确认信息,等待设备维修',
  50 + //报修甲方确认完成,提醒甲乙方领导
  51 + 'repair_content_finish' => '甲方验收完成,设备维修完毕',
  52 +
  53 + //改造甲方发起,提醒乙方员工
  54 + 'reform_content_add_a' => '甲方发起一个改造申请,等待您前往确认',
  55 + //改造乙方发起,提醒甲方员工
  56 + 'reform_content_add_b' => '乙方发起一个改造申请,等待您前往确认',
  57 + //改造甲方员工确认,提醒乙方员工
  58 + 'reform_content_confirm_a' => '甲方员工已确认信息,等待设备改造',
  59 + //改造乙方员工确认,提醒甲方员工
  60 + 'reform_content_confirm_b' => '乙方员工已确认信息,等待设备改造',
  61 + //改造甲方确认完成,提醒甲乙方领导
  62 + 'reform_content_finish' => '甲方验收完成,设备改造完毕',
  63 +
  64 +
  65 +
  66 + //培训甲方发起,提醒乙方领导
  67 + 'train_content_add_a' => '甲方发起一个培训申请,等待您前往审批',
  68 + //培训甲方重新发起(被乙方驳回后),提醒乙方领导
  69 + 'train_content_again_a' => '甲方重新发起一个培训申请,等待您前往审批',
  70 + //培训乙方领导确认,提醒甲乙方员工
  71 + 'train_content_confirm_l' => '乙方领导已确认信息,等待完善培训单',
  72 + //培训乙方领导驳回,提醒甲方员工
  73 + 'train_content_reject_l' => '乙方领导已驳回信息,等待您重新发起申请',
  74 + //培训甲方确认完成,提醒甲乙方领导
  75 + 'train_content_finish' => '甲方验收完成,培训完成',
  76 +
  77 + //演习甲方发起,提醒乙方领导
  78 + 'exercise_content_add_a' => '甲方发起一个演习申请,等待您前往审批',
  79 + //演习甲方重新发起(被乙方驳回后),提醒乙方领导
  80 + 'exercise_content_again_a' => '甲方重新发起一个演习申请,等待您前往审批',
  81 + //演习乙方领导确认,提醒甲乙方员工
  82 + 'exercise_content_confirm_l' => '乙方领导已确认信息,等待完善演习单',
  83 + //演习乙方领导驳回,提醒甲方员工
  84 + 'exercise_content_reject_l' => '乙方领导已驳回信息,等待您重新发起申请',
  85 + //演习甲方确认完成,提醒甲乙方领导
  86 + 'exercise_content_finish' => '甲方验收完成,演习完成',
  87 +
  88 +
44 89
45 //甲方提交报修流程 90 //甲方提交报修流程
46 'a_step' => ['甲方提交报修信息','乙方确认信息','乙方维修设备','乙方提交维修单','甲方验收维修结果','甲方验收完成'], 91 'a_step' => ['甲方提交报修信息','乙方确认信息','乙方维修设备','乙方提交维修单','甲方验收维修结果','甲方验收完成'],
@@ -2221,4 +2221,79 @@ class CommonController extends RestBaseController @@ -2221,4 +2221,79 @@ class CommonController extends RestBaseController
2221 return $usersId; 2221 return $usersId;
2222 } 2222 }
2223 2223
  2224 + //根据项目id查找甲乙方领导id
  2225 + public function getLeadersId($project_id){
  2226 + $res = Db::name('project')
  2227 + ->where('id',$project_id)
  2228 + ->field('id,a_cid,b_cid')
  2229 + ->find();
  2230 + $leadersId = [];
  2231 + if($res){
  2232 + $c_ids = [$res['a_cid'],$res['b_cid']];
  2233 + $company = Db::name('company')
  2234 + ->whereIn('id',$c_ids)
  2235 + ->field('id,u_l_id,u_ls_id')
  2236 + ->select()
  2237 + ->toArray();
  2238 + $u_l_ids = array_filter(array_column($company,'u_l_id'));
  2239 + $u_ls_ids = array_filter(array_column($company,'u_ls_id'));
  2240 + $leadersId = array_merge($u_l_ids,$u_ls_ids);
  2241 + }
  2242 + return $leadersId;
  2243 + }
  2244 +
  2245 + //根据项目id查找甲/乙方领导
  2246 + public function getLeaderA($project_id,$field){
  2247 + $res = Db::name('project')
  2248 + ->where('id',$project_id)
  2249 + ->field($field)
  2250 + ->find();
  2251 + $uIds = [];
  2252 + if($res){
  2253 + $company = Db::name('company')
  2254 + ->where('id',$res[$field])
  2255 + ->field('id,u_l_id')
  2256 + ->find();
  2257 + $uIds = [$company['u_l_id']];
  2258 + }
  2259 + return $uIds;
  2260 + }
  2261 +
  2262 + //根据项目id查找甲乙方员工id
  2263 + public function getStaffId($project_id){
  2264 + $res = Db::name('project')
  2265 + ->where('id',$project_id)
  2266 + ->field('id,a_cid,b_cid')
  2267 + ->find();
  2268 + $usersId = [];
  2269 + if($res){
  2270 + $a_sid = explode(',',trim($res['a_cid'],','));
  2271 + $b_sid = explode(',',trim($res['b_cid'],','));
  2272 + $usersId = array_merge($a_sid,$b_sid);
  2273 + }
  2274 + return $usersId;
  2275 + }
  2276 +
  2277 + //根据列表id查询甲/乙方员工(指定单个)id
  2278 + public function getUserA($table,$id){
  2279 + $res = Db::name($table)
  2280 + ->where('id',$id)
  2281 + ->field('id,uid')
  2282 + ->find();
  2283 + $uid = [];
  2284 + if($res){
  2285 + $uid = [$res['uid']];
  2286 + }
  2287 + return $uid;
  2288 + }
  2289 +
  2290 + //根据id查询项目id
  2291 + public function getProjectId($table,$where,$field){
  2292 + $res = Db::name($table)
  2293 + ->where($where)
  2294 + ->field($field)
  2295 + ->find();
  2296 + return $res;
  2297 + }
  2298 +
2224 } 2299 }
@@ -122,6 +122,18 @@ class ExerciseController extends RestBaseController @@ -122,6 +122,18 @@ class ExerciseController extends RestBaseController
122 $exerciseModel = new ExerciseModel(); 122 $exerciseModel = new ExerciseModel();
123 $res = $exerciseModel->create($data); 123 $res = $exerciseModel->create($data);
124 if($res){ 124 if($res){
  125 + //极光推送
  126 + //甲方发起,提醒乙方领导
  127 + $user_ids = $common->getLeaderA($data['project_id'],'b_cid');
  128 + $content = config('site.exercise_content_add_a');
  129 +
  130 + $registration_id = $common->getPushUsers($user_ids);
  131 + if($registration_id){
  132 + $common = new CommonController();
  133 + $title = config('site.title');
  134 + $common->pushMessage($registration_id,$content,$title);
  135 + }
  136 +
125 $this->success('演习信息提交成功'); 137 $this->success('演习信息提交成功');
126 }else{ 138 }else{
127 $this->error('失败'); 139 $this->error('失败');
@@ -201,6 +213,20 @@ class ExerciseController extends RestBaseController @@ -201,6 +213,20 @@ class ExerciseController extends RestBaseController
201 $exerciseModel = new ExerciseModel(); 213 $exerciseModel = new ExerciseModel();
202 $res = $exerciseModel->where(['id'=>$data['id'],'status'=>1])->update($arr); 214 $res = $exerciseModel->where(['id'=>$data['id'],'status'=>1])->update($arr);
203 if($res){ 215 if($res){
  216 + //极光推送
  217 + //甲方重新发起,提醒乙方领导
  218 + $project = $common->getProjectId('exercise',['id'=>$data['id']],'id,project_id');
  219 + $user_ids = $common->getLeaderA($project['project_id'],'b_cid');
  220 + $content = config('site.train_content_again_a');
  221 +
  222 + $registration_id = $common->getPushUsers($user_ids);
  223 + if($registration_id){
  224 + $common = new CommonController();
  225 + $title = config('site.title');
  226 + $common->pushMessage($registration_id,$content,$title);
  227 + }
  228 +
  229 +
204 $this->success('演习信息重新提交成功'); 230 $this->success('演习信息重新提交成功');
205 }else{ 231 }else{
206 $this->error('失败'); 232 $this->error('失败');
@@ -338,6 +364,20 @@ class ExerciseController extends RestBaseController @@ -338,6 +364,20 @@ class ExerciseController extends RestBaseController
338 ]; 364 ];
339 $res = $exerciseModel->where(['id'=>$data['id'],'status'=>2])->update($arr); 365 $res = $exerciseModel->where(['id'=>$data['id'],'status'=>2])->update($arr);
340 if($res){ 366 if($res){
  367 + //推送
  368 + //甲方确认完成,提醒甲乙方领导
  369 + $project = $common->getProjectId('exercise',['id'=>$data['id']],'id,project_id');
  370 + $user_ids = $common->getLeadersId($project['project_id']);
  371 + $content = config('site.exercise_content_finish');
  372 +
  373 + $registration_id = $common->getPushUsers($user_ids);
  374 + if($registration_id){
  375 + $common = new CommonController();
  376 + $title = config('site.title');
  377 + $common->pushMessage($registration_id,$content,$title);
  378 + }
  379 +
  380 +
341 $this->success('成功'); 381 $this->success('成功');
342 }else{ 382 }else{
343 $this->error('失败'); 383 $this->error('失败');
@@ -229,4 +229,24 @@ class IndexController extends RestBaseController @@ -229,4 +229,24 @@ class IndexController extends RestBaseController
229 $this->error('请求方式错误!'); 229 $this->error('请求方式错误!');
230 } 230 }
231 } 231 }
  232 +
  233 + /**
  234 + * @title 更新版本
  235 + * @description 接口说明
  236 + * @author 开发者
  237 + * @url /api/home/index/updateVersion
  238 + * @method GET
  239 + *
  240 + * @header name:token require:1 default: desc:header
  241 + *
  242 + * @return project_id:项目id
  243 + * @return project_name:项目名称
  244 + */
  245 + public function updateVersion(){
  246 + if($this->request->isGet()){
  247 + $this->error('请联系管理员分配公司!');
  248 + }else{
  249 + $this->error('请求方式错误!');
  250 + }
  251 + }
232 } 252 }
@@ -252,6 +252,24 @@ class InformationController extends RestBaseController @@ -252,6 +252,24 @@ class InformationController extends RestBaseController
252 } 252 }
253 253
254 if($res){ 254 if($res){
  255 +
  256 + //推送
  257 + if($type == 1){
  258 + //培训,乙方领导确认,提醒甲乙方员工
  259 + $user_ids = $common->getStaffId($data['project_id']);
  260 + $content = config('site.train_content_confirm_l');
  261 + }else{
  262 + //演习,乙方领导确认,提醒甲乙方员工
  263 + $user_ids = $common->getStaffId($data['project_id']);
  264 + $content = config('site.exercise_content_confirm_l');
  265 + }
  266 + $registration_id = $common->getPushUsers($user_ids);
  267 + if($registration_id){
  268 + $common = new CommonController();
  269 + $title = config('site.title');
  270 + $common->pushMessage($registration_id,$content,$title);
  271 + }
  272 +
255 $this->success('成功'); 273 $this->success('成功');
256 }else{ 274 }else{
257 $this->error('失败'); 275 $this->error('失败');
@@ -348,6 +366,24 @@ class InformationController extends RestBaseController @@ -348,6 +366,24 @@ class InformationController extends RestBaseController
348 } 366 }
349 367
350 if($res){ 368 if($res){
  369 + //推送
  370 + if($type == 1){
  371 + //培训,乙方领导驳回,提醒甲方发起员工
  372 + $user_ids = $common->getUserA('train',$id);
  373 + $content = config('site.train_content_reject_l');
  374 + }else{
  375 + //演习,乙方领导发起,提醒甲方发起员工
  376 + $user_ids = $common->getUserA('exercise',$id);
  377 + $content = config('site.exercise_content_reject_l');
  378 + }
  379 + $registration_id = $common->getPushUsers($user_ids);
  380 + if($registration_id){
  381 + $common = new CommonController();
  382 + $title = config('site.title');
  383 + $common->pushMessage($registration_id,$content,$title);
  384 + }
  385 +
  386 +
351 $this->success('成功'); 387 $this->success('成功');
352 }else{ 388 }else{
353 $this->error('失败'); 389 $this->error('失败');
@@ -70,6 +70,23 @@ class ReformController extends RestBaseController @@ -70,6 +70,23 @@ class ReformController extends RestBaseController
70 $data['images'] = $common->relationUrl($data['images']); 70 $data['images'] = $common->relationUrl($data['images']);
71 $res = $reformModel->create($data); 71 $res = $reformModel->create($data);
72 if($res){ 72 if($res){
  73 + //极光推送
  74 + if($data['party'] == 0){
  75 + //甲方发起,推送乙方员工
  76 + $user_ids = $common->getUsersId($data['project_id'],'b_sid');
  77 + $content = config('site.reform_content_add_a');
  78 + }else{
  79 + //乙方发起,推送甲方员工
  80 + $user_ids = $common->getUsersId($data['project_id'],'a_sid');
  81 + $content = config('site.reform_content_add_b');
  82 + }
  83 + $registration_id = $common->getPushUsers($user_ids);
  84 + if($registration_id){
  85 + $common = new CommonController();
  86 + $title = config('site.title');
  87 + $common->pushMessage($registration_id,$content,$title);
  88 + }
  89 +
73 $id = $res->id; 90 $id = $res->id;
74 $data1['create_time'] = time(); 91 $data1['create_time'] = time();
75 if($party['party'] == 0){ 92 if($party['party'] == 0){
@@ -209,6 +226,18 @@ class ReformController extends RestBaseController @@ -209,6 +226,18 @@ class ReformController extends RestBaseController
209 $reformModel = new ReformModel(); 226 $reformModel = new ReformModel();
210 $res = $reformModel->where(['id'=>$id,'status'=>0])->update(['status'=>1,'h_uid'=>$this->userId]); 227 $res = $reformModel->where(['id'=>$id,'status'=>0])->update(['status'=>1,'h_uid'=>$this->userId]);
211 if($res){ 228 if($res){
  229 + //极光推送,推送乙方员工
  230 + $project = $common->getProjectId('reform',['id'=>$id],'id,project_id');
  231 + $user_ids = $common->getUsersId($project['project_id'],'b_sid');
  232 + $content = config('site.reform_content_confirm_a');
  233 +
  234 + $registration_id = $common->getPushUsers($user_ids);
  235 + if($registration_id){
  236 + $common = new CommonController();
  237 + $title = config('site.title');
  238 + $common->pushMessage($registration_id,$content,$title);
  239 + }
  240 +
212 241
213 //甲方确认 242 //甲方确认
214 $step_name = config('site.b_reform_step')[1]; 243 $step_name = config('site.b_reform_step')[1];
@@ -257,6 +286,19 @@ class ReformController extends RestBaseController @@ -257,6 +286,19 @@ class ReformController extends RestBaseController
257 $reformModel = new ReformModel(); 286 $reformModel = new ReformModel();
258 $res = $reformModel->where(['id'=>$id,'status'=>0])->update(['status'=>1,'h_uid'=>$this->userId]); 287 $res = $reformModel->where(['id'=>$id,'status'=>0])->update(['status'=>1,'h_uid'=>$this->userId]);
259 if($res){ 288 if($res){
  289 + //极光推送,推送甲方员工
  290 + $project = $common->getProjectId('reform',['id'=>$id],'id,project_id');
  291 + $user_ids = $common->getUsersId($project['project_id'],'a_sid');
  292 + $content = config('site.reform_content_confirm_b');
  293 +
  294 + $registration_id = $common->getPushUsers($user_ids);
  295 + if($registration_id){
  296 + $common = new CommonController();
  297 + $title = config('site.title');
  298 + $common->pushMessage($registration_id,$content,$title);
  299 + }
  300 +
  301 +
260 //乙方确认 302 //乙方确认
261 $step_name = config('site.a_reform_step')[1]; 303 $step_name = config('site.a_reform_step')[1];
262 $common->repairStep($id,$step_name,1); 304 $common->repairStep($id,$step_name,1);
@@ -541,6 +583,19 @@ class ReformController extends RestBaseController @@ -541,6 +583,19 @@ class ReformController extends RestBaseController
541 ]; 583 ];
542 $res = $reformModel->where(['id'=>$data['id'],'status'=>1])->update($arr); 584 $res = $reformModel->where(['id'=>$data['id'],'status'=>1])->update($arr);
543 if($res){ 585 if($res){
  586 + //极光推送,推送甲乙方领导
  587 + $project = $common->getProjectId('reform',['id'=>$data['id']],'id,project_id');
  588 + $user_ids = $common->getLeadersId($project['project_id']);
  589 + $content = config('site.reform_content_finish');
  590 +
  591 + $registration_id = $common->getPushUsers($user_ids);
  592 + if($registration_id){
  593 + $common = new CommonController();
  594 + $title = config('site.title');
  595 + $common->pushMessage($registration_id,$content,$title);
  596 + }
  597 +
  598 +
544 //创建最后维修流程 599 //创建最后维修流程
545 $step_name = config('site.a_reform_step')[5]; 600 $step_name = config('site.a_reform_step')[5];
546 $common->repairStep($data['id'],$step_name,1); 601 $common->repairStep($data['id'],$step_name,1);
@@ -71,11 +71,11 @@ class RepairController extends RestBaseController @@ -71,11 +71,11 @@ class RepairController extends RestBaseController
71 if($res){ 71 if($res){
72 //极光推送 72 //极光推送
73 if($data['party'] == 0){ 73 if($data['party'] == 0){
74 - //甲方发起,推送乙方员工 74 + //甲方发起,提醒乙方员工
75 $user_ids = $common->getUsersId($data['project_id'],'b_sid'); 75 $user_ids = $common->getUsersId($data['project_id'],'b_sid');
76 $content = config('site.repair_content_add_a'); 76 $content = config('site.repair_content_add_a');
77 }else{ 77 }else{
78 - //乙方发起,推送甲方员工 78 + //乙方发起,提醒甲方员工
79 $user_ids = $common->getUsersId($data['project_id'],'a_sid'); 79 $user_ids = $common->getUsersId($data['project_id'],'a_sid');
80 $content = config('site.repair_content_add_b'); 80 $content = config('site.repair_content_add_b');
81 } 81 }
@@ -229,6 +229,17 @@ class RepairController extends RestBaseController @@ -229,6 +229,17 @@ class RepairController extends RestBaseController
229 $repairModel = new RepairModel(); 229 $repairModel = new RepairModel();
230 $res = $repairModel->where(['id'=>$id,'status'=>0])->update(['status'=>1,'h_uid'=>$this->userId]); 230 $res = $repairModel->where(['id'=>$id,'status'=>0])->update(['status'=>1,'h_uid'=>$this->userId]);
231 if($res){ 231 if($res){
  232 + //极光推送,提醒乙方员工
  233 + $project = $common->getProjectId('repair',['id'=>$id],'id,project_id');
  234 + $user_ids = $common->getUsersId($project['project_id'],'b_sid');
  235 + $content = config('site.repair_content_confirm_a');
  236 +
  237 + $registration_id = $common->getPushUsers($user_ids);
  238 + if($registration_id){
  239 + $common = new CommonController();
  240 + $title = config('site.title');
  241 + $common->pushMessage($registration_id,$content,$title);
  242 + }
232 243
233 //甲方确认 244 //甲方确认
234 $step_name = config('site.b_step')[1]; 245 $step_name = config('site.b_step')[1];
@@ -278,6 +289,19 @@ class RepairController extends RestBaseController @@ -278,6 +289,19 @@ class RepairController extends RestBaseController
278 $repairModel = new RepairModel(); 289 $repairModel = new RepairModel();
279 $res = $repairModel->where(['id'=>$id,'status'=>0])->update(['status'=>1,'h_uid'=>$this->userId]); 290 $res = $repairModel->where(['id'=>$id,'status'=>0])->update(['status'=>1,'h_uid'=>$this->userId]);
280 if($res){ 291 if($res){
  292 + //极光推送,推送甲方员工
  293 + $project = $common->getProjectId('repair',['id'=>$id],'id,project_id');
  294 + $user_ids = $common->getUsersId($project['project_id'],'a_sid');
  295 + $content = config('site.repair_content_confirm_b');
  296 +
  297 + $registration_id = $common->getPushUsers($user_ids);
  298 + if($registration_id){
  299 + $common = new CommonController();
  300 + $title = config('site.title');
  301 + $common->pushMessage($registration_id,$content,$title);
  302 + }
  303 +
  304 +
281 //乙方确认 305 //乙方确认
282 $step_name = config('site.a_step')[1]; 306 $step_name = config('site.a_step')[1];
283 $common->repairStep($id,$step_name); 307 $common->repairStep($id,$step_name);
@@ -561,6 +585,19 @@ class RepairController extends RestBaseController @@ -561,6 +585,19 @@ class RepairController extends RestBaseController
561 ]; 585 ];
562 $res = $repairModel->where(['id'=>$data['id'],'status'=>1])->update($arr); 586 $res = $repairModel->where(['id'=>$data['id'],'status'=>1])->update($arr);
563 if($res){ 587 if($res){
  588 + //极光推送,推送甲乙方领导
  589 + $project = $common->getProjectId('repair',['id'=>$data['id']],'id,project_id');
  590 + $user_ids = $common->getLeadersId($project['project_id']);
  591 + $content = config('site.repair_content_finish');
  592 +
  593 + $registration_id = $common->getPushUsers($user_ids);
  594 + if($registration_id){
  595 + $common = new CommonController();
  596 + $title = config('site.title');
  597 + $common->pushMessage($registration_id,$content,$title);
  598 + }
  599 +
  600 +
564 //创建最后维修流程 601 //创建最后维修流程
565 $step_name = config('site.a_step')[5]; 602 $step_name = config('site.a_step')[5];
566 $common->repairStep($data['id'],$step_name); 603 $common->repairStep($data['id'],$step_name);
@@ -123,6 +123,18 @@ class TrainController extends RestBaseController @@ -123,6 +123,18 @@ class TrainController extends RestBaseController
123 $trainModel = new TrainModel(); 123 $trainModel = new TrainModel();
124 $res = $trainModel->create($data); 124 $res = $trainModel->create($data);
125 if($res){ 125 if($res){
  126 + //极光推送
  127 + //甲方发起,提醒乙方领导
  128 + $user_ids = $common->getLeaderA($data['project_id'],'b_cid');
  129 + $content = config('site.train_content_add_a');
  130 +
  131 + $registration_id = $common->getPushUsers($user_ids);
  132 + if($registration_id){
  133 + $common = new CommonController();
  134 + $title = config('site.title');
  135 + $common->pushMessage($registration_id,$content,$title);
  136 + }
  137 +
126 $this->success('培训信息提交成功'); 138 $this->success('培训信息提交成功');
127 }else{ 139 }else{
128 $this->error('失败'); 140 $this->error('失败');
@@ -202,6 +214,19 @@ class TrainController extends RestBaseController @@ -202,6 +214,19 @@ class TrainController extends RestBaseController
202 $trainModel = new TrainModel(); 214 $trainModel = new TrainModel();
203 $res = $trainModel->where(['id'=>$data['id'],'status'=>1])->update($arr); 215 $res = $trainModel->where(['id'=>$data['id'],'status'=>1])->update($arr);
204 if($res){ 216 if($res){
  217 + //极光推送
  218 + //甲方重新发起,提醒乙方领导
  219 + $project = $common->getProjectId('train',['id'=>$data['id']],'id,project_id');
  220 + $user_ids = $common->getLeaderA($project['project_id'],'b_cid');
  221 + $content = config('site.train_content_again_a');
  222 +
  223 + $registration_id = $common->getPushUsers($user_ids);
  224 + if($registration_id){
  225 + $common = new CommonController();
  226 + $title = config('site.title');
  227 + $common->pushMessage($registration_id,$content,$title);
  228 + }
  229 +
205 $this->success('培训信息重新提交成功'); 230 $this->success('培训信息重新提交成功');
206 }else{ 231 }else{
207 $this->error('失败'); 232 $this->error('失败');
@@ -336,6 +361,20 @@ class TrainController extends RestBaseController @@ -336,6 +361,20 @@ class TrainController extends RestBaseController
336 ]; 361 ];
337 $res = $trainModel->where(['id'=>$data['id'],'status'=>2])->update($arr); 362 $res = $trainModel->where(['id'=>$data['id'],'status'=>2])->update($arr);
338 if($res){ 363 if($res){
  364 + //推送
  365 + //甲方确认完成,提醒甲乙方领导
  366 + $project = $common->getProjectId('train',['id'=>$data['id']],'id,project_id');
  367 + $user_ids = $common->getLeadersId($project['project_id']);
  368 + $content = config('site.train_content_finish');
  369 +
  370 + $registration_id = $common->getPushUsers($user_ids);
  371 + if($registration_id){
  372 + $common = new CommonController();
  373 + $title = config('site.title');
  374 + $common->pushMessage($registration_id,$content,$title);
  375 + }
  376 +
  377 +
339 $this->success('成功'); 378 $this->success('成功');
340 }else{ 379 }else{
341 $this->error('失败'); 380 $this->error('失败');