예제 #1
0
 public function afterSave($insert, $changedAttributes)
 {
     // \Yii::warning('yjhu:'.__METHOD__);
     // \Yii::warning(\yii\helpers\Json::encode($this));
     if (1 == $this->receiver_type) {
         $wechat = \Yii::$app->user->getWechat();
         //   \Yii::warning(\yii\helpers\Json::encode($wechat));
         $articles = [['title' => $this->title, 'description' => $this->digest, 'url' => \yii\helpers\Url::to(['wapx/messageboxdetail', 'msg_id' => $this->msg_id], true), 'picurl' => self::PICURL]];
         $receivers = MUser::getValidRecvFans($this->receiver);
         // \Yii::warning(\yii\helpers\Json::encode($receivers));
         foreach ($receivers as $recvr) {
             //                $wechat->WxMessageCustomSendNews($recvr->openid, $articles);
             $ret = $wechat->WxMessageCustomSendNews(MGh::GH_XIANGYANGUNICOM_OPENID_KZENG, $articles);
             //  \Yii::warning(\yii\helpers\Json::encode($ret));
         }
     }
     parent::afterSave($insert, $changedAttributes);
 }