feat(StoreOrderLogic): 新增针对特定商店ID的价格更新逻辑
This commit is contained in:
parent
efc7286162
commit
a5d93516b2
@ -46,6 +46,9 @@ class StoreOrderLogic extends BaseLogic
|
|||||||
$v['uid'] = $params['user_id'];
|
$v['uid'] = $params['user_id'];
|
||||||
$v['store_id'] = $params['store_id'];
|
$v['store_id'] = $params['store_id'];
|
||||||
$v['cart_num'] = $v['stock'];
|
$v['cart_num'] = $v['stock'];
|
||||||
|
if(in_array($params['store_id'],[17,18])){
|
||||||
|
StoreBranchProduct::where('id', $v['id'])->update(['price' => $v['price'], 'vip_price' => $v['price'], 'cost' => $v['price'], 'purchase' => $v['price']]);
|
||||||
|
}
|
||||||
unset($v['id']);
|
unset($v['id']);
|
||||||
$res = CartLogic::add($v);
|
$res = CartLogic::add($v);
|
||||||
$cartId[] = $res['id'];
|
$cartId[] = $res['id'];
|
||||||
@ -53,6 +56,7 @@ class StoreOrderLogic extends BaseLogic
|
|||||||
$user = User::where('id', $params['user_id'])->find();
|
$user = User::where('id', $params['user_id'])->find();
|
||||||
$params['shipping_type'] = 2;
|
$params['shipping_type'] = 2;
|
||||||
$params['pay_type'] = 7;
|
$params['pay_type'] = 7;
|
||||||
|
$params['source'] =2;
|
||||||
$order = OrderLogic::createOrder($cartId, null, $user, $params);
|
$order = OrderLogic::createOrder($cartId, null, $user, $params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -183,39 +183,40 @@ class StoreFinanceFlowLogic extends BaseLogic
|
|||||||
->select();
|
->select();
|
||||||
foreach ($list as $k => $value) {
|
foreach ($list as $k => $value) {
|
||||||
//用户
|
//用户
|
||||||
switch ($value['type']) {
|
if($value['type']==0){
|
||||||
case 0:
|
if ($value['financial_type'] == 12 && $value['other_uid'] > 0) {
|
||||||
if ($value['financial_type'] == 12 && $value['other_uid'] > 0) {
|
$user = User::where('id', $value['other_uid'])->findOrEmpty();
|
||||||
$user = User::where('id', $value['other_uid'])->findOrEmpty();
|
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
$user->now_money = bcsub($user['now_money'], $value['number'], 2);
|
||||||
$user->now_money = bcsub($user['now_money'], $value['number'], 2);
|
$user->save();
|
||||||
$user->save();
|
$capitalFlowDao->userExpense('user_order_promotion_refund', 'system_back', $value['order_id'], $value['number'], '', $value['pay_type']);
|
||||||
// Log::error('aa'.$a);
|
}
|
||||||
// Log::error('aa'.$user['now_money']);
|
}elseif($value['type']==1){
|
||||||
// Log::error('aa'.$value['number']);
|
$store = SystemStore::where('id', $store_id)->find();
|
||||||
$capitalFlowDao->userExpense('user_order_promotion_refund', 'system_back', $value['order_id'], $value['number'], '', $value['pay_type']);
|
$capitalFlowDao = new CapitalFlowLogic($store, 'store');
|
||||||
}
|
if ($value['number'] > 0 && $value['financial_type'] == 2) {
|
||||||
break;
|
$find=SystemStore::where('id', $value['store_id'])->find();
|
||||||
//商户
|
$find->store_money=bcsub($find['store_money'], $value['number'],2);
|
||||||
case 1:
|
$find->save();
|
||||||
$store = SystemStore::where('id', $store_id)->find();
|
$capitalFlowDao->storeExpense('store_money_refund', 'order', $value['order_id'],$value['number'],'','store_money');
|
||||||
$capitalFlowDao = new CapitalFlowLogic($store, 'store');
|
|
||||||
if ($value['number'] > 0 && $value['financial_type'] == 2) {
|
|
||||||
SystemStore::where('id', $value['store_id'])->dec('store_money', $value['number'])->update();
|
|
||||||
$capitalFlowDao->storeExpense('store_paid_deposit_dec', 'order', $value['order_id'],$value['number']);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($value['number'] > 0 && $value['financial_type'] == 16) {
|
if ($value['number'] > 0 && $value['financial_type'] == 16) {
|
||||||
SystemStore::where('id', $value['store_id'])->dec('attrition', $value['number'])->update();
|
$find=SystemStore::where('id', $value['store_id'])->find();
|
||||||
$capitalFlowDao->storeExpense('store_attrition_dec', 'order', $value['order_id'], $value['number']);
|
$find->attrition=bcsub($find['attrition'], $value['number'],2);
|
||||||
|
$find->save();
|
||||||
|
$capitalFlowDao->storeExpense('store_attrition_refund', 'order', $value['order_id'], $value['number'],'','attrition');
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$find = StoreFinanceFlow::where('order_sn', $orderSn)->where('financial_type', 11)->where('status', 1)->find();
|
$find = StoreFinanceFlow::where('order_sn', $orderSn)->where('financial_type', 11)->where('status', 1)->find();
|
||||||
if ($find && $find['number'] > 0) {
|
if ($find && $find['number'] > 0) {
|
||||||
SystemStore::where('id', $find['store_id'])->dec('paid_deposit', $find['number'])->update();
|
$find=SystemStore::where('id', $value['store_id'])->find();
|
||||||
|
$capitalFlowDao = new CapitalFlowLogic($find, 'store');
|
||||||
|
$find->paid_deposit=bcsub($find['paid_deposit'], $value['number'],2);
|
||||||
|
$find->save();
|
||||||
|
$capitalFlowDao->storeExpense('store_paid_deposit_refund', 'order', $value['order_id'],$value['number'],'','paid_deposit');
|
||||||
}
|
}
|
||||||
// $data = StoreFinanceFlow::where('order_sn', $orderSn)->select();
|
// $data = StoreFinanceFlow::where('order_sn', $orderSn)->select();
|
||||||
// foreach ($data as $k => &$value) {
|
// foreach ($data as $k => &$value) {
|
||||||
|
@ -23,7 +23,7 @@ class Task
|
|||||||
new Crontab('0 */10 * * * *', function () {
|
new Crontab('0 */10 * * * *', function () {
|
||||||
$where = ['paid' => 0];
|
$where = ['paid' => 0];
|
||||||
$where[] = ['create_time', '<', time() - 600]; // 10分钟前创建的订单
|
$where[] = ['create_time', '<', time() - 600]; // 10分钟前创建的订单
|
||||||
$where[] = ['shipping_type', '<>',4];
|
$where[] = ['source', '<',2];
|
||||||
// 删除10分钟未支付的订单
|
// 删除10分钟未支付的订单
|
||||||
$oid = StoreOrder::where($where)->column('id'); // 删除时间设置为当前时间,即删除
|
$oid = StoreOrder::where($where)->column('id'); // 删除时间设置为当前时间,即删除
|
||||||
if ($oid) {
|
if ($oid) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user