正在显示
7 个修改的文件
包含
95 行增加
和
16 行删除
@@ -159,6 +159,16 @@ class Store extends Backend | @@ -159,6 +159,16 @@ class Store extends Backend | ||
159 | } | 159 | } |
160 | } | 160 | } |
161 | } | 161 | } |
162 | + // 发送模板消息 | ||
163 | + $send_data = array( | ||
164 | + "first" => '恭喜您,商户申请审核通过!', | ||
165 | + "keyword1" => $row->store_name, | ||
166 | + "keyword2" => date('Y-m-s',time()), | ||
167 | + "remark" => '点击进入商户后台', | ||
168 | + ); | ||
169 | + $openid = Db::name('third')->where('user_id',$row->user_id)->value('openid'); | ||
170 | + $url = 'http://community.t.brotop.cn/admininfo.php'; | ||
171 | + (new \app\common\controller\Api)->wxsendmessage($openid,$send_data,config('option.template')['store_pass'],$url); | ||
162 | } | 172 | } |
163 | if($params['status'] == 4) { | 173 | if($params['status'] == 4) { |
164 | // 审核不通过,执行退款操作 | 174 | // 审核不通过,执行退款操作 |
@@ -122,6 +122,19 @@ class StoreInform extends Backend | @@ -122,6 +122,19 @@ class StoreInform extends Backend | ||
122 | Db::startTrans(); | 122 | Db::startTrans(); |
123 | try { | 123 | try { |
124 | $result = $row->save(); | 124 | $result = $row->save(); |
125 | + $apiController = new \app\common\controller\Api(); | ||
126 | + $openid = Db::name('third')->where('user_id',$row->user_id)->value('openid'); | ||
127 | + $url = config('option.vue_url') . '/releasedetal?id='.$row->id; | ||
128 | + if($params['status'] == 2) { | ||
129 | + // 发送模板消息 | ||
130 | + $send_data = array( | ||
131 | + "first" => '您的广告投放已出结果。', | ||
132 | + "keyword1" => $row->content, | ||
133 | + "keyword2" => '审核通过', | ||
134 | + "remark" => '点击查看详情!', | ||
135 | + ); | ||
136 | + $apiController->wxsendmessage($openid,$send_data,config('option.template')['ad_pass'],$url); | ||
137 | + } | ||
125 | if($params['status'] == 4) { | 138 | if($params['status'] == 4) { |
126 | $user_model = new \app\admin\model\User(); | 139 | $user_model = new \app\admin\model\User(); |
127 | $user = $user_model->where('id', $row->user_id)->find(); | 140 | $user = $user_model->where('id', $row->user_id)->find(); |
@@ -138,6 +151,16 @@ class StoreInform extends Backend | @@ -138,6 +151,16 @@ class StoreInform extends Backend | ||
138 | $result_log = Db::name('user_score_log')->insertGetId($log); | 151 | $result_log = Db::name('user_score_log')->insertGetId($log); |
139 | // 返还用户余额 | 152 | // 返还用户余额 |
140 | $result_user = $user_model->where('id', $user['id'])->setInc('score', $row->score); | 153 | $result_user = $user_model->where('id', $user['id'])->setInc('score', $row->score); |
154 | + // 发送模板消息 | ||
155 | + $nickname = Db::name('user')->where('id',$row->user_id)->value('nickname'); | ||
156 | + $send_data = array( | ||
157 | + "first" => '抱歉!您的广告 审核失败。', | ||
158 | + "keyword1" => $row->content, | ||
159 | + "keyword2" => $nickname, | ||
160 | + "keyword3" => '您的广告未通过', | ||
161 | + "remark" => '您的广告未通过审核, 请您重新申请。', | ||
162 | + ); | ||
163 | + $apiController->wxsendmessage($openid,$send_data,config('option.template')['ad_fail'],$url); | ||
141 | } | 164 | } |
142 | Db::commit(); | 165 | Db::commit(); |
143 | } catch (ValidateException $e) { | 166 | } catch (ValidateException $e) { |
@@ -119,6 +119,18 @@ class UserHouse extends Backend | @@ -119,6 +119,18 @@ class UserHouse extends Backend | ||
119 | // 新增社区用户数 | 119 | // 新增社区用户数 |
120 | if ($params['status'] == 2) { | 120 | if ($params['status'] == 2) { |
121 | Db::name('house')->where('id',$row->house_id)->setInc('bindnum'); | 121 | Db::name('house')->where('id',$row->house_id)->setInc('bindnum'); |
122 | + // 发送模板消息 | ||
123 | + $send_data = array( | ||
124 | + "first" => '尊敬的业主,您已成功认证为实名房间业主身份,认证信息如下:', | ||
125 | + "keyword1" => $row->name, | ||
126 | + "keyword2" => $row->phone, | ||
127 | + "remark" => '请仔细核对以上信息,如有不符,请与相关物业人员反馈,谢谢!', | ||
128 | + ); | ||
129 | + $openid = Db::name('third')->where('user_id',$row->user_id)->value('openid'); | ||
130 | + // 把用户的当前社区改为审核成功的小区 | ||
131 | + Db::name('user')->where('id',$row->user_id)->setField('house_id',$row->house_id); | ||
132 | + $url = config('option.vue_url') . '/affiche'; | ||
133 | + (new \app\common\controller\Api)->wxsendmessage($openid,$send_data,config('option.template')['license'],$url); | ||
122 | } | 134 | } |
123 | $result = $row->save(); | 135 | $result = $row->save(); |
124 | Db::commit(); | 136 | Db::commit(); |
@@ -527,6 +527,17 @@ class House extends Api | @@ -527,6 +527,17 @@ class House extends Api | ||
527 | $this->error('申请失败'); | 527 | $this->error('申请失败'); |
528 | }else{ | 528 | }else{ |
529 | Db::name('user')->where('id',$param['user_id'])->update(['mobile'=>$param['phone']]); | 529 | Db::name('user')->where('id',$param['user_id'])->update(['mobile'=>$param['phone']]); |
530 | + // 发送模板消息 | ||
531 | + $user = $this->auth->getUser(); | ||
532 | + $send_data = array( | ||
533 | + "first" => '您好,您有一个未处理的申请!', | ||
534 | + "keyword1" => $user['nickname'], | ||
535 | + "keyword2" => $user['mobile'], | ||
536 | + "keyword3" => date('Y年m月s日 H:i',time()), | ||
537 | + "remark" => '请尽快处理!', | ||
538 | + ); | ||
539 | + $url = 'http://community.t.brotop.cn/admininfo.php'; | ||
540 | + (new \app\common\controller\Api)->wxsendmessage('otlkQ0l4L3wsmz8dhDIbHJQVJnI8',$send_data,config('option.template')['examine'],$url); | ||
530 | $this->success('成功'); | 541 | $this->success('成功'); |
531 | } | 542 | } |
532 | }else{ | 543 | }else{ |
@@ -430,17 +430,18 @@ class HouseAdmin extends Api | @@ -430,17 +430,18 @@ class HouseAdmin extends Api | ||
430 | if(!empty($user_id_arr)){ | 430 | if(!empty($user_id_arr)){ |
431 | $house_name = House::where('id',$post['house_id'])->value('name'); | 431 | $house_name = House::where('id',$post['house_id'])->value('name'); |
432 | $send_data = array( | 432 | $send_data = array( |
433 | - "first" => '您绑定的社区【'.$house_name.'】发布了一条公告', | ||
434 | - 'keyword1' => $post['title'], | 433 | + "first" => $post['title'], |
434 | + "keyword1" => $post['title'], | ||
435 | "keyword2" => date('Y-m-s H:i:s',time()), | 435 | "keyword2" => date('Y-m-s H:i:s',time()), |
436 | - "remark" => '', | 436 | + "keyword3" => $post['content'], |
437 | + "remark" => $post['content'], | ||
437 | ); | 438 | ); |
438 | foreach ($user_id_arr as $user_id) { | 439 | foreach ($user_id_arr as $user_id) { |
439 | $openid = Db::name('third')->where('user_id',$user_id)->value('openid'); | 440 | $openid = Db::name('third')->where('user_id',$user_id)->value('openid'); |
440 | // 把用户的当前社区改为发送公告的小区 | 441 | // 把用户的当前社区改为发送公告的小区 |
441 | Db::name('user')->where('id',$user_id)->setField('house_id',$post['house_id']); | 442 | Db::name('user')->where('id',$user_id)->setField('house_id',$post['house_id']); |
442 | $url = config('option.vue_url') . '/affiche'; | 443 | $url = config('option.vue_url') . '/affiche'; |
443 | - $this->wxsendmessage($openid,$send_data,config('option.template')['msg'],$url); | 444 | + $this->wxsendmessage($openid,$send_data,config('option.template')['house_notice'],$url); |
444 | } | 445 | } |
445 | } | 446 | } |
446 | Db::commit(); | 447 | Db::commit(); |
@@ -362,6 +362,17 @@ class Store extends Api | @@ -362,6 +362,17 @@ class Store extends Api | ||
362 | $param['user_id'] = $this->auth->id; | 362 | $param['user_id'] = $this->auth->id; |
363 | $model = new StoreApply(); | 363 | $model = new StoreApply(); |
364 | $result = $model->add($param); | 364 | $result = $model->add($param); |
365 | + // 发送模板消息 | ||
366 | + $user = $this->auth->getUser(); | ||
367 | + $send_data = array( | ||
368 | + "first" => '您好,您有一个未处理的申请!', | ||
369 | + "keyword1" => $user['nickname'], | ||
370 | + "keyword2" => $user['mobile'], | ||
371 | + "keyword3" => date('Y年m月s日 H:i',time()), | ||
372 | + "remark" => '请尽快处理!', | ||
373 | + ); | ||
374 | + $url = 'http://community.t.brotop.cn/admininfo.php'; | ||
375 | + (new \app\common\controller\Api)->wxsendmessage('otlkQ0l4L3wsmz8dhDIbHJQVJnI8',$send_data,config('option.template')['examine'],$url); | ||
365 | Db::commit(); | 376 | Db::commit(); |
366 | } catch (PDOException $e) { | 377 | } catch (PDOException $e) { |
367 | Db::rollback(); | 378 | Db::rollback(); |
@@ -759,6 +770,17 @@ class Store extends Api | @@ -759,6 +770,17 @@ class Store extends Api | ||
759 | ); | 770 | ); |
760 | $res_log = Db::name('user_score_log')->insert($insert_data); | 771 | $res_log = Db::name('user_score_log')->insert($insert_data); |
761 | } | 772 | } |
773 | + // 发送模板消息 | ||
774 | + $user = $this->auth->getUser(); | ||
775 | + $send_data = array( | ||
776 | + "first" => '您好,您有一个未处理的申请!', | ||
777 | + "keyword1" => $user['nickname'], | ||
778 | + "keyword2" => $user['mobile'], | ||
779 | + "keyword3" => date('Y年m月s日 H:i',time()), | ||
780 | + "remark" => '请尽快处理!', | ||
781 | + ); | ||
782 | + $url = 'http://community.t.brotop.cn/admininfo.php'; | ||
783 | + (new \app\common\controller\Api)->wxsendmessage('otlkQ0l4L3wsmz8dhDIbHJQVJnI8',$send_data,config('option.template')['examine'],$url); | ||
762 | if(!$result || !$res_user || !$res_log) { | 784 | if(!$result || !$res_user || !$res_log) { |
763 | Db::rollback(); | 785 | Db::rollback(); |
764 | } else { | 786 | } else { |
@@ -333,18 +333,18 @@ class Api | @@ -333,18 +333,18 @@ class Api | ||
333 | */ | 333 | */ |
334 | public function wxsendmessage($open_id, $data, $templateId,$url) | 334 | public function wxsendmessage($open_id, $data, $templateId,$url) |
335 | { | 335 | { |
336 | -// if (empty($open_id) || empty($data) || empty($templateId)) { | ||
337 | -// return false; | ||
338 | -// } | ||
339 | -// $app = new Application(ConfigService::load()); | ||
340 | -// $notice = $app->notice; | ||
341 | -// $userId = $open_id; | ||
342 | -// $userService = $app->user; | ||
343 | -// $user = $userService->get($open_id); | ||
344 | -// // 判断是否关注公众号 | ||
345 | -// if($user->subscribe == 1) { | ||
346 | -// $notice->uses($templateId)->withUrl($url)->andData($data)->andReceiver($userId)->send(); | ||
347 | -// } | 336 | + if (empty($open_id) || empty($data) || empty($templateId)) { |
337 | + return false; | ||
338 | + } | ||
339 | + $app = new Application(ConfigService::load()); | ||
340 | + $notice = $app->notice; | ||
341 | + $userId = $open_id; | ||
342 | + $userService = $app->user; | ||
343 | + $user = $userService->get($open_id); | ||
344 | + // 判断是否关注公众号 | ||
345 | + if($user->subscribe == 1) { | ||
346 | + $notice->uses($templateId)->withUrl($url)->andData($data)->andReceiver($userId)->send(); | ||
347 | + } | ||
348 | return true; | 348 | return true; |
349 | } | 349 | } |
350 | } | 350 | } |
-
请 注册 或 登录 后发表评论