|
|
@@ -11,6 +11,10 @@ use bizHd\goods\services\CategoryService;
|
|
|
use bizHd\goods\services\GoodsCategoryService;
|
|
|
use bizHd\goods\services\GoodsSettingService;
|
|
|
use bizHd\pictext\classes\PicTextGoodsClass;
|
|
|
+use bizHd\wx\classes\WxOpenClass;
|
|
|
+use common\components\dict;
|
|
|
+use common\components\imgUtil;
|
|
|
+use common\components\miniUtil;
|
|
|
use common\components\printUtil;
|
|
|
use common\components\stringUtil;
|
|
|
use Yii;
|
|
|
@@ -170,6 +174,80 @@ class GoodsController extends BaseController
|
|
|
util::success($goods);
|
|
|
}
|
|
|
|
|
|
+ // 花束海报(散客扫码进 mall 小程序下单)ssh 20260602
|
|
|
+ public function actionGetPoster()
|
|
|
+ {
|
|
|
+ $get = Yii::$app->request->get();
|
|
|
+ $id = $get['id'] ?? 0;
|
|
|
+ $goods = GoodsClass::getById($id, true);
|
|
|
+ if (empty($goods)) {
|
|
|
+ util::fail('获取失败');
|
|
|
+ }
|
|
|
+ GoodsClass::valid($goods, $this->mainId);
|
|
|
+ $cover = $goods->cover ?? '';
|
|
|
+ if (empty($cover)) {
|
|
|
+ util::fail('请先上传花束封面');
|
|
|
+ }
|
|
|
+
|
|
|
+ $merchant = WxOpenClass::getMallWxInfo();
|
|
|
+ $page = 'pages/goods/detail';
|
|
|
+ $ptStyle = dict::getDict('ptStyle', 'mall');
|
|
|
+ $shop = $this->shop;
|
|
|
+ $shopId = $shop->id ?? 0;
|
|
|
+ $scene = 'id=' . $id . '&a=' . $shopId;
|
|
|
+ $envVersion = miniUtil::normalizeMiniEnvVersion(Yii::$app->request->get('env_version', 'release'));
|
|
|
+ $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');
|
|
|
+
|
|
|
+ $prefix = imgUtil::getPrefix();
|
|
|
+ $goodsInfo = GoodsClass::getGoodsInfo($id, $shop, $this->custom, []);
|
|
|
+ $priceType = $goodsInfo['priceType'] ?? 0;
|
|
|
+ if ($priceType == 1) {
|
|
|
+ $newPrice = '¥' . floatval($goodsInfo['price'] ?? 0);
|
|
|
+ } else {
|
|
|
+ $newPrice = '面议';
|
|
|
+ }
|
|
|
+ $priceBase64 = stringUtil::ossBase64($newPrice);
|
|
|
+
|
|
|
+ $name = $goods->name ?? '';
|
|
|
+ $nameBase64 = stringUtil::ossBase64($name);
|
|
|
+
|
|
|
+ $staff = $this->shopAdmin;
|
|
|
+ $staffName = $staff->name ?? '';
|
|
|
+ $newStaffName = $staffName . ' 为您推荐';
|
|
|
+ $staffNameBase64 = stringUtil::ossBase64($newStaffName);
|
|
|
+
|
|
|
+ $goodsCover = imgUtil::groupImg($cover) . '?x-oss-process=image/resize,m_fill,h_750,w_750';
|
|
|
+ $goodsCoverBase64 = stringUtil::ossBase64($goodsCover);
|
|
|
+
|
|
|
+ $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_' . $goodsCoverBase64 . ',g_nw,x_0,y_0';
|
|
|
+ $url .= '/watermark,image_' . $miniCodeBase64 . ',g_se';
|
|
|
+ if (!empty($logoBase64)) {
|
|
|
+ $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';
|
|
|
+
|
|
|
+ util::success(['imgUrl' => $url]);
|
|
|
+ }
|
|
|
+
|
|
|
//更新商品 ssh 2019.12.7
|
|
|
public function actionUpdate()
|
|
|
{
|