作者 刘朕
1 个管道 的构建 通过 耗费 0 秒

合并分支 'liuzhen' 到 'master'

Liuzhen



查看合并请求 !105
... ... @@ -479,11 +479,12 @@ class Hot extends Api
$send_data = array(
"first" => '您有一条新的消息',
'keyword1' => $param['content'] ? $param['content'] : '【图片消息】',
"keyword" => date('Y-m-s H:i:s',time()),
"keyword2" => date('Y-m-s H:i:s',time()),
"remark" => '',
);
$openid = Db::name('third')->where('user_id',$this->auth->id)->value('openid');
$this->wxsendmessage($openid,$send_data,config('option.template')['msg']);
$openid = Db::name('third')->where('user_id',$store['user_id'])->value('openid');
$url = config('option.vue_url') . '/index/order/index.html';
$this->wxsendmessage($openid,$send_data,config('option.template')['msg'],$url);
Db::commit();
} catch (PDOException $e) {
Db::rollback();
... ...
... ... @@ -1231,14 +1231,15 @@ class Store extends Api
];
$res_msg = $msg_model->edit($update);
// 发送模板消息
// $send_data = array(
// "first" => '',
// 'keyword1' => '',
// "keyword2" => '',
// "keyword3" => date('Y-m-s',time()),
// "remark" => '',
// );
// $this->wxsendmessage('','','');
$send_data = array(
"first" => '您有一条新的消息',
'keyword1' => $param['content'] ? $param['content'] : '【图片消息】',
"keyword2" => date('Y-m-s H:i:s',time()),
"remark" => '',
);
$openid = Db::name('third')->where('user_id',$msg['user_id'])->value('openid');
$url = config('option.vue_url') . '/index/order/index.html';
$this->wxsendmessage($openid,$send_data,config('option.template')['msg'],$url);
Db::commit();
} catch (PDOException $e) {
Db::rollback();
... ...
... ... @@ -328,9 +328,10 @@ class Api
* @param string $open_id 用户openid
* @param array $data 模板消息内容
* @param string $templateId 模板消息id
* @param string $templateId 模板消息id
* @return bool
*/
public function wxsendmessage($open_id, $data, $templateId)
public function wxsendmessage($open_id, $data, $templateId,$url)
{
if (empty($open_id) || empty($data) || empty($templateId)) {
return false;
... ... @@ -338,8 +339,12 @@ class Api
$app = new Application(ConfigService::load());
$notice = $app->notice;
$userId = $open_id;
$url = config('option.vue_url').'/index/order/index.html';
$notice->uses($templateId)->withUrl($url)->andData($data)->andReceiver($userId)->send();
$userService = $app->user;
$user = $userService->get($open_id);
// 判断是否关注公众号
if($user->subscribe == 1) {
$notice->uses($templateId)->withUrl($url)->andData($data)->andReceiver($userId)->send();
}
return true;
}
}
... ...