|
|
@@ -27,6 +27,35 @@ class MainController extends BaseController
|
|
|
|
|
|
public $guestAccess = ['index', 'my'];
|
|
|
|
|
|
+ //获取商城的短链接 ssh 20250826
|
|
|
+ public function actionGetShortUrl()
|
|
|
+ {
|
|
|
+ $shopId = $this->shopId;
|
|
|
+ $merchant = WxOpenClass::getMallWxInfo();
|
|
|
+ $ptStyle = dict::getDict('ptStyle', 'mall');
|
|
|
+
|
|
|
+ $goodsShortUrl = 'wx_mini_goods_short_url';
|
|
|
+ $itemShortUrl = 'wx_mini_item_short_url';
|
|
|
+ $imageShortUrl = 'wx_mini_image_short_url';
|
|
|
+
|
|
|
+ $goodsUrl = Yii::$app->redis->executeCommand('GET', [$goodsShortUrl]);
|
|
|
+ $imgUrl = Yii::$app->redis->executeCommand('GET', [$itemShortUrl]);
|
|
|
+ $itemUrl = Yii::$app->redis->executeCommand('GET', [$imageShortUrl]);
|
|
|
+
|
|
|
+ if (empty($goodsUrl) || empty($imgUrl) || empty($itemUrl)) {
|
|
|
+ $goods = miniUtil::generateShortLink($merchant, 'pages/home/category?account=' . $shopId, '', $ptStyle);
|
|
|
+ $image = miniUtil::generateShortLink($merchant, 'pages/home/mall?account=' . $shopId, '', $ptStyle);
|
|
|
+ $item = miniUtil::generateShortLink($merchant, 'pages/item/item?account=' . $shopId, '', $ptStyle);
|
|
|
+ $goodsUrl = $goods['link'] ?? '';
|
|
|
+ $imgUrl = $image['link'] ?? '';
|
|
|
+ $itemUrl = $item['link'] ?? '';
|
|
|
+ Yii::$app->redis->executeCommand('SETEX', [$goodsShortUrl, 86400 * 3, $goodsUrl]);
|
|
|
+ Yii::$app->redis->executeCommand('SETEX', [$itemShortUrl, 86400 * 3, $imgUrl]);
|
|
|
+ Yii::$app->redis->executeCommand('SETEX', [$imageShortUrl, 86400 * 3, $itemUrl]);
|
|
|
+ }
|
|
|
+ util::success(['goodsUrl' => $goodsUrl, 'imgUrl' => $imgUrl, 'itemUrl' => $itemUrl]);
|
|
|
+ }
|
|
|
+
|
|
|
//main信息 ssh 20230406
|
|
|
public function actionInfo()
|
|
|
{
|