|
@@ -11,6 +11,7 @@ use bizHd\wx\classes\WxOpenClass;
|
|
|
use common\components\dict;
|
|
use common\components\dict;
|
|
|
use common\components\imgUtil;
|
|
use common\components\imgUtil;
|
|
|
use common\components\miniUtil;
|
|
use common\components\miniUtil;
|
|
|
|
|
+use common\components\PosterUtil;
|
|
|
use common\components\stringUtil;
|
|
use common\components\stringUtil;
|
|
|
use common\components\util;
|
|
use common\components\util;
|
|
|
use Yii;
|
|
use Yii;
|
|
@@ -283,6 +284,7 @@ class ItemController extends BaseController
|
|
|
if (empty($cover)) {
|
|
if (empty($cover)) {
|
|
|
util::fail('获取失败');
|
|
util::fail('获取失败');
|
|
|
}
|
|
}
|
|
|
|
|
+ $cover = imgUtil::normalizeOssObjectPath($cover);
|
|
|
|
|
|
|
|
$merchant = WxOpenClass::getMallWxInfo();
|
|
$merchant = WxOpenClass::getMallWxInfo();
|
|
|
$page = 'pages/item/detail';
|
|
$page = 'pages/item/detail';
|
|
@@ -293,8 +295,6 @@ class ItemController extends BaseController
|
|
|
$scene = "id=" . $id . '&a=' . $shopId;
|
|
$scene = "id=" . $id . '&a=' . $shopId;
|
|
|
$envVersion = miniUtil::normalizeMiniEnvVersion(Yii::$app->request->get('env_version', 'release'));
|
|
$envVersion = miniUtil::normalizeMiniEnvVersion(Yii::$app->request->get('env_version', 'release'));
|
|
|
$miniCode = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle, $envVersion);
|
|
$miniCode = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle, $envVersion);
|
|
|
- $miniCode = $miniCode . '?x-oss-process=image/resize,m_fill,h_200,w_200';
|
|
|
|
|
- $miniCodeBase64 = stringUtil::ossBase64($miniCode);
|
|
|
|
|
|
|
|
|
|
Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'hd');
|
|
Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'hd');
|
|
|
|
|
|
|
@@ -305,51 +305,19 @@ class ItemController extends BaseController
|
|
|
$addPriceMap = \bizGhs\custom\classes\CustomClass::$levelAddPriceKeyMap;
|
|
$addPriceMap = \bizGhs\custom\classes\CustomClass::$levelAddPriceKeyMap;
|
|
|
$price = \bizGhs\product\classes\ProductClass::getFinalPrice($item, $level, $priceMap, $addPriceMap);
|
|
$price = \bizGhs\product\classes\ProductClass::getFinalPrice($item, $level, $priceMap, $addPriceMap);
|
|
|
|
|
|
|
|
- $newPrice = '¥' . floatval($price);
|
|
|
|
|
- $priceBase64 = stringUtil::ossBase64($newPrice);
|
|
|
|
|
-
|
|
|
|
|
- $name = $item->name ?? '';
|
|
|
|
|
- $nameBase64 = stringUtil::ossBase64($name);
|
|
|
|
|
-
|
|
|
|
|
$staff = $this->shopAdmin;
|
|
$staff = $this->shopAdmin;
|
|
|
$staffName = $staff->name ?? '';
|
|
$staffName = $staff->name ?? '';
|
|
|
- $newStaffName = $staffName . ' 为您推荐';
|
|
|
|
|
- $staffNameBase64 = stringUtil::ossBase64($newStaffName);
|
|
|
|
|
-
|
|
|
|
|
- //花材主图
|
|
|
|
|
- $itemCover = $cover . '?x-oss-process=image/resize,m_fill,h_750,w_750';
|
|
|
|
|
- $itemCoverBase64 = stringUtil::ossBase64($itemCover);
|
|
|
|
|
-
|
|
|
|
|
- $logoBase64 = '';
|
|
|
|
|
- if (in_array($this->mainId, [52, 1459, 13495])) {
|
|
|
|
|
- $logo = 'poster/hyxh_ncd_logo.png?x-oss-process=image/resize,m_fill,h_90,w_90';
|
|
|
|
|
- if ($this->mainId == 1459) {
|
|
|
|
|
- $logo = 'poster/hyxh_gcd_logo.png?x-oss-process=image/resize,m_fill,h_90,w_90';
|
|
|
|
|
- }
|
|
|
|
|
- if ($this->mainId == 13495) {
|
|
|
|
|
- $logo = 'poster/hyxh_hzd_logo.png?x-oss-process=image/resize,m_fill,h_90,w_90';
|
|
|
|
|
- }
|
|
|
|
|
- $logoBase64 = stringUtil::ossBase64($logo);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $url = $prefix . 'poster/1234.jpg?x-oss-process=image';
|
|
|
|
|
- //花材主图
|
|
|
|
|
- $url .= '/watermark,image_' . $itemCoverBase64 . ',g_nw,x_0,y_0';
|
|
|
|
|
- //小程序码
|
|
|
|
|
- $url .= '/watermark,image_' . $miniCodeBase64 . ',g_se';
|
|
|
|
|
- if (!empty($logoBase64)) {
|
|
|
|
|
- //logo
|
|
|
|
|
- $url .= '/watermark,image_' . $logoBase64 . ',g_se,x_65,y_65';
|
|
|
|
|
- }
|
|
|
|
|
- //为你推荐
|
|
|
|
|
- $url .= '/watermark,text_' . $staffNameBase64 . ',g_sw,x_18,y_235,color_8B8989,type_d3F5LW1pY3JvaGVp,size_30';
|
|
|
|
|
- //标题
|
|
|
|
|
- $url .= '/watermark,text_' . $nameBase64 . ',g_sw,x_18,y_145';
|
|
|
|
|
- //价格
|
|
|
|
|
- $url .= '/watermark,text_' . $priceBase64 . ',g_sw,x_18,y_50,color_EE2C2C,type_d3F5LW1pY3JvaGVp,size_50';
|
|
|
|
|
-
|
|
|
|
|
- $respond = ['imgUrl' => $url];
|
|
|
|
|
- util::success($respond);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $url = PosterUtil::buildMallItemPosterUrl($prefix, [
|
|
|
|
|
+ 'cover' => $cover,
|
|
|
|
|
+ 'miniCode' => $miniCode,
|
|
|
|
|
+ 'priceText' => '¥' . floatval($price),
|
|
|
|
|
+ 'name' => $item->name ?? '',
|
|
|
|
|
+ 'staffText' => $staffName . ' 为您推荐',
|
|
|
|
|
+ 'mainId' => $this->mainId,
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ util::success(['imgUrl' => $url]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//获取花材描述
|
|
//获取花材描述
|