修改回调和商品成本

This commit is contained in:
liu 2024-06-15 18:00:53 +08:00
parent 6b75053f6f
commit bf98d4837a
3 changed files with 13 additions and 7 deletions

View File

@ -96,7 +96,7 @@ class PayNotifyLogic extends BaseLogic
public static function purchase_funds($orderSn, $extra = []) public static function purchase_funds($orderSn, $extra = [])
{ {
$order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
$user = User::where('id', $order['uid'])->find(); $user = User::where('id', $extra['uid'])->find();
if ($user['purchase_funds'] < $order['pay_price']) { if ($user['purchase_funds'] < $order['pay_price']) {
throw new \Exception('采购款不足'); throw new \Exception('采购款不足');
} }

View File

@ -55,7 +55,8 @@ class StoreStorageSend implements Consumer
'bar_code' => $find['bar_code'], 'bar_code' => $find['bar_code'],
'cate_id' => $find['cate_id'], 'cate_id' => $find['cate_id'],
'price' => $find['price'], 'price' => $find['price'],
'cost' => $find['cost'], // 'cost' => $find['cost'], //v1.0
'cost' => $find['purchase'],
'vip_price' => $find['vip_price'], 'vip_price' => $find['vip_price'],
'unit' => $find['unit'], 'unit' => $find['unit'],
'store_id' => $store_id, 'store_id' => $store_id,

View File

@ -4,6 +4,7 @@ namespace app\store\controller\store_order;
use app\api\logic\order\OrderLogic; use app\api\logic\order\OrderLogic;
use app\api\validate\OrderValidate; use app\api\validate\OrderValidate;
use app\common\model\order\Cart;
use app\common\model\user\User; use app\common\model\user\User;
use app\store\lists\store_order\StoreOrderLists; use app\store\lists\store_order\StoreOrderLists;
use app\common\controller\Definitions; use app\common\controller\Definitions;
@ -141,7 +142,7 @@ class StoreOrderController extends BaseAdminController
} }
$res = (new StoreOrderLogic())->dealSendSms($params); $res = (new StoreOrderLogic())->dealSendSms($params);
if($res){ if($res){
return $this->success('发送成功',[],1,1); return $this->success('发送成功',[],0,1);
}else{ }else{
return $this->fail('发送失败'); return $this->fail('发送失败');
} }
@ -156,20 +157,24 @@ class StoreOrderController extends BaseAdminController
$addressId = (int)$this->request->post('address_id'); $addressId = (int)$this->request->post('address_id');
$auth_code = $this->request->post('auth_code'); //微信支付条码 $auth_code = $this->request->post('auth_code'); //微信支付条码
$params = $this->request->post(); $params = $this->request->post();
if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS) {
return $this->fail('支付条码不能为空'); return $this->fail('支付条码不能为空');
} }
if (count($cartId) > 100) { if (count($cartId) > 100) {
return $this->fail('购物车商品不能超过100个'); return $this->fail('购物车商品不能超过100个');
} }
$user = null;
if($pay_type == PayEnum::PURCHASE_FUNDS){
$user = User::where('id',$this->request->post('uid'))->find();
}
$params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id用于判断是否是当前店铺的订单 $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id用于判断是否是当前店铺的订单
$order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params); $order = StoreOrderLogic::createOrder($cartId, $addressId, $user, $params);
if ($order != false) { if ($order != false) {
switch ($pay_type) { switch ($pay_type) {
case PayEnum::PURCHASE_FUNDS: case PayEnum::PURCHASE_FUNDS:
//采购款支付 //采购款支付
PayNotifyLogic::handle('purchase_funds', $order['order_id']); PayNotifyLogic::handle('purchase_funds', $order['order_id'],['uid'=>$this->request->post('uid')]);
return $this->success('采购款支付成功'); return $this->success('采购款支付成功',[],0,1);
case PayEnum::CASH_PAY: case PayEnum::CASH_PAY:
//现金支付 //现金支付