mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-11-30 02:49:03 +08:00
商品url地址优化
This commit is contained in:
parent
1e83d63860
commit
64fbd65572
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
@ -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']);
|
||||
|
||||
// 规格
|
||||
|
Loading…
Reference in New Issue
Block a user