Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
177d9576c7
@ -188,6 +188,10 @@ class OrderController extends BaseApiController
|
|||||||
}
|
}
|
||||||
if ($order != false) {
|
if ($order != false) {
|
||||||
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']);
|
||||||
|
@ -23,6 +23,7 @@ use app\common\model\system_store\SystemStoreStaff;
|
|||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\model\user\UserAddress;
|
use app\common\model\user\UserAddress;
|
||||||
use app\common\model\user\UserShip;
|
use app\common\model\user\UserShip;
|
||||||
|
use app\common\model\user_spread_log\UserSpreadLog;
|
||||||
use Picqer\Barcode\BarcodeGeneratorJPG;
|
use Picqer\Barcode\BarcodeGeneratorJPG;
|
||||||
use Picqer\Barcode\BarcodeGeneratorPNG;
|
use Picqer\Barcode\BarcodeGeneratorPNG;
|
||||||
use support\exception\BusinessException;
|
use support\exception\BusinessException;
|
||||||
@ -160,6 +161,8 @@ class OrderLogic extends BaseLogic
|
|||||||
$_order = $orderInfo['order'];
|
$_order = $orderInfo['order'];
|
||||||
$_order['uid'] = request()->userId;
|
$_order['uid'] = request()->userId;
|
||||||
$user = User::where('id', \request()->userId)->find();
|
$user = User::where('id', \request()->userId)->find();
|
||||||
|
$_order['is_vip'] = $user['user_ship'];
|
||||||
|
$_order['spread_uid'] = UserSpreadLog::where('uid',request()->userId)->value('old_spread_uid')??0;//预留分享关系
|
||||||
$_order['real_name'] = $user['real_name'];
|
$_order['real_name'] = $user['real_name'];
|
||||||
$_order['mobile'] = $user['mobile'];
|
$_order['mobile'] = $user['mobile'];
|
||||||
$_order['pay_type'] = $orderInfo['order']['pay_type'];
|
$_order['pay_type'] = $orderInfo['order']['pay_type'];
|
||||||
|
@ -24,6 +24,7 @@ class OrderEnum
|
|||||||
* @SYSTEM_SET 系统设置
|
* @SYSTEM_SET 系统设置
|
||||||
* @OWN_GET 平台收入
|
* @OWN_GET 平台收入
|
||||||
* @ORDER_MARGIN 商户保证金
|
* @ORDER_MARGIN 商户保证金
|
||||||
|
* @PURCHASE_FUNDS 采购款收银
|
||||||
*/
|
*/
|
||||||
const USER_ORDER_PAY = 1;
|
const USER_ORDER_PAY = 1;
|
||||||
const MERCHANT_ORDER_OBTAINS = 2;
|
const MERCHANT_ORDER_OBTAINS = 2;
|
||||||
@ -44,6 +45,8 @@ class OrderEnum
|
|||||||
|
|
||||||
const CASHIER_FACE_PAY = 17;//现金收银
|
const CASHIER_FACE_PAY = 17;//现金收银
|
||||||
|
|
||||||
|
const PURCHASE_FUNDS = 18;//采购款收银
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收入支出类型
|
* 收入支出类型
|
||||||
|
@ -31,6 +31,7 @@ class PayEnum
|
|||||||
* @GOODS_FIRST_PAYMENT_LATER 先货后款
|
* @GOODS_FIRST_PAYMENT_LATER 先货后款
|
||||||
* @CORPORATE_TRANSFER 对公转账
|
* @CORPORATE_TRANSFER 对公转账
|
||||||
* @CASH_PAY 现金支付
|
* @CASH_PAY 现金支付
|
||||||
|
* @PURCHASE_FUNDS 采购款收银
|
||||||
*/
|
*/
|
||||||
const BALANCE_PAY = 3;
|
const BALANCE_PAY = 3;
|
||||||
const WECHAT_PAY = 1;
|
const WECHAT_PAY = 1;
|
||||||
@ -49,7 +50,7 @@ class PayEnum
|
|||||||
const GOODS_FIRST_PAYMENT_LATER = 15;
|
const GOODS_FIRST_PAYMENT_LATER = 15;
|
||||||
const CORPORATE_TRANSFER = 16;
|
const CORPORATE_TRANSFER = 16;
|
||||||
const CASH_PAY = 17;
|
const CASH_PAY = 17;
|
||||||
|
const PURCHASE_FUNDS = 18;//采购款收银
|
||||||
//支付状态
|
//支付状态
|
||||||
const UNPAID = 0; //未支付
|
const UNPAID = 0; //未支付
|
||||||
const ISPAID = 1; //已支付
|
const ISPAID = 1; //已支付
|
||||||
|
@ -32,7 +32,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
if ($action != 'cash_pay' && $action != 'balancePay') {
|
if ($action != 'cash_pay' && $action != 'balancePay'&& $action != 'purchase_funds') {
|
||||||
$payNotifyLogLogic = new PayNotifyLogLogic();
|
$payNotifyLogLogic = new PayNotifyLogLogic();
|
||||||
if ($action == 'refund') {
|
if ($action == 'refund') {
|
||||||
$payNotifyLogLogic->insert($action, $extra, PayNotifyLog::TYPE_REFUND);
|
$payNotifyLogLogic->insert($action, $extra, PayNotifyLog::TYPE_REFUND);
|
||||||
@ -83,6 +83,41 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购款支付
|
||||||
|
* @param $orderSn
|
||||||
|
* @param $extra
|
||||||
|
* @return void
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public static function purchase_funds($orderSn, $extra = [])
|
||||||
|
{
|
||||||
|
$order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
|
||||||
|
$user = User::where('id', $order['uid'])->find();
|
||||||
|
if ($user['purchase_funds'] < $order['pay_price']) {
|
||||||
|
throw new \Exception('采购款不足');
|
||||||
|
}
|
||||||
|
$order->money = $order['pay_price'];
|
||||||
|
$order->paid = 1;
|
||||||
|
$order->pay_time = time();
|
||||||
|
if (!$order->save()) {
|
||||||
|
throw new \Exception('订单保存出错');
|
||||||
|
}
|
||||||
|
// 减去采购款
|
||||||
|
$user->purchase_funds = bcsub($user['purchase_funds'], $order['pay_price'], 2);
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||||
|
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']);
|
||||||
|
self::afterPay($order);
|
||||||
|
Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||||
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 微信通用回调
|
* @notes 微信通用回调
|
||||||
* @param $orderSn
|
* @param $orderSn
|
||||||
|
22
app/common/model/user_spread_log/UserSpreadLog.php
Normal file
22
app/common/model/user_spread_log/UserSpreadLog.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\user_spread_log;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户分享表模型
|
||||||
|
* Class UserRecharge
|
||||||
|
* @package app\common\model\user_recharge
|
||||||
|
*/
|
||||||
|
class UserSpreadLog extends BaseModel
|
||||||
|
{
|
||||||
|
use SoftDelete;
|
||||||
|
protected $name = 'user_spread_log';
|
||||||
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -140,6 +140,10 @@ class StoreOrderController extends BaseAdminController
|
|||||||
$order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params);
|
$order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params);
|
||||||
if ($order != false) {
|
if ($order != false) {
|
||||||
switch ($pay_type) {
|
switch ($pay_type) {
|
||||||
|
case PayEnum::PURCHASE_FUNDS:
|
||||||
|
//采购款支付
|
||||||
|
PayNotifyLogic::handle('purchase_funds', $order['order_id']);
|
||||||
|
return $this->success('采购款支付成功');
|
||||||
|
|
||||||
case PayEnum::CASH_PAY:
|
case PayEnum::CASH_PAY:
|
||||||
//现金支付
|
//现金支付
|
||||||
|
Loading…
x
Reference in New Issue
Block a user