示例#1
0
 /**
  * @return string
  * @param $channelId, string, channel ID
  */
 public static function getAttentionQrcode($channelId)
 {
     $imageUrl = $qrcodeId = '';
     $channelInfo = Channel::getEnableByChannelId($channelId);
     if (empty($channelInfo['qrcodeId'])) {
         $qrcodeId = Channel::createAttentionQrcode($channelId);
         if (!empty($qrcodeId)) {
             Channel::updateAll(['qrcodeId' => $qrcodeId], ['channelId' => $channelId]);
         }
     } else {
         $qrcodeId = $channelInfo['qrcodeId'];
     }
     if (!empty($qrcodeId)) {
         $qrcodeInfo = Yii::$app->weConnect->getQrcode($channelId, $qrcodeId);
         $imageUrl = $qrcodeInfo['imageUrl'];
     }
     return $imageUrl;
 }