修复返补BUG

This commit is contained in:
wangxiaowei 2024-11-18 10:17:40 +08:00
parent fbc2ea2901
commit e8ae7e4f9a
3 changed files with 9 additions and 5 deletions

@ -66,7 +66,7 @@ class GoodsLogic extends Logic
}
$goodsDetail = Goods::with(['goods_image', 'goods_item', 'shop'])
->field('id,type,name,image,video,remark,goods_remark,content,purchase_price,issuing_price,wholesale_price,market_price,min_price,max_price,is_show_stock,stock,sales_actual,sales_virtual,clicks,clicks_virtual,shop_id,poster')
->field('id,type,name,image,video,remark,goods_remark,content,purchase_price,issuing_price,wholesale_price,market_price,min_price,max_price,is_show_stock,stock,sales_actual,sales_virtual,clicks,clicks_virtual,shop_id,poster,subsidy_id')
->where($onSaleWhere)
->where('id', $goodsId)
->findOrEmpty();
@ -78,6 +78,11 @@ class GoodsLogic extends Logic
Db::startTrans();
try{
// // 获取返补比例
// if ($goodsDetail['subsidy_id'] == 0) {
// // 获取
// }
// 轮播图加域名
foreach($goodsDetail['goods_image'] as &$item) {
$item['uri'] = empty($item['uri']) ? '' : UrlServer::getFileUrl($item['uri']);

@ -10,7 +10,7 @@ class GoodsSubsidy extends Models
{
$lists = $this->where('is_delete', 0)
->order('id desc')
->field('id, profit, discount, subsidy')
->field('id, profit, subsidy')
->paginate([
'list_rows'=> $get['limit'],
'page'=> $get['page'],
@ -18,7 +18,6 @@ class GoodsSubsidy extends Models
foreach ($lists as &$v) {
$v['profit'] = self::formatStr($v['profit']);
$v['discount'] = self::formatStr($v['discount']);
$v['subsidy'] = self::formatStr($v['subsidy']);
}
@ -27,9 +26,8 @@ class GoodsSubsidy extends Models
public function getSubsidyById($id)
{
$result = $this->where(['id' => $id, 'is_delete' => 0])->field('id, profit, discount, subsidy')->find();
$result = $this->where(['id' => $id, 'is_delete' => 0])->field('id, profit, subsidy')->find();
$result['profit'] = self::formatStr($result['profit']);
$result['discount'] = self::formatStr($result['discount']);
$result['subsidy'] = self::formatStr($result['subsidy']);
return $result;
}

@ -165,6 +165,7 @@ class Goods extends ShopBase
'supplier_lists' => json_encode(Supplier::getNameColumn($this->shop_id), JSON_UNESCAPED_UNICODE),
'unit_lists' => json_encode(GoodsUnit::getNameColumn(), JSON_UNESCAPED_UNICODE),
'freight_lists' => json_encode(Freight::getNameColumn($this->shop_id), JSON_UNESCAPED_UNICODE),
'subsidy' => json_encode([], JSON_UNESCAPED_UNICODE),
]);
}