shish hace 5 años
padre
commit
df179d6f66
Se han modificado 1 ficheros con 4 adiciones y 9 borrados
  1. 4 9
      app-pt/controllers/WxController.php

+ 4 - 9
app-pt/controllers/WxController.php

@@ -88,7 +88,8 @@ class WxController extends PublicController
             Yii::$app->end();
         }
         $postObj = simplexml_load_string($msg, 'SimpleXMLElement', LIBXML_NOCDATA);
-        $this->fromUsername = $postObj->FromUserName; // 发送方账号 openId
+        //巨坑,要转string才行
+        $this->fromUsername = (string)$postObj->FromUserName; // 发送方账号 openId
         $this->toUsername = $postObj->ToUserName; // 开发者微信账号
         $times = $postObj->CreateTime; // 消息创建时间
         $Location_X = $postObj->Location_X; // 地理位置纬度(用户主动发送)
@@ -123,11 +124,7 @@ class WxController extends PublicController
                         $pc = new \WXBizMsgCrypt($openToken, $encodingAesKey, $openAppId);
                         $encryptMsg = '';
                         $pc->encryptMsg($text, $timestamp, $nonce, $encryptMsg);//加密
-                        //echo $encryptMsg;
-                        $r = wxUtil::sendMsg('111111', $merchant, (string)$this->fromUsername, 1);
-                        Yii::info('657'.' '.$this->fromUsername.' '.json_encode($r));
-                        Yii::info(json_encode($merchant));
-                        Yii::info(json_encode($getUserInfo));
+                        echo $encryptMsg;
                         break;
                     //取消关注
                     case 'unsubscribe':
@@ -143,9 +140,7 @@ class WxController extends PublicController
                 Yii::info('1243 '.$this->fromUsername.' '.json_encode($merchant));
                 if ($postObj->PagePath == 'pagesClient/official/warn') {
                     $content = '好的好的';
-                    $r = wxUtil::sendMiniMsg($content, $merchant, $this->fromUsername, 1);
-                    Yii::info(123);
-                    Yii::info(json_encode($r));
+                    wxUtil::sendMiniMsg($content, $merchant, $this->fromUsername, 1);
                 }
             }
         } elseif ($style == dict::getDict('ptStyle', 'ghs')) {