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

增加发起报修消息推送

... ... @@ -35,6 +35,12 @@ return array (
//极光
'app_key' => '8b9deb177c5cde93c4fb0a35',
'master_secret' => 'f78f6271b36a05bffc66d31b',
//推送消息提示
'title' => '推送消息提醒',
//报修甲方发起,提醒乙方员工
'repair_content_add_a' => '甲方发起一个报修申请,等待您前往确认',
//报修乙方发起,提醒甲方员工
'repair_content_add_b' => '乙方发起一个报修申请,等待您前往确认',
//甲方提交报修流程
'a_step' => ['甲方提交报修信息','乙方确认信息','乙方维修设备','乙方提交维修单','甲方验收维修结果','甲方验收完成'],
... ...
... ... @@ -511,21 +511,6 @@ class CommonController extends RestBaseController
}
//根据uid查询用户
public function getUser($where){
$res = Db::name('user')
->where($where)
->field('id,user_login,identity')
->find();
$res['other'] = '';
if(isset($res['identity']) && !empty($res['identity'])){
//获取用户身份,所属企业,项目
$other = $this->getUserIdentity($res['identity']);
$res['other'] = $other;
}
return $res;
}
//根据uid查询用户
public function getUserById($where){
$res = Db::name('user')
->where($where)
... ... @@ -2226,4 +2211,14 @@ class CommonController extends RestBaseController
return $registrations;
}
//根据项目id查找甲方/乙方项目组人员id
public function getUsersId($project_id,$field){
$users = Db::name('project')
->where('id',$project_id)
->field($field)
->find();
$usersId = explode(',',trim($users[$field],','));
return $usersId;
}
}
... ...
... ... @@ -193,16 +193,6 @@ class IndexController extends RestBaseController
}
}
//极光推送
public function pushRegistration(){
$registration_id = $this->request->get('registration_id');
$common = new CommonController();
$alias = [$registration_id];
$content = '您有一条消息,请注意查收';
$title = '推送消息';
$common->pushMessage($alias,$content,$title);
}
/**
* @title 员工项目列表
* @description 接口说明
... ...
... ... @@ -69,6 +69,24 @@ class RepairController extends RestBaseController
$repairModel = new RepairModel();
$res = $repairModel->create($data);
if($res){
//极光推送
if($data['party'] == 0){
//甲方发起,推送乙方员工
$user_ids = $common->getUsersId($data['project_id'],'b_sid');
$content = config('site.repair_content_add_a');
}else{
//乙方发起,推送甲方员工
$user_ids = $common->getUsersId($data['project_id'],'a_sid');
$content = config('site.repair_content_add_b');
}
$registration_id = $common->getPushUsers($user_ids);
if($registration_id){
$common = new CommonController();
$title = config('site.title');
$common->pushMessage($registration_id,$content,$title);
}
//处理流程
$id = $res->id;
$data1['create_time'] = time();
if($party['party'] == 0){
... ...