Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
bf936b31fb
@ -391,6 +391,7 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
'financial_pm' => 0,
|
||||
'batch' => 0,
|
||||
'mark' => $mark,
|
||||
'order_type' => $order['order_type'] ?? '',
|
||||
];
|
||||
$arr['delivery_time'] = strtotime($delivery_time);
|
||||
$res = WarehouseOrder::create($arr);
|
||||
|
@ -180,6 +180,7 @@ class WarehouseProductLogic extends BaseLogic
|
||||
'unit' => $params['unit'] ?? 0,
|
||||
'status' => 1,
|
||||
'mark' => $params['mark'] ?? '',
|
||||
'order_type' => $params['order_type'] ?? '',
|
||||
];
|
||||
$res = WarehouseProduct::create($data);
|
||||
SqlChannelLog('WarehouseProduct', $res->id, $params['nums'], $params['financial_pm'] == 1 ? 1 : -1, Request()->url(),$admin_id);
|
||||
|
@ -26,7 +26,6 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
return [
|
||||
'=' => ['id','user_ship','store_id'],
|
||||
'%like%' => ['mobile'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -50,9 +49,12 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
return [];
|
||||
}
|
||||
}
|
||||
$query = User::where($this->searchWhere);
|
||||
if (!empty($this->params['nickname'])) {
|
||||
$query->whereLike('real_name|mobile', "%{$this->params['nickname']}%");
|
||||
}
|
||||
$field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds,integral";
|
||||
$lists = User::where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
$lists = $query->limit($this->limitOffset, $this->limitLength)
|
||||
->field($field)
|
||||
->order('id desc')
|
||||
->select()->each(function($data){
|
||||
|
@ -11,6 +11,7 @@ use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\store_product_price\StoreProductPrice;
|
||||
use app\common\model\user_recharge\UserRecharge;
|
||||
use app\common\model\warehouse_product\WarehouseProduct;
|
||||
use support\Cache;
|
||||
use think\facade\Db;
|
||||
use Webman\RedisQueue\Redis;
|
||||
@ -68,6 +69,7 @@ class Task
|
||||
|
||||
$this->updateProductPrice();
|
||||
$this->confirmProductPrice();
|
||||
$this->setPurchase();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -127,4 +129,31 @@ class Task
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置出库商品的供货价
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function setPurchase()
|
||||
{
|
||||
$list = WarehouseProduct::where('purchase', 0)->order('id desc')->limit(100)->select()->toArray();
|
||||
$productIds = array_unique(array_column($list, 'product_id'));
|
||||
$products = StoreProduct::whereIn('id', $productIds)->field('id,purchase')->select()->toArray();
|
||||
$products = reset_index($products, 'id');
|
||||
$update = [];
|
||||
foreach ($list as $item) {
|
||||
$product = $products[$item['product_id']] ?? [];
|
||||
if (empty($product) || empty($product['purchase'])) {
|
||||
continue;
|
||||
}
|
||||
$update[] = [
|
||||
'id' => $item['id'],
|
||||
'purchase' => min($product['purchase'], $item['price']),
|
||||
];
|
||||
}
|
||||
(new WarehouseProduct())->saveAll($update);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user