wang jun 2 rokov pred
rodič
commit
2b2740bc4b

+ 14 - 9
application/app/logic/webuserlogic.php

@@ -97,7 +97,7 @@ class webuserlogic extends baselogic
         //查未使用的验证码
         $m_s = new smscoderecordmodel();
         $where = ['telno' => $telno];
-        $list = $m_s->getList($where, 'smscode', 1, 0)->toArray();
+        $list = $m_s->getList($where, 'smscode', 1, 1)->toArray();
         if (empty($list)) {
             //发送短信
             //$code = randomStr();
@@ -114,10 +114,10 @@ class webuserlogic extends baselogic
             $code = $list[0]['smscode'];
         }
         //发送验证码
-        $sendresult = $this->sendsmscode($telno, $code);
+        /*$sendresult = $this->sendsmscode($telno, $code);
         if (!$sendresult['status']) {
-            return backarr(0, $sendresult['msg']);
-        }
+        return backarr(0, $sendresult['msg']);
+        }*/
         return backarr(1, "验证码发送成功");
     }
     /**
@@ -130,12 +130,17 @@ class webuserlogic extends baselogic
     private function sendsmscode($telno, $code)
     {
         $appdid = "1400598579";
-        $templateId = "1107863";
-        $SignName = '众惠科技';
-        $TemplateParamSet = [$code];
-        $PhoneNumberSet = [$telno];
+        $templateId = "1218744";
+        $SignName = '水猫工匠';
+        $array = array(
+            "PhoneNumberSet" => [$telno],
+            "SmsSdkAppId" => $appdid,
+            "TemplateId" => $templateId,
+            "TemplateParamSet" => [$code],
+            "SignName" => $SignName,
+        );
         $s_tc = new tencentcloudserver();
-        $result = $s_tc->sendsms($appdid, $SignName, $templateId, $TemplateParamSet, $PhoneNumberSet);
+        $result = $s_tc->sendsms($array);
         return $result;
     }
 

+ 1 - 1
application/common/model/payordermodel.php

@@ -102,7 +102,7 @@ class payordermodel extends Model
     public function updateinfobyid($id, $updateData)
     {
         $where = ['id' => $id];
-        $row = $this->where($where)->upate($updateData);
+        $row = $this->where($where)->update($updateData);
         return $row ? $row : false;
     }
 }

+ 5 - 21
application/common/server/tencentcloudserver.php

@@ -2,11 +2,9 @@
 namespace app\common\server;
 
 use TencentCloud\Common\Credential;
-// 导入要请求接口对应的Request类
 use TencentCloud\Common\Exception\TencentCloudSDKException;
 use TencentCloud\Common\Profile\ClientProfile;
 use TencentCloud\Common\Profile\HttpProfile;
-// 导入可选配置类
 use TencentCloud\Sms\V20210111\Models\SendSmsRequest;
 use TencentCloud\Sms\V20210111\SmsClient;
 
@@ -18,7 +16,7 @@ class tencentcloudserver
             "SecretId" => 'AKIDRhiSv84j8H9j25sOdbJq77rKWR6TZOwE',
             "SecretKey" => 'ziANIxLbbNt87pGQLzMSIr9AuObfWoth',
             'region' => 'ap-beijing',
-            'endpoint' => 'ocr.tencentcloudapi.com',
+            'endpoint' => 'sms.tencentcloudapi.com',
         ];
         return $config;
     }
@@ -34,33 +32,19 @@ class tencentcloudserver
      * @author wj
      * @date 2022-07-26
      */
-    public function sendsms($appid, $SignName, $TemplateId, $TemplateParamSet, $PhoneNumberSet)
+    public function sendsms($array)
     {
         try {
             $config = $this->getconfig();
             $cred = new Credential($config['SecretId'], $config['SecretKey']);
+            $this->cred = $cred;
             $httpProfile = new HttpProfile();
-            $httpProfile->setReqMethod("GET");
-            $httpProfile->setReqTimeout(30);
-            $httpProfile->setEndpoint($config['endpoint']); // 指定接入地域域名(默认就近接入)
+            $httpProfile->setEndpoint($config['endpoint']);
             $clientProfile = new ClientProfile();
-            $clientProfile->setSignMethod("TC3-HMAC-SHA256"); // 指定签名算法(默认为HmacSHA256)
             $clientProfile->setHttpProfile($httpProfile);
             $client = new SmsClient($cred, $config['region'], $clientProfile);
             $req = new SendSmsRequest();
-            $req->SmsSdkAppId = $appid;
-            $req->SignName = $SignName;
-            $req->TemplateId = $TemplateId;
-            $req->TemplateParamSet = $TemplateParamSet;
-            /* 下发手机号码,采用 E.164 标准,+[国家或地区码][手机号]
-             * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号*/
-            $req->PhoneNumberSet = $PhoneNumberSet;
-            /* 用户的 session 内容(无需要可忽略): 可以携带用户侧 ID 等上下文信息,server 会原样返回 */
-            //$req->SessionContext = "";
-            /* 短信码号扩展号(无需要可忽略): 默认未开通,如需开通请联系 [腾讯云短信小助手] */
-            //$req->ExtendCode = "";
-            /* 国际/港澳台短信 SenderId(无需要可忽略): 国内短信填空,默认未开通,如需开通请联系 [腾讯云短信小助手] */
-            //$req->SenderId = "";
+            $req->fromJsonString(json_encode($array));
             $resp = $client->SendSms($req);
             $respArray = $resp->serialize();
             $respArray = $respArray['SendStatusSet'][0];

+ 1 - 3
application/index/controller/Appointment.php

@@ -12,7 +12,7 @@ use app\index\logic\appointmentlogic;
 use app\index\logic\paylogic;
 use app\index\logic\wechatlogic;
 use think\Controller;
-use think\Log;
+use think\facade\Log;
 
 class Appointment extends Base
 {
@@ -84,8 +84,6 @@ class Appointment extends Base
      */
     public function pay_call_back()
     {
-        $headerinfo = request()->instance()->header();
-        log::info($headerinfo);
         $reurnData = [
             "return_code" => "SUCCESS",
             "return_msg" => "OK",

+ 5 - 5
application/index/logic/paylogic.php

@@ -4,7 +4,7 @@ namespace app\index\logic;
 use app\common\model\appointmentmodel;
 use app\common\model\payordermodel;
 use think\Db;
-use think\Log;
+use think\facade\Log;
 
 /**
  * 支付
@@ -128,18 +128,18 @@ class paylogic extends baselogic
                 case 1:
                     $appointentid = $orderInfo['appointent_id'];
                     $m_a = new appointmentmodel();
-                    $ainfo = $m_a->getInfo(['id' => $appointentid, 'is_pay' => 0]);
+                    $ainfo = $m_a->getInfo(['id' => $appointentid, 'ispay' => 0]);
                     if (empty($ainfo)) {
                         $msg = "申请单id:[" . $appointentid . "]不存在";
                         throw new \Exception($msg);
                     }
-                    $code = $outorderno . "|" . date("YmdHis");
+                    $code = $appointentid . "|" . date("YmdHis");
                     $aupdateData = [
-                        'is_pay' => 1,
+                        'ispay' => 1,
                         'payorderno' => $outorderno,
                         'code' => $code,
                     ];
-                    $row = $ainfo->update(['id' => $appointentid], $aupdateData);
+                    $row = $ainfo->updateinfo(['id' => $appointentid], $aupdateData);
                     if (empty($row)) {
                         $msg = "申请单id:[" . $appointentid . "]修改失败";
                         throw new \Exception($msg);