merchantId); return $this->render('index', ['admin' => $admin, 'shop' => $this->merchant, 'shopAsset' => $this->merchantAsset, 'shopExtend' => $this->merchantExtend]); } public function actionGatheringUrl() { $wifiQrImg = '/qrcode/weixinQrcode/' . $shopId . '.jpg'; $unique = configDict::getQrKey('gathering') . $this->merchantId; $gatheringQrcodeUrl = $this->merchant['gatheringQrcodeUrl']; $webRoot = Yii::getAlias('@webroot') . '/../../resource/images'; $shop = xhShop::find()->where(['merchantId'=>$this->merchantId])->one(); if(empty($shop)){ throw new \Exception('没有门店信息'); } $shopId = $shop->id; //合并后图片 $mergeGatheringQrcodeUrl = $this->merchantExtend['mergeGatheringQrcodeUrl']; $mergeGatheringQrcodeUrlAlipay = $this->merchantExtend['mergeGatheringQrcodeUrlAlipay']; if (!empty($mergeGatheringQrcodeUrl)) { //有合并后的图片,则拼接完整地址 $mergeGatheringQrcodeUrl = Yii::$app->params['imgUrl'] . $mergeGatheringQrcodeUrl; $mergeGatheringQrcodeUrlAlipay = Yii::$app->params['imgUrl'] . $mergeGatheringQrcodeUrlAlipay; } if (empty($gatheringQrcodeUrl) || file_exists($webRoot . $gatheringQrcodeUrl) == false) { $url = Yii::$app->params['frontUrl'] . '/pay/index?account=' . $this->merchant['id'] .'&shopId='.$shopId; $logo = !empty($this->merchant['logo']) ? $webRoot . $this->merchant['logo'] : ''; $gatheringQrcodeUrl = qrCodeUtil::generate($url, $unique, $logo, 10); xhMerchantService::updateById($this->merchantId, ['gatheringQrcodeUrl' => $gatheringQrcodeUrl]); } $admin = xhAdminToMerchantService::getAdminByMerchantId($this->merchantId); return $this->render('gatheringUrl', [ 'admin' => $admin, 'qrCodeUrl' => $gatheringQrcodeUrl, 'mergeQrCodeUrl' => $mergeGatheringQrcodeUrl, 'mergeQrCodeUrlAlipay' => $mergeGatheringQrcodeUrlAlipay, 'shopId' => $shopId, 'url' => $url, ]); } //lqh 合并微信支付图片 2017-05-05 public function actionMergeWxImg() { /*$gatheringQrcodeUrl = $this->merchant['gatheringQrcodeUrl']; $webRoot = Yii::getAlias('@webroot') . '/../../../resource/images/'; $gatheringQrcodeUrl = $webRoot.$gatheringQrcodeUrl; //完整地址二维码 $background_img = Yii::getAlias('@webroot').'/images/merchant/wxPay.png'; //微信背景图 $background_img_alipay = Yii::getAlias('@webroot').'/images/merchant/alipay.png'; //支付宝背景图 //图片格式必须是png $merge_img_wx = util::mergeImg($background_img, $gatheringQrcodeUrl); $merge_img_alipay = util::mergeImg($background_img_alipay, $gatheringQrcodeUrl,'alipay'); //保存到商户扩展表中 $data['mergeGatheringQrcodeUrl'] = $merge_img_wx; $data['mergeGatheringQrcodeUrlAlipay'] = $merge_img_alipay; xhMerchantExtendService::updateByMerchantId($this->merchantId,$data);*/ $shopId = Yii::$app->request->post('shopId'); $saveQrCodeDir = dirname(Yii::$app->basePath) . '/images/qrcode/weixinQrcode/'; $wifiQrImg = $saveQrCodeDir . $shopId . '.jpg'; $gatheringQrcodeUrl = $this->merchant['gatheringQrcodeUrl']; $webRoot = Yii::getAlias('@webroot') . '/../../images/'; $gatheringQrcodeUrl = $webRoot . $gatheringQrcodeUrl; //完整地址二维码 $backgroundImg = Yii::getAlias('@webroot') . '/images/merchant/full.jpg'; //背景图 $qrImg = [ 'zhifubao' => $gatheringQrcodeUrl, 'weixin' => $gatheringQrcodeUrl, 'wifi' => $wifiQrImg, ]; $fullMergeImg = util::mergeQrimg($backgroundImg, $qrImg); $data['mergeGatheringQrcodeUrl'] = $fullMergeImg; xhMerchantExtendService::updateByMerchantId($this->merchantId, $data); util::successInfo(); } public function actionMergeImgDemo() { $gatheringQrcodeUrl = $this->merchant['gatheringQrcodeUrl']; $webRoot = Yii::getAlias('@webroot') . '/../../images/'; $gatheringQrcodeUrl = $webRoot . $gatheringQrcodeUrl; //完整地址二维码 $bcgImg = Yii::getAlias('@webroot') . '/images/merchant/full.jpg'; //背景图 $qrImg = [ 'zhifubao' => $gatheringQrcodeUrl, 'weixin' => $gatheringQrcodeUrl, 'wifi' => '', ]; util::mergeQrimg($bcgImg, $qrImg); } /** * 上传店长微信二维码 */ public function actionDownloadAdminWxQrCode() { $get = Yii::$app->request->get(); $mediaId = isset($get['mediaId']) ? $get['mediaId'] : ''; $openMerchant = xhWxOpenService::getMerchant(); $imgList = weixinUtil::downloadmediaIdImg($openMerchant, $mediaId, 'wxAdminImg'); if (!empty($imgList)) { $img = $imgList['large']; $data = ['wxQrCode' => $img]; $admin = xhAdminToMerchantService::getAdminByMerchantId($this->merchantId); $adminId = $admin['id']; xhAdminService::updateById($adminId, $data); util::successInfo('上传成功', 'A0001', $imgList); } util::failInfo(); } }