...
|
...
|
@@ -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) {
|
...
|
...
|
|