Browse Source

积分guoqi

Cherry 2 years ago
parent
commit
db7efdd743
2 changed files with 41 additions and 7 deletions
  1. 40 7
      application/api/controller/Chuyutimedtask.php
  2. 1 0
      application/extra/site.php

+ 40 - 7
application/api/controller/Chuyutimedtask.php

@@ -172,12 +172,11 @@ class Chuyutimedtask extends Api
 //                $ids[] = $row['id'];
 //            }
 
-
+            //SMS_262525727、亲爱的“餐厨宝”会员,您的${name}账单已发送至您的微信小程序支付界面,请您尽快前往确认并支付,感谢您的支持!
             $TemplateCode = "SMS_262525727";
             foreach ($recovery_bill as $k => $row) {
                 $phoneNumber = $row['mobile'];
-                $code = "786324";
-                $TemplateParam = json_encode(['code' => $code]);
+                $TemplateParam = json_encode(['name' => $row['order_no']]);
                 $is_success = $this->SmsTemplate($TemplateCode, $phoneNumber, $TemplateParam);
 
                 if ($is_success) {
@@ -221,11 +220,10 @@ class Chuyutimedtask extends Api
 //            $template = 1;
 //            $ret = Smslib::notice($mobiles, $msg, $template);
 
-            $TemplateCode = "SMS_250740130";
+            $TemplateCode = "SMS_262525727";
             foreach ($tableware_bill as $k => $row) {
                 $phoneNumber = $row['mobile'];
-                $code = "786324";
-                $TemplateParam = json_encode(['code' => $code]);
+                $TemplateParam = json_encode(['name' => $row['order_no']]);
                 $is_success = $this->SmsTemplate($TemplateCode, $phoneNumber, $TemplateParam);
 
                 if ($is_success) {
@@ -244,7 +242,6 @@ class Chuyutimedtask extends Api
                 echo(__('发送成功'));
             }
         }
-
     }
 
 
@@ -308,4 +305,40 @@ class Chuyutimedtask extends Api
 
         $this->success('ok');
     }
+
+    /**
+     * 积分过期提醒
+     */
+    public function ScoreOverdue()
+    {
+        $score_overdue_date = config('site.score_overdue_date');
+        if (empty($score_overdue_date)) {
+            $this->success('score_overdue_date is null!');
+        }
+        $score_overdue_int = strtotime($score_overdue_date); // 函数将日期转换为时间戳;
+        $overdue_date = date('m-d', $score_overdue_int);
+        // today
+        $now_date = date('m-d', time());
+
+        if ($overdue_date != $now_date) {
+            $this->success('not overdue date!');
+        }
+
+        $user_model = new User();
+        $users = $user_model->field('id,score,mobile')->where('score', '>', 0)->select();
+
+        if (count($users) == 0) {
+            $this->success('无操作数据');
+        }
+
+        // SMS_262585705、亲爱的会员,您的账户剩余${number}积分快到期了,您可以进入“餐厨宝”商城使用您的积分,感谢您的支持!
+        $TemplateCode = "SMS_262585705";
+        foreach ($users as $v) {
+            $phoneNumber = $v['mobile'];
+            $TemplateParam = json_encode(['number' => $v['score']]);
+            $this->SmsTemplate($TemplateCode, $phoneNumber, $TemplateParam);
+        }
+
+        $this->success('ok');
+    }
 }

+ 1 - 0
application/extra/site.php

@@ -58,4 +58,5 @@ return array (
   'sms_signName' => '乐山餐厨宝',
   'sms_regionId' => 'cn-hangzhou',
   'score_clear_date' => '2023-01-27',
+  'score_overdue_date' => '2022-12-08',
 );