|
@@ -49,10 +49,16 @@ class Goods extends Controller
|
|
*/
|
|
*/
|
|
public function detail(int $goodsId, bool $verifyStatus = true): Json
|
|
public function detail(int $goodsId, bool $verifyStatus = true): Json
|
|
{
|
|
{
|
|
|
|
+ $promoter = $this->request->param('promoter',0);
|
|
// 商品详情
|
|
// 商品详情
|
|
$model = new GoodsModel;
|
|
$model = new GoodsModel;
|
|
$goodsInfo = $model->getDetails($goodsId, $verifyStatus);
|
|
$goodsInfo = $model->getDetails($goodsId, $verifyStatus);
|
|
- return $this->renderSuccess(['detail' => $goodsInfo]);
|
|
|
|
|
|
+ $user = $this->getLoginUser();
|
|
|
|
+ if (!empty($user)){
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //如果已经登录,则可以记录推广人,如果没登录,需要前端继续保持此信息,登录后,下单时传给我
|
|
|
|
+ return $this->renderSuccess(['detail' => $goodsInfo,'promoter'=>$promoter]);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -97,4 +103,16 @@ class Goods extends Controller
|
|
$skuInfo = GoodsService::getSkuInfo($goodsId, $goodsSkuId);
|
|
$skuInfo = GoodsService::getSkuInfo($goodsId, $goodsSkuId);
|
|
return $this->renderSuccess(compact('skuInfo'));
|
|
return $this->renderSuccess(compact('skuInfo'));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public function promotionToFriend(int $goodsId, string $email): Json
|
|
|
|
+ {
|
|
|
|
+ $model = new GoodsModel;
|
|
|
|
+ $goodsInfo = $model->getDetails($goodsId, true);
|
|
|
|
+ $user = $this->getLoginUser();
|
|
|
|
+ $userId = $user->id;
|
|
|
|
+ $emailText = '你的朋友给你分享了一个好东西,点击去查看,https://ww.com?goodsId='.$goodsId.'promoter=' . $userId;
|
|
|
|
+
|
|
|
|
+ return $this->renderSuccess(compact('emailText'));
|
|
|
|
+ }
|
|
}
|
|
}
|