feat: 修改用户余额字段及相关逻辑

This commit is contained in:
mkm 2024-06-15 15:07:59 +08:00
parent 94d89f86dc
commit b756c07191
7 changed files with 16 additions and 18 deletions

View File

@ -54,7 +54,6 @@ class UserLogic extends BaseLogic
'mobile' => $params['mobile'], 'mobile' => $params['mobile'],
'sex' => $params['sex'], 'sex' => $params['sex'],
'is_disable' => $params['is_disable'], 'is_disable' => $params['is_disable'],
'user_money' => $params['user_money']
]); ]);
Db::commit(); Db::commit();
@ -127,7 +126,6 @@ class UserLogic extends BaseLogic
'mobile' => $params['mobile'] ?? '', 'mobile' => $params['mobile'] ?? '',
'sex' => $params['sex'] ?? 0, 'sex' => $params['sex'] ?? 0,
'is_disable' => $params['is_disable'] ?? 0, 'is_disable' => $params['is_disable'] ?? 0,
'user_money' => $params['user_money'] ?? 0
]); ]);
Db::commit(); Db::commit();

View File

@ -27,7 +27,6 @@ class UserValidate extends BaseValidate
'mobile' => 'require|mobile', 'mobile' => 'require|mobile',
'is_disable' => 'in:0,1', 'is_disable' => 'in:0,1',
'sex' => 'in:1,2', 'sex' => 'in:1,2',
'user_money' => 'float',
'province' => 'require', 'province' => 'require',
'city' => 'require', 'city' => 'require',
'area' => 'require', 'area' => 'require',
@ -51,7 +50,6 @@ class UserValidate extends BaseValidate
'mobile' => '用户电话', 'mobile' => '用户电话',
'is_disable' => '是否禁用', 'is_disable' => '是否禁用',
'sex' => '用户性别', 'sex' => '用户性别',
'user_money' => '用户余额',
'province' => '省', 'province' => '省',
'city' => '市', 'city' => '市',
'area' => '区', 'area' => '区',
@ -86,7 +84,7 @@ class UserValidate extends BaseValidate
*/ */
public function sceneEdit() public function sceneEdit()
{ {
return $this->only(['id','avatar','real_name','nickname','account','password','mobile','is_disable','sex','user_money'])->remove('password','require'); return $this->only(['id','avatar','real_name','nickname','account','password','mobile','is_disable','sex'])->remove('password','require');
} }

View File

@ -304,7 +304,7 @@ class PayNotifyLogic extends BaseLogic
//平台手续费 //平台手续费
$fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2);
$count_frees = bcadd($count_frees, $fees, 2); $count_frees = bcadd($count_frees, $fees, 2);
$financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0, $order['pay_type']); //平台手续费 $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0,0, $order['pay_type']); //平台手续费
$financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出 $financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出
//冻结金额的 //冻结金额的
@ -320,17 +320,17 @@ class PayNotifyLogic extends BaseLogic
} else { } else {
$money = bcsub($store_profit, $deposit, 2); $money = bcsub($store_profit, $deposit, 2);
$financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
$financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //平台手续费 $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']); //平台手续费
} }
} else { } else {
$financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //平台手续费 $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); //平台手续费
} }
if ($order['is_vip'] == 1) { if ($order['is_vip'] >=1) {
if ($order['spread_uid'] > 0) { if ($order['spread_uid'] > 0) {
$financeLogic->other_arr['vip_uid'] = $order['spread_uid']; $financeLogic->other_arr['vip_uid'] = $order['spread_uid'];
$fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2);
$count_frees = bcadd($count_frees, $fees, 2); $count_frees = bcadd($count_frees, $fees, 2);
$financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //vip订单获得 $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']); //vip订单获得
$financeLogic->out($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
} }
$fees = bcdiv(bcmul($order['pay_price'], '0.01', 2), 1, 2); $fees = bcdiv(bcmul($order['pay_price'], '0.01', 2), 1, 2);
@ -355,21 +355,21 @@ class PayNotifyLogic extends BaseLogic
if ($village_uid > 0) { if ($village_uid > 0) {
$financeLogic->other_arr['vip_uid'] = $village_uid; $financeLogic->other_arr['vip_uid'] = $village_uid;
} }
$financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']);
$financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
//队长获得 //队长获得
if ($brigade_uid > 0) { if ($brigade_uid > 0) {
$financeLogic->other_arr['vip_uid'] = $brigade_uid; $financeLogic->other_arr['vip_uid'] = $brigade_uid;
} }
$financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']);
$financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
//其他获得 //其他获得
$financeLogic->other_arr['vip_uid'] = 0; $financeLogic->other_arr['vip_uid'] = 0;
$financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']);
$financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
} }
//供应链订单获得 //供应链订单获得
$financeLogic->in($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); $financeLogic->in($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']);
$financeLogic->out($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
// } // }
$financeLogic->save(); $financeLogic->save();

View File

@ -59,7 +59,7 @@ class StoreFinanceFlowLogic extends BaseLogic
'financial_pm' => $pm, 'financial_pm' => $pm,
'number' => $number, 'number' => $number,
'pay_type' => $pay_type, 'pay_type' => $pay_type,
'status' => $status, 'status' => 0,
'store_id' => $storeId !== '' ? $storeId : $this->order['store_id'], 'store_id' => $storeId !== '' ? $storeId : $this->order['store_id'],
'staff_id' => $staffId !== '' ? $staffId : $this->order['staff_id'], 'staff_id' => $staffId !== '' ? $staffId : $this->order['staff_id'],
'financial_record_sn' => $this->financeSn . ($this->index++), 'financial_record_sn' => $this->financeSn . ($this->index++),

View File

@ -115,8 +115,10 @@ class StoreOrderLogic extends BaseLogic
'default_delivery'=>1, 'default_delivery'=>1,
'original_price'=>self::$total_price, 'original_price'=>self::$total_price,
'deduction_price' => self::$activity_price 'deduction_price' => self::$activity_price
]; ];
if($user['user_ship']!=4){
$order['is_vip']=1;
}
} catch (\Exception $e) { } catch (\Exception $e) {
self::setError($e->getMessage()); self::setError($e->getMessage());
return false; return false;
@ -140,7 +142,6 @@ class StoreOrderLogic extends BaseLogic
return false; return false;
} }
$_order = $orderInfo['order']; $_order = $orderInfo['order'];
$_order['deduction_price'] = 0;
$_order['pay_type'] = $orderInfo['order']['pay_type']; $_order['pay_type'] = $orderInfo['order']['pay_type'];
$_order['verify_code'] = $verify_code; $_order['verify_code'] = $verify_code;
if (isset($params['reservation_time'])) { if (isset($params['reservation_time'])) {

View File

@ -310,6 +310,7 @@ class StoreOrderController extends BaseAdminController
'price'=>$params['price'], 'price'=>$params['price'],
]; ];
$order = UserRecharge::create($data); $order = UserRecharge::create($data);
$order['pay_price']=$order['price'];
switch ($pay_type) { switch ($pay_type) {
case PayEnum::WECHAT_PAY_BARCODE: case PayEnum::WECHAT_PAY_BARCODE:
//微信条码支付 //微信条码支付

View File

@ -37,7 +37,7 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface
public function lists(): array public function lists(): array
{ {
$field = "id,nickname,real_name,sex,avatar,account,mobile,user_money,user_ship,create_time"; $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time";
$lists = User::where($this->searchWhere) $lists = User::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->field($field) ->field($field)