WIN-2308041133\Administrator 4 months ago
parent
commit
228cf865b0
1 changed files with 9 additions and 2 deletions
  1. 9 2
      crmeb/services/WechatTemplateService.php

+ 9 - 2
crmeb/services/WechatTemplateService.php

@@ -83,9 +83,16 @@ class WechatTemplateService implements ProviderInterface
     {
         @file_put_contents('quanju.txt',  $templateId."-模版id\r\n", 8);
         $tempid = WechatTemplateModel::vialdWhere()->where('tempkey', $templateId)->where('status', 1)->value('tempid');
-        @file_put_contents('quanju.txt',  json_encode($tempid)."-tempid\r\n", 8);
+        @file_put_contents('quanju.txt',  $tempid."-tempid\r\n", 8);
         @file_put_contents('quanju.txt',  WechatTemplateModel::getlastSql()."-tempid\r\n", 8);
-        if (!$tempid) return false;
+        if (!$tempid){
+            $tempid = WechatTemplateModel::where('tempkey', $templateId)->where('status', 1)->value('tempid');
+            @file_put_contents('quanju.txt',  $tempid."-tempid2\r\n", 8);
+            @file_put_contents('quanju.txt',  WechatTemplateModel::getlastSql()."-tempid2\r\n", 8);
+            if (!$tempid){
+                return false;
+            }
+        }
         try {
                 $res=WechatService::sendTemplate($openid, $tempid, $data, $url, $defaultColor);
             return $res;