You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.8 KiB

<?php
namespace app\fire\logic;
use app\base\model\mpweixin\MpweixinUser;
use app\base\model\user\User;
use app\project\model\ProjectConfig;
use EasyWeChat\Factory;
class Notice extends Base
{
public function notice($template_data)
{
$weixin_param = get_weixin_config();
//EasyWeChat配置
$config = [
'app_id' => $weixin_param['app_id'],
'secret' => $weixin_param['app_secret'],
];
$app = Factory::officialAccount($config);
$res = $app->template_message->send($template_data);
platformLog($template_data, $res, 'template_data');
}
/**
* 审核通知
* @param $user_id
* @param $type
* @param $status
*/
public function examineNotice($user_id,$type,$status)
{
$notice_logic = new Notice();
$user_model = new MpweixinUser();
$user_openid = $user_model->getUserWechatOpenid($user_id);
if($user_openid)
{
$first = '你的专家入驻申请已被平台审核';
if($type == 2)
{
$first = '你的供应商入驻申请已被平台审核';
}
$keyword2 = '审核通过';
if($status == 3)
{
$keyword2 = '审核拒绝';
}
$template_data = [
'touser' => $user_openid,
'template_id' => 'ZirARhWHWtL0CiV7opBWg1A1S9AqFTT6_k3hus--scg',
'data' => [
'first' => $first,
'keyword1' => date('Y-m-d H:i',time()),
'keyword2' => $keyword2,
'remark' => '进入小程序查看~',
],
];
$notice_logic->notice($template_data);
}
}
}