feat: 新增采购款支付功能

This commit is contained in:
mkm 2024-07-01 16:33:14 +08:00
parent 9b2bdc2c4f
commit f1f609563a
4 changed files with 13 additions and 3 deletions

View File

@ -249,6 +249,10 @@ class OrderController extends BaseApiController
} }
switch ($pay_type) { switch ($pay_type) {
case PayEnum::PURCHASE_FUNDS:
//采购款支付
PayNotifyLogic::handle('purchase_funds', $order['order_id']);
return $this->success('采购款支付成功');
case PayEnum::BALANCE_PAY: case PayEnum::BALANCE_PAY:
//余额支付 //余额支付
PayNotifyLogic::handle('balancePay', $order['order_id']); PayNotifyLogic::handle('balancePay', $order['order_id']);

View File

@ -61,7 +61,6 @@ class OrderLogic extends BaseLogic
*/ */
static public function cartIdByOrderInfo($cartId, $addressId, $user = null, $params = []) static public function cartIdByOrderInfo($cartId, $addressId, $user = null, $params = [])
{ {
$where = ['is_pay' => 0]; $where = ['is_pay' => 0];
$cart_select = Cart::whereIn('id', $cartId)->where($where)->field('id,product_id,cart_num')->select()->toArray(); $cart_select = Cart::whereIn('id', $cartId)->where($where)->field('id,product_id,cart_num')->select()->toArray();
if (empty($cart_select)) { if (empty($cart_select)) {
@ -174,7 +173,7 @@ class OrderLogic extends BaseLogic
} }
//处理返回最近的店铺 //处理返回最近的店铺
$store['near_store'] = []; $store['near_store'] = [];
if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['lat'] != '')) { if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) {
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray(); $storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
$nearestStore = null; $nearestStore = null;
$minDistance = PHP_FLOAT_MAX; $minDistance = PHP_FLOAT_MAX;

View File

@ -1227,7 +1227,11 @@ class PayNotifyLogic extends BaseLogic
*/ */
public static function dealGoodsLeft($cart_id,$uid,$oid) public static function dealGoodsLeft($cart_id,$uid,$oid)
{ {
$cart_id['cart_id'] = explode(',',$cart_id); if(is_array($cart_id)){
$cart_id['cart_id'] = $cart_id;
}else{
$cart_id['cart_id'] = explode(',',$cart_id);
}
$data = OrderLogic::checkLeft($cart_id,$uid,1); $data = OrderLogic::checkLeft($cart_id,$uid,1);
$format = $data['detail']; $format = $data['detail'];
foreach ($format as &$value){ foreach ($format as &$value){

View File

@ -8,6 +8,7 @@ use app\common\enum\PayEnum;
use app\common\model\user\UserAuth; use app\common\model\user\UserAuth;
use app\common\service\pay\PayService; use app\common\service\pay\PayService;
use Exception; use Exception;
use support\Log;
use function DI\string; use function DI\string;
@ -101,6 +102,8 @@ class PaymentLogic extends BaseLogic
try { try {
$result = $wechat->wechat->pos($order)->toArray(); $result = $wechat->wechat->pos($order)->toArray();
} catch (Exception $e) { } catch (Exception $e) {
Log::error('条码支付报错',['message' => $e->extra['message']?? $e->getMessage(),'code'=>$e->getCode()]);
if (getenv('APP_DEBUG') == true) { if (getenv('APP_DEBUG') == true) {
self::$error = $e->extra['message'] ?? $e->getMessage(); self::$error = $e->extra['message'] ?? $e->getMessage();
} else { } else {