作者 xwp
1 个管道 的构建 通过 耗费 1 秒

推送调试

... ... @@ -545,14 +545,10 @@ class Course extends Api
//开课人数够了
$sign = new \app\admin\model\CourseSign();
$signCount = $sign->where(['course_store_id'=>$course_store_id])->count();
echo '提醒人数:'.$courseStore['notify_count'];
echo '已报名人数:'.$signCount;
if($signCount >= $courseStore['notify_count']){
echo '开始推送环节';
$template = new Newtmpl(Config::get('weChat'));
$sign = new \app\admin\model\CourseSign();
$sign_data = $sign->with(['user','CourseStore'])->where(['course_store_id'=>$course_store_id,'notify'=>false])->select();
echo '推送人数组:'.json_encode($sign_data);
$notice = new \app\admin\model\UserNotice();
foreach ($sign_data as $k){
... ... @@ -570,7 +566,7 @@ class Course extends Api
//小程序通知
$data = [
'touser' => $k['user']['openid'],
'template_id' => Config::get('course_sign_tmp'),
'template_id' => config('weChat.course_sign_tmp'),
'form_id'=>$k['id'],
'page'=>'pages/classReserve/classReserve',
'data'=>[
... ... @@ -585,7 +581,6 @@ class Course extends Api
echo '微信请求:'.json_encode($data);
try {
echo '进入try:';
$return = $template->send($data);
echo json_encode($return);exit;
} catch (InvalidResponseException $e) {
... ...
... ... @@ -61,6 +61,7 @@ class Events
//订单到期
$timer = 60*1;
Timer::add($timer, function ($config){
$config = config('weChat');
error_log('order_over');
$template = new Newtmpl($config);
$order = new \app\admin\model\Order();
... ... @@ -99,7 +100,7 @@ class Events
//开课提醒
$timer = 60*1;
Timer::add($timer, function ($config){
$config = config('weChat');
error_log('course_start');
$template = new Newtmpl($config);
... ...