This commit is contained in:
mkm 2024-06-29 14:46:29 +08:00
commit ab018ba12d
3 changed files with 23 additions and 21 deletions

View File

@ -131,7 +131,6 @@ class OrderController extends BaseApiController
}
$order = OrderLogic::createOrder($cartId, $addressId, $user, $params);
if ($order != false) {
if ($order['pay_price'] <= 0) {
$pay_type = 3;

View File

@ -66,7 +66,7 @@ class PayNotifyLogic extends BaseLogic
public static function balancePay($orderSn, $extra = [])
{
$order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
self::afterPay($order);d(444);
$user = User::where('id', $order['uid'])->find();
if ($user['now_money'] < $order['pay_price']) {
throw new \Exception('余额不足');
@ -826,7 +826,9 @@ class PayNotifyLogic extends BaseLogic
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
$financeLogic->out($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
$financeLogic->save();
if ($order['uid'] > 0 && $order['total_price'] >= 500 && $order['pay_type'] !=PayEnum::PURCHASE_FUNDS) {
$user_ship = User::where('id', $order['uid'])->value('user_ship');//会员不加兑换券
if ($order['uid'] > 0 && $order['total_price'] >= 500
&& $order['pay_type'] !=PayEnum::PURCHASE_FUNDS && $user_ship !=1) {
$user_number = bcmul($order['pay_price'], '0.10', 2);
$sing = [
'uid' => $order['uid'],
@ -848,14 +850,7 @@ class PayNotifyLogic extends BaseLogic
//用户下单该用户等级为1得时候才处理冻结金额
$user = User::where('id', $order['uid'])->find();
$user_ship = $user['user_ship'];
//纯在分销关系的时候要去判断分销出来的用户的采购款的额度 (只有会员按照这个逻辑拆分,其余的还是按照正常的支付金额)
if ($user['user_ship'] == 1 && $order['pay_type'] != PayEnum::CASH_PAY) {
$vipFrozenAmount = self::dealFrozenPrice($order['id']);
//为1的时候要去减活动价
$order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2);
self::dealVipAmount($order, $order['pay_type']);
}
if($order['total_price'] >= 500 && $order['pay_type'] !=PayEnum::PURCHASE_FUNDS){
if($order['total_price'] >= 500 && $order['pay_type'] !=PayEnum::PURCHASE_FUNDS && $user_ship !=1){
$user_number = bcmul($order['pay_price'], '0.10', 2);
$sing = [
'uid' => $order['uid'],
@ -870,6 +865,14 @@ class PayNotifyLogic extends BaseLogic
];
$user_sing->save($sing);
}
//纯在分销关系的时候要去判断分销出来的用户的采购款的额度 (只有会员按照这个逻辑拆分,其余的还是按照正常的支付金额)
if ($user['user_ship'] == 1 && $order['pay_type'] != PayEnum::CASH_PAY) {
$vipFrozenAmount = self::dealFrozenPrice($order['id']);
//为1的时候要去减活动价
$order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2);
self::dealVipAmount($order, $order['pay_type']);
}
}
//查询用户对应的村长和队长
$address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();

View File

@ -40,16 +40,16 @@ class UserController extends BaseAdminController
{
$params = (new UserValidate())->post()->goCheck('storeAdd');
$code = $params['code'];
if($code && $params['mobile']){
$remark = $params['mobile'].'_userArchives';
$codeCache = Cache::get($remark);
if(empty($codeCache)){
return $this->fail('验证码不存在');
}
if ($codeCache != $code) {
return $this->fail('验证码错误');
}
}
// if($code && $params['mobile']){
// $remark = $params['mobile'].'_userArchives';
// $codeCache = Cache::get($remark);
// if(empty($codeCache)){
// return $this->fail('验证码不存在');
// }
// if ($codeCache != $code) {
// return $this->fail('验证码错误');
// }
// }
UserLogic::StoreAdd($params);
if (UserLogic::hasError() ) {
return $this->fail(UserLogic::getError());