|
|
@@ -18,9 +18,11 @@
|
|
|
// +----------------------------------------------------------------------
|
|
|
namespace app\openapi\logic\order;
|
|
|
use app\adminapi\logic\distribution\DistributionLogic;
|
|
|
-use app\common\{logic\BaseLogic,
|
|
|
+use app\common\{enum\OrderLogEnum,
|
|
|
+ logic\BaseLogic,
|
|
|
model\AfterSale,
|
|
|
model\OrderGoods,
|
|
|
+ model\OrderLog,
|
|
|
model\User,
|
|
|
model\Order,
|
|
|
enum\PayEnum,
|
|
|
@@ -212,6 +214,13 @@ class OrderLogic extends BaseLogic
|
|
|
// //记录日志
|
|
|
// AccountLogLogic::add($userInfo->id, AccountLogEnum::BNW_DEC_ORDER, AccountLogEnum::DEC, $order_amount, $params['orderSn'], '线下收银台销售扣减用户金额');
|
|
|
// }
|
|
|
+ (new OrderLog())->record([
|
|
|
+ 'type' => OrderLogEnum::TYPE_SYSTEM,
|
|
|
+ 'channel' => OrderLogEnum::USER_ADD_ORDER,
|
|
|
+ 'order_id' => $ret['id'],
|
|
|
+ 'content'=>'收银台推送订单',
|
|
|
+
|
|
|
+ ]);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
@@ -240,13 +249,7 @@ class OrderLogic extends BaseLogic
|
|
|
self::setError('订单已支付完成');
|
|
|
return false;
|
|
|
}
|
|
|
- if ($params['pay_way'] == 1) {
|
|
|
- if ($params['pay_money'] > $userInfo['user_money']) {
|
|
|
- outFileLog($params, 'orderPay', '会员卡金额不足');
|
|
|
- self::setError('线上会员金额不足以支付');
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
$pay_money = round($order_info['offline_pay_money'] + $order_info['offline_pay_user_money'] + $params['pay_money'],2) ;
|
|
|
if($pay_money>$order_info['order_amount']){
|
|
|
outFileLog($params, 'orderPay', '金额超了应付金额');
|
|
|
@@ -255,6 +258,15 @@ class OrderLogic extends BaseLogic
|
|
|
self::setError('订单支付金额错误,总支付金额大于应付金额');
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ if ($params['pay_way'] == 1) {
|
|
|
+ if ($params['pay_money'] > $userInfo['user_money']) {
|
|
|
+ outFileLog($params, 'orderPay', '会员卡金额不足');
|
|
|
+ self::setError('线上会员金额不足以支付');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$create_time = time();
|
|
|
if(isset($params['create_time']) && !empty($params['create_time'])){
|
|
|
$create_time = $params['create_time'];
|
|
|
@@ -273,6 +285,7 @@ class OrderLogic extends BaseLogic
|
|
|
//记录用户金额变动记录
|
|
|
//记录日志
|
|
|
AccountLogLogic::add($userInfo->id, AccountLogEnum::BNW_DEC_ORDER, AccountLogEnum::DEC, $params['pay_money'], $params['orderSn'], '线下收银台销售扣减用户金额');
|
|
|
+ $content = '收银台会员卡支付金额'.$params['pay_money'];
|
|
|
}else{
|
|
|
if(empty($order_info['pay_way'])){
|
|
|
$order_info->pay_way = 5;
|
|
|
@@ -280,8 +293,16 @@ class OrderLogic extends BaseLogic
|
|
|
}
|
|
|
$order_info->offline_pay_money = $order_info->offline_pay_money + $params['pay_money'];
|
|
|
$order_info->save();
|
|
|
+ $content = '收银台现金或移动支付金额'.$params['pay_money'];
|
|
|
}
|
|
|
|
|
|
+ (new OrderLog())->record([
|
|
|
+ 'type' => OrderLogEnum::TYPE_SYSTEM,
|
|
|
+ 'channel' => OrderLogEnum::USER_PAID_ORDER,
|
|
|
+ 'order_id' => $order_info['id'],
|
|
|
+ 'content'=>$content,
|
|
|
+
|
|
|
+ ]);
|
|
|
if($params['is_pay_end'] == 1){
|
|
|
$order_info->order_status = 3;
|
|
|
$order_info->save();
|