添加本地生活配置文件及商品列表添加原价

This commit is contained in:
wangxiaowei 2024-10-22 14:56:43 +08:00
parent c5b1e3d5a9
commit 3d89fa7751
3 changed files with 21 additions and 7 deletions

@ -3,7 +3,6 @@
namespace app\api\logic; namespace app\api\logic;
use app\common\basics\Logic; use app\common\basics\Logic;
use app\common\model\LocalStore;
use app\common\model\localstore\LocalStoreGoods; use app\common\model\localstore\LocalStoreGoods;
use app\common\model\localstore\LocalStoreGoodsPic; use app\common\model\localstore\LocalStoreGoodsPic;
use app\common\model\localstore\LocalStoreGoodsItem; use app\common\model\localstore\LocalStoreGoodsItem;
@ -19,6 +18,9 @@ class LocalStoreGoodsLogic extends Logic
// 88折 // 88折
public static $sale = 88 / 100; public static $sale = 88 / 100;
// 88折商家ID
public static $lstore_id = 138;
// 获取商品列表 // 获取商品列表
public static function lists($get) public static function lists($get)
{ {
@ -62,6 +64,13 @@ class LocalStoreGoodsLogic extends Logic
->select() ->select()
->toArray(); ->toArray();
if ($get['lstore_id'] == Config::get('localstore.dlh_lstore_id')) {
foreach ($list as $k => &$v) {
$list[$k]['original_price'] = $v['price'];
$v['price'] = number_format($v['price'] * self::$sale, 2, '.', '');
}
}
$count = LocalStoreGoods::where($where)->where($m_where)->count(); $count = LocalStoreGoods::where($where)->where($m_where)->count();
// 统计待审核的商品数量 // 统计待审核的商品数量
@ -252,12 +261,12 @@ class LocalStoreGoodsLogic extends Logic
])->find()->toArray(); ])->find()->toArray();
// 东龙汇超时价格 *88折 // 东龙汇超时价格 *88折
if ($get['lstore_id'] == 138) { if ($get['lstore_id'] == Config::get('localstore.dlh_lstore_id')) {
$data['original_price'] = $data['price']; $data['original_price'] = $data['price'];
$data['price'] = number_format($data['price'] * self::$sale, 2, '.', ''); $data['price'] = number_format($data['price'] * self::$sale, 2, '.', '');
} }
if ($get['lstore_id'] != 138) { if ($get['lstore_id'] != Config::get('localstore.dlh_lstore_id')) {
$data['close'] = array( $data['close'] = array(
'status' => ConfigServer::get('website', 'show_local_notice'), 'status' => ConfigServer::get('website', 'show_local_notice'),
'text' => ConfigServer::get('website', 'local_notice') 'text' => ConfigServer::get('website', 'local_notice')
@ -274,7 +283,7 @@ class LocalStoreGoodsLogic extends Logic
$v['image'] = Config::get('aliyunoss.domain') . $v['image']; $v['image'] = Config::get('aliyunoss.domain') . $v['image'];
// 东龙汇超时价格 *88折 // 东龙汇超时价格 *88折
if ($get['lstore_id'] == 138) { if ($get['lstore_id'] == Config::get('localstore.dlh_lstore_id')) {
$v['original_price'] = $v['price']; $v['original_price'] = $v['price'];
$v['price'] = number_format($v['price'] * self::$sale, 2, '.', ''); $v['price'] = number_format($v['price'] * self::$sale, 2, '.', '');
} }

@ -159,7 +159,7 @@ class LocalStoreLogic extends Logic
foreach ($lists as $key => &$value) { foreach ($lists as $key => &$value) {
// 东龙汇超时价格 *88折 // 东龙汇超时价格 *88折
if ($value['lstore_id'] == 138) { if ($value['lstore_id'] == Config::get('localstore.dlh_lstore_id')) {
$lists[$key]['original_price'] = $value['price']; $lists[$key]['original_price'] = $value['price'];
$lists[$key]['price'] = round($value['price'] * LocalStoreGoodsLogic::$sale, 2); $lists[$key]['price'] = round($value['price'] * LocalStoreGoodsLogic::$sale, 2);
} }
@ -238,7 +238,7 @@ class LocalStoreLogic extends Logic
foreach ($lists as $key => &$value) { foreach ($lists as $key => &$value) {
// 东龙汇超时价格 *88折 // 东龙汇超时价格 *88折
if ($value['lstore_id'] == 138) { if ($value['lstore_id'] == Config::get('localstore.dlh_lstore_id')) {
foreach ($value['street_goods'] as $k1 => &$v1) { foreach ($value['street_goods'] as $k1 => &$v1) {
$value['street_goods'][$k1]['original_price'] = $v1['price']; $value['street_goods'][$k1]['original_price'] = $v1['price'];
$v1['price'] = round($v1['price'] * LocalStoreGoodsLogic::$sale, 2); $v1['price'] = round($v1['price'] * LocalStoreGoodsLogic::$sale, 2);
@ -388,7 +388,7 @@ class LocalStoreLogic extends Logic
$data['goods_total_price'] = round($goods_msg['price'] * $post['goods_num'], 2); $data['goods_total_price'] = round($goods_msg['price'] * $post['goods_num'], 2);
} }
if ($post['lstore_id'] == 138) { if ($post['lstore_id'] == Config::get('localstore.dlh_lstore_id')) {
$data['goods_total_price'] = number_format($data['goods_total_price'] * LocalStoreGoodsLogic::$sale, 2, '.', ''); $data['goods_total_price'] = number_format($data['goods_total_price'] * LocalStoreGoodsLogic::$sale, 2, '.', '');
} }

5
config/localstore.php Executable file

@ -0,0 +1,5 @@
<?php
return [
"dlh_lstore_id" => 138 // 东龙汇优选超市
];