作者 lyh

变更数据

@@ -40,6 +40,8 @@ class GeoConfirmLogic extends BaseLogic @@ -40,6 +40,8 @@ class GeoConfirmLogic extends BaseLogic
40 public function saveConfirmContent($param) 40 public function saveConfirmContent($param)
41 { 41 {
42 try { 42 try {
  43 + $wechat = $param['wechat'];
  44 + unset($param['wechat']);
43 $info = $this->model->read(['project_id' => $param['project_id'],'type' => $param['type']]); 45 $info = $this->model->read(['project_id' => $param['project_id'],'type' => $param['type']]);
44 if($info === false){ 46 if($info === false){
45 $id = $this->model->addReturnId($param); 47 $id = $this->model->addReturnId($param);
@@ -51,11 +53,11 @@ class GeoConfirmLogic extends BaseLogic @@ -51,11 +53,11 @@ class GeoConfirmLogic extends BaseLogic
51 if (empty($friend)){ 53 if (empty($friend)){
52 $this->fail('项目未绑定微信群, 推送消息失败!'); 54 $this->fail('项目未绑定微信群, 推送消息失败!');
53 } 55 }
54 - GeoConfirm::sendConfirmMessage($id, $friend->friend_id); 56 + $data = GeoConfirm::sendConfirmMessage($id, $friend->friend_id,$wechat);
55 } catch (\Exception $e) { 57 } catch (\Exception $e) {
56 $this->fail('操作失败, error:' . $e->getMessage()); 58 $this->fail('操作失败, error:' . $e->getMessage());
57 } 59 }
58 - return $this->success(['id'=>$id]); 60 + return $this->success(['id'=>$id,'data'=>$data]);
59 } 61 }
60 62
61 /** 63 /**
@@ -106,7 +106,7 @@ class GeoConfirm extends Base @@ -106,7 +106,7 @@ class GeoConfirm extends Base
106 * @param $id 106 * @param $id
107 * @return bool 107 * @return bool
108 */ 108 */
109 - public static function sendConfirmMessage($id, $friend_id) 109 + public static function sendConfirmMessage($id, $friend_id,$send = true)
110 { 110 {
111 $data = self::where(compact('id'))->first(); 111 $data = self::where(compact('id'))->first();
112 $project_id = $data->project_id; 112 $project_id = $data->project_id;
@@ -127,13 +127,15 @@ class GeoConfirm extends Base @@ -127,13 +127,15 @@ class GeoConfirm extends Base
127 'url' => 'https://oa.quanqiusou.cn/public-geo-confirm?token=' . $token 127 'url' => 'https://oa.quanqiusou.cn/public-geo-confirm?token=' . $token
128 ]; 128 ];
129 $content = json_encode($content_array, JSON_UNESCAPED_UNICODE); 129 $content = json_encode($content_array, JSON_UNESCAPED_UNICODE);
  130 + if($send == true){
  131 + $data->send_at = now();
  132 + $data->status = self::STATUS_RUNNING;
130 MessagePush::insert(compact('project_id', 'friend_id', 'type', 'content_type', 'content', 'send_time', 'updated_at', 'created_at')); 133 MessagePush::insert(compact('project_id', 'friend_id', 'type', 'content_type', 'content', 'send_time', 'updated_at', 'created_at'));
  134 + }
131 // 消息推送, 更新数据 135 // 消息推送, 更新数据
132 $data->confirm = ''; 136 $data->confirm = '';
133 - $data->send_at = now();  
134 $data->uniqid = $token; 137 $data->uniqid = $token;
135 - $data->status = self::STATUS_RUNNING;  
136 $data->save(); 138 $data->save();
137 - return $data; 139 + return $content_array;
138 } 140 }
139 } 141 }