作者 lyh

变更数据

... ... @@ -40,6 +40,8 @@ class GeoConfirmLogic extends BaseLogic
public function saveConfirmContent($param)
{
try {
$wechat = $param['wechat'];
unset($param['wechat']);
$info = $this->model->read(['project_id' => $param['project_id'],'type' => $param['type']]);
if($info === false){
$id = $this->model->addReturnId($param);
... ... @@ -51,11 +53,11 @@ class GeoConfirmLogic extends BaseLogic
if (empty($friend)){
$this->fail('项目未绑定微信群, 推送消息失败!');
}
GeoConfirm::sendConfirmMessage($id, $friend->friend_id);
$data = GeoConfirm::sendConfirmMessage($id, $friend->friend_id,$wechat);
} catch (\Exception $e) {
$this->fail('操作失败, error:' . $e->getMessage());
}
return $this->success(['id'=>$id]);
return $this->success(['id'=>$id,'data'=>$data]);
}
/**
... ...
... ... @@ -106,7 +106,7 @@ class GeoConfirm extends Base
* @param $id
* @return bool
*/
public static function sendConfirmMessage($id, $friend_id)
public static function sendConfirmMessage($id, $friend_id,$send = true)
{
$data = self::where(compact('id'))->first();
$project_id = $data->project_id;
... ... @@ -127,13 +127,15 @@ class GeoConfirm extends Base
'url' => 'https://oa.quanqiusou.cn/public-geo-confirm?token=' . $token
];
$content = json_encode($content_array, JSON_UNESCAPED_UNICODE);
if($send == true){
$data->send_at = now();
$data->status = self::STATUS_RUNNING;
MessagePush::insert(compact('project_id', 'friend_id', 'type', 'content_type', 'content', 'send_time', 'updated_at', 'created_at'));
}
// 消息推送, 更新数据
$data->confirm = '';
$data->send_at = now();
$data->uniqid = $token;
$data->status = self::STATUS_RUNNING;
$data->save();
return $data;
return $content_array;
}
}
... ...