Merge pull request 'refactor(app): 优化 DemoLogic 中数据库操作' (#433) from dev into main

Reviewed-on: https://gitea.lihaink.cn/mkm/multi-store/pulls/433
This commit is contained in:
mkm 2025-01-04 22:50:21 +08:00
commit 0312e2ee83

View File

@ -13,7 +13,7 @@ class DemoLogic extends BaseLogic
$arr = Db::name('ceshi_two')->select();
foreach ($arr as $k => $v) {
//门店供货、商户、零售
$res=StoreProduct::where('id', $v['product_id'])->update(['purchase' => $v['price'], 'cost' => bcadd($v['price1'], 0, 2), 'vip_price' => bcadd($v['price1'], 0, 2), 'price' => bcadd($v['price6'], 0, 2)]);
$res=Db::name('store_product')->where('id', $v['product_id'])->update(['purchase' => $v['price'], 'cost' => bcadd($v['price1'], 0, 2), 'vip_price' => bcadd($v['price1'], 0, 2), 'price' => bcadd($v['price6'], 0, 2)]);
if($res){
Db::name('ceshi_two')->where('product_id', $v['product_id'])->update(['status' => 1]);
}