提交 64fbd655 编写于 作者: G gongfuxiang

商品url地址优化

上级 1e83d638
......@@ -53,7 +53,8 @@ class Goods extends Common
public function Detail()
{
// 参数
if(empty($this->data_post['goods_id']))
$goods_id = empty($this->data_post['id']) ? (empty($this->data_post['goods_id']) ? 0 : intval($this->data_post['goods_id'])) : intval($this->data_post['id']);
if(empty($goods_id))
{
$ret = DataReturn('参数有误', -1);
} else {
......@@ -61,11 +62,10 @@ class Goods extends Common
$is_use_mobile_detail = intval(MyC('common_app_is_use_mobile_detail'));
// 获取商品
$goods_id = intval($this->data_post['goods_id']);
$params = [
'where' => [
'id' => $goods_id,
'is_delete_time' => 0,
'id' => $goods_id,
'is_delete_time' => 0,
],
'is_photo' => true,
'is_spec' => true,
......
......@@ -578,7 +578,7 @@ class BaseLayout
case 'goods' :
if(!empty($value) && !empty($value['id']))
{
$url = ($client_type == 'pc') ? MyUrl('index/goods/index', ['id'=>$value['id']]) : '/pages/goods-detail/goods-detail?goods_id='.$value['id'];
$url = GoodsService::GoodsUrlCreate($value['id']);
}
break;
......
......@@ -275,7 +275,7 @@ class BuyService
}
// 基础信息
$v['goods_url'] = MyUrl('index/goods/index', ['id'=>$v['goods_id']]);
$v['goods_url'] = GoodsService::GoodsUrlCreate($v['goods_id']);
$v['images_old'] = $v['images'];
$v['images'] = ResourcesService::AttachmentPathViewHandle($v['images']);
$v['total_price'] = PriceNumberFormat($v['stock']* $v['price']);
......
......@@ -614,7 +614,7 @@ class GoodsService
// 商品url地址
if(!empty($data_id))
{
$v['goods_url'] = MyUrl('index/goods/index', ['id'=>$data_id]);
$v['goods_url'] = self::GoodsUrlCreate($data_id);
}
// 获取相册
......@@ -2978,11 +2978,25 @@ class GoodsService
$params = [
'path' => DS.$path,
'filename' => $filename,
'content' => MyUrl('index/goods/index', ['id'=>$goods_id], true, true),
'content' => MyUrl('index/goods/index', ['id'=>$goods_id]),
];
// 创建二维码
return (new \base\Qrcode())->Create($params);
}
/**
* 商品url生成
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2022-02-12
* @desc description
* @param [int] $goods_id [商品id]
*/
public static function GoodsUrlCreate($goods_id)
{
return (APPLICATION_CLIENT_TYPE == 'pc') ? MyUrl('index/goods/index', ['id'=>$goods_id]) : '/pages/goods-detail/goods-detail?id='.$goods_id;
}
}
?>
\ No newline at end of file
......@@ -1544,7 +1544,7 @@ class OrderService
// 商品信息
$vs['images'] = ResourcesService::AttachmentPathViewHandle($vs['images']);
$vs['goods_url'] = MyUrl('index/goods/index', ['id'=>$vs['goods_id']]);
$vs['goods_url'] = GoodsService::GoodsUrlCreate($vs['goods_id']);
$vs['total_price'] = PriceNumberFormat($vs['buy_number']*$vs['price']);
// 规格
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册