From 149afec11fb14d529b5b22e61c57096c10b7c6f6 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 09:30:35 +0800
Subject: [PATCH 01/53] =?UTF-8?q?feat(StoreFinanceFlowLists):=20=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E4=BA=86=E8=B4=A2=E5=8A=A1=E7=B1=BB=E5=9E=8B=E5=92=8C?=
=?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=96=B9=E5=BC=8F=E7=9A=84=E6=90=9C=E7=B4=A2?=
=?UTF-8?q?=E6=9D=A1=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../store_finance_flow/StoreFinanceFlowLists.php | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
index 45bb608a7..0edff508f 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
@@ -32,7 +32,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
public function setSearch(): array
{
return [
- '=' => ['store_id', 'user_id', 'create_time', 'staff_id'],
+ '=' => ['store_id', 'user_id', 'create_time', 'staff_id','financial_type','financial_pm','order_id'],
'between_time' => 'create_time',
'%pipe_like%' => ['keyword' => 'order_sn'],
];
@@ -53,12 +53,15 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
$field = [
'id', 'order_id', 'order_sn', 'create_time', 'other_uid', 'user_id', 'store_id', 'staff_id', 'financial_type', 'financial_pm', 'pay_type', 'type', 'number', 'status'
];
- $this->searchWhere[] = ['financial_type', '=', 1];
- $this->searchWhere[] = ['financial_pm', '=', 1];
+ if($this->request->get('order_id')){
+ $order=['financial_pm'=>'desc'];
+ }else{
+ $order=['id'=>'desc'];
+ }
$data = StoreFinanceFlow::where($this->searchWhere)
->field($field)
->limit($this->limitOffset, $this->limitLength)
- ->order(['id' => 'desc'])
+ ->order($order)
->select()->each(function ($item) {
if ($item['user_id'] <= 0) {
$item['nickname'] = '游客';
From 88d8a22241ac6a6f89d9aad6d943773c4572c018 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 09:42:54 +0800
Subject: [PATCH 02/53] =?UTF-8?q?=E9=97=A8=E5=BA=97=E4=BD=99=E9=A2=9D?=
=?UTF-8?q?=E6=B6=88=E8=B4=B9=E6=96=B0=E5=A2=9E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 12 ++++++++++--
.../store_order/StoreOrderController.php | 17 ++++++++++++++++-
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index efa099861..005c32207 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -96,6 +96,14 @@ class PayNotifyLogic extends BaseLogic
self::descStock($order['id']);
}
self::afterPay($order);
+ if ($extra && $extra['store_id']) {
+ $params = [
+ 'verify_code' => $order['verify_code'],
+ 'store_id' => $extra['store_id'],
+ 'staff_id' => $extra['staff_id']
+ ];
+ OrderLogic::writeOff($params);
+ }
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
}
@@ -186,6 +194,7 @@ class PayNotifyLogic extends BaseLogic
// self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS);
// }
// self::addUserSing($order);
+ self::afterPay($order);
if ($extra && $extra['store_id']) {
$params = [
'verify_code' => $order['verify_code'],
@@ -199,7 +208,7 @@ class PayNotifyLogic extends BaseLogic
// self::descStock($order['id']);
// }
- 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' => '您有一笔新的订单']);
}
@@ -357,7 +366,6 @@ class PayNotifyLogic extends BaseLogic
//日志记录
$model = new StoreCashFinanceFlow();
$model->store_id = $order['store_id'] ?? 0;
- $model->store_id = $order['store_id'] ?? 0;
$model->cash_price = $order->pay_price;
$model->receivable = $order->pay_price;
$model->remark = '退款';
diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php
index 1b14fec01..c17809179 100644
--- a/app/store/controller/store_order/StoreOrderController.php
+++ b/app/store/controller/store_order/StoreOrderController.php
@@ -174,6 +174,13 @@ class StoreOrderController extends BaseAdminController
$order = OrderLogic::createOrder($cartId, $addressId, $user, $params);
if ($order != false) {
switch ($pay_type) {
+ case PayEnum::BALANCE_PAY:
+ //余额支付
+ PayNotifyLogic::handle('balancePay', $order['order_id'],[
+ 'store_id' => $this->request->adminInfo['store_id'],
+ 'staff_id' => $this->request->adminInfo['admin_id']
+ ]);
+ return $this->success('余额支付成功');
case PayEnum::PURCHASE_FUNDS:
//采购款支付
PayNotifyLogic::handle('purchase_funds', $order['order_id'], [
@@ -248,9 +255,17 @@ class StoreOrderController extends BaseAdminController
return $this->fail('订单不存在或已支付');
}
switch ($pay_type) {
+ case PayEnum::BALANCE_PAY:
+ //余额支付
+ PayNotifyLogic::handle('balancePay', $order['order_id'],[
+ 'store_id' => $this->request->adminInfo['store_id'],
+ 'staff_id' => $this->request->adminInfo['admin_id']
+ ]);
+ return $this->success('余额支付成功');
case PayEnum::PURCHASE_FUNDS:
//采购款支付
- PayNotifyLogic::handle('purchase_funds', $order['order_id'], ['uid' => $order['uid']]);
+ PayNotifyLogic::handle('purchase_funds', $order['order_id'], ['uid' => $order['uid'],'store_id' => $this->request->adminInfo['store_id'],
+ 'staff_id' => $this->request->adminInfo['admin_id']]);
return $this->success('采购款支付成功', ['id' => $order['id']]);
case PayEnum::CASH_PAY:
//现金支付
From 7b5a2e76d47fb79dabf43d9f909941d2a2c9dd30 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 09:51:15 +0800
Subject: [PATCH 03/53] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../store_finance_flow/StoreFinanceFlowLists.php | 5 ++++-
app/admin/lists/store_order/StoreOrderLists.php | 12 +++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
index 0edff508f..53384f8c5 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php
@@ -67,7 +67,10 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
$item['nickname'] = '游客';
} else {
$id = $item['user_id'];
- $item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "|$id";
+ $user=User::where('id', $item['user_id'])->field('real_name,nickname')->find();
+ if($user){
+ $item['nickname'] =$user['real_name']!=''?$user['real_name']:$user['nickname'].'|'.$id;
+ }
}
if (!empty($this->request->adminInfo['store_id'])) {
$item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
diff --git a/app/admin/lists/store_order/StoreOrderLists.php b/app/admin/lists/store_order/StoreOrderLists.php
index 5b2e2d84f..f0e3e979f 100644
--- a/app/admin/lists/store_order/StoreOrderLists.php
+++ b/app/admin/lists/store_order/StoreOrderLists.php
@@ -10,6 +10,7 @@ use app\common\model\store_order\StoreOrder;
use app\common\lists\ListsSearchInterface;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
+use app\common\model\user\User;
/**
* 订单列表列表
@@ -46,7 +47,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
*/
public function lists(): array
{
- return StoreOrder::with(['user', 'staff'])->where($this->searchWhere)
+ return StoreOrder::with(['staff'])->where($this->searchWhere)
->when(!empty($this->request->adminInfo['store_id']), function ($query) {
$query->where('store_id', $this->request->adminInfo['store_id']);
})
@@ -64,6 +65,15 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
->select()->each(function ($item) {
$item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : '';
$item['status_name'] = OrderEnum::getOrderType($item['status']) ?? '';
+ if ($item['uid'] <= 0) {
+ $item['nickname'] = '游客';
+ } else {
+ $id = $item['uid'];
+ $user=User::where('id', $item['uid'])->field('real_name,nickname')->find();
+ if($user){
+ $item['nickname'] =$user['real_name']!=''?$user['real_name'].'|'.$id:$user['nickname'].'|'.$id;
+ }
+ }
if ($item['paid'] == 0) {
$item['status_name'] = '待支付';
}
From a40041e2dfc95b640ff6deb9c89dea526d902e6d Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 10:26:06 +0800
Subject: [PATCH 04/53] =?UTF-8?q?=E9=80=80=E6=AC=BE=E9=80=80=E7=A7=AF?=
=?UTF-8?q?=E5=88=86=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?,=E5=87=8F=E5=BA=93=E5=AD=98=E5=85=BC=E5=AE=B9=E6=A0=B8?=
=?UTF-8?q?=E9=94=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 49 ++++++++++++++++++++++++++---
1 file changed, 44 insertions(+), 5 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 005c32207..144b89d03 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -92,9 +92,9 @@ class PayNotifyLogic extends BaseLogic
$capitalFlowDao = new CapitalFlowLogic($user);
$capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 0, $order['store_id']);
self::dealProductLog($order);
- if ($order['shipping_type'] == 3) {
- self::descStock($order['id']);
- }
+// if ($order['shipping_type'] == 3) {
+// self::descStock($order['id']);
+// }
self::afterPay($order);
if ($extra && $extra['store_id']) {
$params = [
@@ -289,7 +289,7 @@ class PayNotifyLogic extends BaseLogic
$user = User::where('id', $order['uid'])->findOrEmpty();
$capitalFlowDao = new CapitalFlowLogic($user);
$deal_money = bcdiv($extra['amount']['refund'], 100, 2);
-
+ $check_user_sing = UserSign::where('order_id',$order['order_id'])->count();
if (in_array($order['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
if ($order['pay_type'] == PayEnum::BALANCE_PAY) { //用户余额
$user->now_money = bcadd($user->now_money, $deal_money, 2);
@@ -299,7 +299,6 @@ class PayNotifyLogic extends BaseLogic
//退款
$capitalFlowDao->userIncome('system_balance_back', 'system_back', $order['id'], $deal_money);
}
- if ($order['pay_type'] == PayEnum::PURCHASE_FUNDS) { //采购款
if ($order['pay_type'] == PayEnum::PURCHASE_FUNDS) { //采购款
$user->purchase_funds = bcadd($user->purchase_funds, $deal_money, 2);
$user->save();
@@ -308,6 +307,14 @@ class PayNotifyLogic extends BaseLogic
//退款
$capitalFlowDao->userIncome('system_purchase_back', 'system_back', $order['id'], $deal_money);
}
+ if($check_user_sing){
+ self::descUserSing($order);
+ }
+ return true;
+ }
+ //积分
+ if($check_user_sing){
+ self::descUserSing($order);
}
//微信日志 user_order_refund
$capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money, '', 1);
@@ -317,9 +324,38 @@ class PayNotifyLogic extends BaseLogic
return true;
// self::afterPay($order,$extra['transaction_id']);
}
+
+ //退积分
+ public static function descUserSing($order)
+ {
+ $user_sing = new UserSign();
+ if ($order['uid'] > 0 ) {
+ $user_number = bcmul($order['refund_price'], '0.10', 2);
+ $sing = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '退款扣除兑换券',
+ 'financial_pm' => 0,
+ 'store_id' => $order['store_id'],
+ 'number' => $user_number,
+ ];
+ $user_sing->save($sing);
+ $now_int = User::where('id',$order['uid'])->find();
+ if($now_int){
+ if($now_int['integral'] > $user_number){
+ User::where('id',$order['uid'])->dec('integral',$user_number)->update();
+ }else{
+ User::where('id',$order['uid'])->dec('integral',$now_int['integral'])->update();
+ }
+
+ }
+ }
+ return true;
+
}
+
/**
* 财务退还金额相关
* @param $orderSn
@@ -407,6 +443,7 @@ class PayNotifyLogic extends BaseLogic
'uid' => $order['uid'],
'order_id' => $order['order_id'],
'title' => '购买商品获得兑换券',
+ 'financial_pm' => 1,
'store_id' => $order['store_id'],
'number' => $user_number,
];
@@ -557,6 +594,7 @@ class PayNotifyLogic extends BaseLogic
'uid' => $order['uid'],
'order_id' => $order['order_id'],
'title' => '购买商品获得兑换券',
+ 'financial_pm' => 1,
'store_id' => $order['store_id'],
'number' => $user_number,
];
@@ -592,6 +630,7 @@ class PayNotifyLogic extends BaseLogic
'uid' => $order['uid'],
'order_id' => $order['order_id'],
'title' => '购买商品获得兑换券',
+ 'financial_pm' => 1,
'store_id' => $order['store_id'],
'number' => $user_number,
'status' => 0,
From c644ff5a6291053ff14d060f11129c62f5b76869 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 10:32:49 +0800
Subject: [PATCH 05/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0?=
=?UTF-8?q?=E5=95=86=E5=93=81=E6=9F=A5=E8=AF=A2=E7=9A=84=E7=BC=BA=E5=A4=B1?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../lists/store_branch_product/StoreBranchProductLists.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php
index 02f6df20d..c4ced3bf6 100644
--- a/app/admin/lists/store_branch_product/StoreBranchProductLists.php
+++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php
@@ -61,7 +61,9 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
//2或者1
$where[]=['cate_id','=',$class_all];
}
- $this->searchWhere[]=$where;
+ if($where){
+ $this->searchWhere[]=$where;
+ }
return StoreBranchProduct::where($this->searchWhere)
->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost','purchase', 'status','batch','vip_price','manufacturer_information'])
->when(!empty($this->adminInfo['store_id']), function ($query) {
@@ -99,6 +101,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
*/
public function count(): int
{
+ $status = $this->params['status'] ?? '';
return StoreBranchProduct::where($this->searchWhere)
->when(!empty($this->adminInfo['store_id']), function ($query) {
$query->where('store_id', $this->adminInfo['store_id']);
From b812b36e3ec0741f0239d0904890e5adba2f8419 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 13:46:42 +0800
Subject: [PATCH 06/53] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86StoreP?=
=?UTF-8?q?roductLists.php,=20LoginLogic.php,=20OperationLogMiddleware.php?=
=?UTF-8?q?,=20IndexController.php,=20OrderEnum.php,=20CommissionLogic.php?=
=?UTF-8?q?,=20StoreFinanceFlowLogic.php,=20StoreOrderController.php,=20mi?=
=?UTF-8?q?ddleware.php=E7=AD=89=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../lists/store_product/StoreProductLists.php | 2 +-
app/admin/logic/LoginLogic.php | 5 +-
.../middleware/OperationLogMiddleware.php | 71 +++++++++++++++++++
app/api/controller/IndexController.php | 48 +------------
app/common/enum/OrderEnum.php | 7 +-
app/common/logic/CommissionLogic.php | 12 ++--
app/common/logic/StoreFinanceFlowLogic.php | 10 +++
.../store_order/StoreOrderController.php | 6 --
config/middleware.php | 2 +
9 files changed, 97 insertions(+), 66 deletions(-)
create mode 100644 app/admin/middleware/OperationLogMiddleware.php
diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php
index 360cda901..ceabcc76b 100644
--- a/app/admin/lists/store_product/StoreProductLists.php
+++ b/app/admin/lists/store_product/StoreProductLists.php
@@ -58,7 +58,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
}
}
return StoreProduct::where($this->searchWhere)
- ->field(['id', 'image', 'store_name','swap', 'cate_id','batch', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code','manufacturer_information'])
+ ->field(['id', 'image', 'store_name','swap','product_type','cate_id','batch', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code','manufacturer_information'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) {
diff --git a/app/admin/logic/LoginLogic.php b/app/admin/logic/LoginLogic.php
index aaad56466..f52d7981a 100644
--- a/app/admin/logic/LoginLogic.php
+++ b/app/admin/logic/LoginLogic.php
@@ -19,7 +19,7 @@ use app\common\model\auth\Admin;
use app\admin\service\AdminTokenService;
use app\common\model\auth\AdminRole;
use app\common\service\FileService;
-use app\MyBusinessException;
+use Exception;
use think\facade\Db;
use Webman\Config;
@@ -44,6 +44,9 @@ class LoginLogic extends BaseLogic
{
$time = time();
$admin = Admin::where('account', '=', $params['account'])->find();
+ if(!$admin) {
+ throw new Exception('账号不存在');
+ }
//用户表登录信息更新
$admin->login_time = $time;
$admin->login_ip = request()->getLocalIp();
diff --git a/app/admin/middleware/OperationLogMiddleware.php b/app/admin/middleware/OperationLogMiddleware.php
new file mode 100644
index 000000000..91a553fb9
--- /dev/null
+++ b/app/admin/middleware/OperationLogMiddleware.php
@@ -0,0 +1,71 @@
+controllerObject->isNotNeedLogin() && empty($request->adminInfo)) {
+ return $handler($request);
+ }
+ //不记录日志操作
+ if (strtolower(str_replace('.', '\\', $request->controller)) === 'setting\system\log') {
+ return $handler($request);
+ }
+
+ //获取操作注解
+ $notes = '';
+ try {
+ $re = new ReflectionClass($request->controllerObject);
+ $doc = $re->getMethod($request->action)->getDocComment();
+ if (empty($doc)) {
+ throw new Exception('请给控制器方法注释');
+ }
+ preg_match('/\s(\w+)/u', $re->getMethod($request->action)->getDocComment(), $values);
+ $notes = $values[0];
+ } catch (Exception $e) {
+ $notes = $notes ?: '无法获取操作名称,请给控制器方法注释';
+ }
+
+ $params = $request->all();
+
+ //过滤密码参数
+ if (isset($params['password'])) {
+ $params['password'] = "******";
+ }
+ //过滤密钥参数
+ if(isset($params['app_secret'])){
+ $params['app_secret'] = "******";
+ }
+
+ //导出数据操作进行记录
+ if (isset($params['export']) && $params['export'] == 2) {
+ $notes .= '-数据导出';
+ }
+ //记录日志
+ $systemLog = new \app\common\model\OperationLog();
+ $systemLog->admin_id = $request->adminInfo['admin_id'] ?? 0;
+ $systemLog->admin_name = $request->adminInfo['name'] ?? '';
+ $systemLog->action = $notes;
+ $systemLog->account = $request->adminInfo['account'] ?? '';
+ $systemLog->url = $request->url(true);
+ $systemLog->type = $request->post()?'POST':'GET';
+ $systemLog->params = json_encode($params, true);
+ $systemLog->ip = $request->getRemoteIp();
+ // $systemLog->result = $response->getContent();
+ $systemLog->save();
+ return $handler($request);
+
+ }
+}
\ No newline at end of file
diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php
index cd0862a83..060283c38 100644
--- a/app/api/controller/IndexController.php
+++ b/app/api/controller/IndexController.php
@@ -32,53 +32,7 @@ class IndexController extends BaseApiController
public function index()
{
- $config = [
- // HTTP 请求的超时时间(秒)
- 'timeout' => 5.0,
-
- // 默认发送配置
- 'default' => [
- // 网关调用策略,默认:顺序调用
- 'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class,
-
- // 默认可用的发送网关
- 'gateways' => [
- 'yunpian', 'aliyun',
- ],
- ],
- // 可用的网关配置
- 'gateways' => [
- 'errorlog' => [
- 'file' => runtime_path() . '/logs/' . date('Ymd') . '/easy-sms.log',
- ],
- 'aliyun' => [
- 'access_key_id' => 'LTAI5t7mhH3ij2cNWs1zhPmv',
- 'access_key_secret' => 'gqo2wMpvi8h5bDBmCpMje6BaiXvcPu',
- 'sign_name' => '里海科技',
- ],
- //...
- ],
- ];
-
- try {
- $easySms = new EasySms($config);
- $template = getenv('SMS_TEMPLATE');
- $a = $easySms->send(18715753257, [
- 'content' => '您的验证码为: 6379',
- 'template' => $template,
- 'data' => [
- 'code' => 6379
- ],
- ]);
-// d($a);
- }catch (NoGatewayAvailableException $exception){
- throw new \Exception($exception->getExceptions());
- }
-
- d($a,getenv('SMS_TEMPLATE'));
-
-
-
+ return json([1]);
$all_where['paid'] = 1;
d(OrderLogic::dayPayPrice($all_where,date('Y-m-d',time())));
diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php
index 1ffb751c1..6674b96ad 100644
--- a/app/common/enum/OrderEnum.php
+++ b/app/common/enum/OrderEnum.php
@@ -46,6 +46,7 @@ class OrderEnum
const CASHIER_FACE_PAY = 17;//现金收银
const PURCHASE_FUNDS = 18;//采购款收银
+ const USER_ORDER_REFUND = 19;//订单返还
const PAY_BACK =-1;
@@ -165,11 +166,7 @@ class OrderEnum
self::ORDER_MARGIN=>'保证金',
self::VIP_ORDER_OBTAINS=>'会员',
self::OTHER_ORDER_OBTAINS=>'其他',
-
-
-
-
-
+ self::USER_ORDER_REFUND=>'订单返还'
];
if ($value === true) {
diff --git a/app/common/logic/CommissionLogic.php b/app/common/logic/CommissionLogic.php
index f9a438e59..072731033 100644
--- a/app/common/logic/CommissionLogic.php
+++ b/app/common/logic/CommissionLogic.php
@@ -14,7 +14,6 @@ class CommissionLogic extends BaseLogic
*/
public static function setVillage($order, $transaction_id)
{
- self::user($order, 0.05, $transaction_id,$order['uid'],14);
$village_uid=0;
$brigade_uid=0;
if ($order['uid'] > 0) {
@@ -36,7 +35,8 @@ class CommissionLogic extends BaseLogic
}
}
}
- self::user($order, 0.03, $transaction_id,$village_uid,12);//会员
+ self::user($order, 0.05, $transaction_id,$village_uid,14);//村长
+ self::user($order, 0.03, $transaction_id,0,12);//会员、厨师
self::user($order, 0.01, $transaction_id,$brigade_uid,15);//队长
self::user($order, 0.01, $transaction_id,0,16);//其他
}
@@ -45,7 +45,6 @@ class CommissionLogic extends BaseLogic
*/
public static function setBrigade($order, $transaction_id)
{
- self::user($order, 0.05, $transaction_id,$order['uid'],14);
$village_uid=0;
$brigade_uid=0;
if ($order['uid'] > 0) {
@@ -67,8 +66,9 @@ class CommissionLogic extends BaseLogic
}
}
}
- self::user($order, 0.03, $transaction_id,$village_uid,12);//会员
- self::user($order, 0.01, $transaction_id,$brigade_uid,15);//队长
+ self::user($order, 0.05, $transaction_id,$brigade_uid,14);//队长
+ self::user($order, 0.03, $transaction_id,0,12);////会员、厨师
+ self::user($order, 0.01, $transaction_id,$village_uid,15);//村长
self::user($order, 0.01, $transaction_id,0,16);//其他
}
/**
@@ -76,7 +76,6 @@ class CommissionLogic extends BaseLogic
*/
public static function setCook($order, $transaction_id)
{
- self::user($order, 0.07, $transaction_id,$order['uid'],12);//改到带返还金中
$village_uid=0;
$brigade_uid=0;
if ($order['uid'] > 0) {
@@ -98,6 +97,7 @@ class CommissionLogic extends BaseLogic
}
}
}
+ self::user($order, 0.07, $transaction_id,0,12);//会员、厨师
self::user($order, 0.01, $transaction_id,$village_uid,14);//村长
self::user($order, 0.01, $transaction_id,$brigade_uid,15);//队长
self::user($order, 0.01, $transaction_id,0,16);//其他
diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php
index fab958091..01a9e59c5 100644
--- a/app/common/logic/StoreFinanceFlowLogic.php
+++ b/app/common/logic/StoreFinanceFlowLogic.php
@@ -5,6 +5,7 @@ namespace app\common\logic;
use app\common\enum\OrderEnum;
use app\common\enum\PayEnum;
use app\common\model\store_finance_flow\StoreFinanceFlow;
+use app\common\model\user\User;
class StoreFinanceFlowLogic extends BaseLogic
{
@@ -126,4 +127,13 @@ class StoreFinanceFlowLogic extends BaseLogic
$model->save();
}
+ /**
+ * 核销后更新余额
+ */
+ public function updateStatusUser($id,$uid,$money){
+ StoreFinanceFlow::where('id', $id)->update(['status' => 1]);
+ User::where('id',$uid)->inc('now_money',$money)->update();
+ }
+
+
}
diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php
index c17809179..fbaa308e9 100644
--- a/app/store/controller/store_order/StoreOrderController.php
+++ b/app/store/controller/store_order/StoreOrderController.php
@@ -358,12 +358,6 @@ class StoreOrderController extends BaseAdminController
*/
public function rechange_amount()
{
- // $order = UserRecharge::where('order_id','CZ1719052252643357')->find();
- // $order['pay_price'] = $order['price'];
- // d(1);
- // PayNotifyLogic::handle('recharge', $order['order_id'], $order);
-
- // d(1);
$pay_type = $this->request->post('pay_type');
$auth_code = $this->request->post('auth_code'); //微信支付条码
if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) {
diff --git a/config/middleware.php b/config/middleware.php
index f2a5297fd..537b58ac2 100644
--- a/config/middleware.php
+++ b/config/middleware.php
@@ -23,6 +23,8 @@ return [
app\admin\middleware\LoginMiddleware::class,
// 权限认证
app\admin\middleware\AuthMiddleware::class,
+ // 操作日志记录
+ app\admin\middleware\OperationLogMiddleware::class,
],
'api' => [
// 跨域中间件
From 194db4c3df3b4bc5841646b8406d0ff6b80bf320 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 14:21:02 +0800
Subject: [PATCH 07/53] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E7=AD=89=E7=BA=A7=E5=92=8C=E4=BD=99=E9=A2=9D=E6=A0=B8?=
=?UTF-8?q?=E9=94=80=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/logic/user/UserLogic.php | 1 -
app/api/controller/store/StoreController.php | 1 -
app/common/logic/PayNotifyLogic.php | 7 ++++++-
app/common/logic/StoreFinanceFlowLogic.php | 7 +++++--
4 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php
index 7a6f7e8a6..3d02c5872 100644
--- a/app/admin/logic/user/UserLogic.php
+++ b/app/admin/logic/user/UserLogic.php
@@ -89,7 +89,6 @@ class UserLogic extends BaseLogic
'account' => $params['mobile'],
'password' => $password,
'mobile' => $params['mobile'],
- 'user_ship' => $params['user_ship']??0,
'label_id' => $params['label_id']??0,
];
diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php
index 2d91c792b..fb3fe03b7 100644
--- a/app/api/controller/store/StoreController.php
+++ b/app/api/controller/store/StoreController.php
@@ -83,7 +83,6 @@ class StoreController extends BaseApiController
$find=UserUserLogic::StoreAdd($params);
}else{
$find['real_name']=$params['real_name'];
- $find['user_ship']=$params['user_ship']??0;
$find['label_id']=$params['label_id']??0;
$find->save();
}
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 144b89d03..4964f4f8a 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -483,9 +483,14 @@ class PayNotifyLogic extends BaseLogic
bcscale(2);
// $user->now_money = bcadd($user->now_money, $price, 2);//v.1
//更新等级
- if ($price >= Config::where('name','recharge')->value('value')) {
+ $limit_1=UserShip::where('id',1)->value('limit');
+ $limit_4=UserShip::where('id',4)->value('limit');
+ if ($price >= $limit_1 &&$price<$limit_4) {
$user->user_ship = 1; //v.1
}
+ if ($price>$limit_4) {
+ $user->user_ship = 4;
+ }
$user->purchase_funds = bcadd($user->purchase_funds, $price, 2);
$user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2);
$user->save();
diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php
index 01a9e59c5..a65052b9a 100644
--- a/app/common/logic/StoreFinanceFlowLogic.php
+++ b/app/common/logic/StoreFinanceFlowLogic.php
@@ -130,9 +130,12 @@ class StoreFinanceFlowLogic extends BaseLogic
/**
* 核销后更新余额
*/
- public function updateStatusUser($id,$uid,$money){
+ public function updateStatusUser($id,$uid,$money,$order_id){
StoreFinanceFlow::where('id', $id)->update(['status' => 1]);
- User::where('id',$uid)->inc('now_money',$money)->update();
+ $find=User::where('id',$uid)->find();
+ $capitalFlowDao = new CapitalFlowLogic($find);
+ $capitalFlowDao->userIncome('system_balance_add', 'order', $order_id, $money);
+ $find->inc('now_money',$money)->update();
}
From 72c64d29d98ef5d7d872e6f2545c757b975257e6 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 14:26:39 +0800
Subject: [PATCH 08/53] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?=
=?UTF-8?q?=E5=95=86=E5=BA=97=E6=8E=A7=E5=88=B6=E5=99=A8=E4=BB=A5=E4=BB=8E?=
=?UTF-8?q?=E5=8F=82=E6=95=B0=E4=B8=AD=E8=8E=B7=E5=8F=96=E4=BB=B7=E6=A0=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/controller/store/StoreController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php
index fb3fe03b7..38fe87375 100644
--- a/app/api/controller/store/StoreController.php
+++ b/app/api/controller/store/StoreController.php
@@ -98,7 +98,7 @@ class StoreController extends BaseApiController
'other_uid'=>$this->userId,
'staff_id'=>0,
'order_id'=>getNewOrderId('CZ'),
- 'price'=>Config::where('name','recharge')->value('value')??1000,
+ 'price'=>$params['price']??1000,
'recharge_type'=>'INDUSTRYMEMBERS',
];
$order = UserRecharge::create($data);
From dfd12a6ea1e1f7b248eff1e18e72677c60af3d8a Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 14:29:55 +0800
Subject: [PATCH 09/53] =?UTF-8?q?=E6=80=BB=E5=90=8E=E5=8F=B0=E6=9F=A5?=
=?UTF-8?q?=E8=AF=A2=E8=AE=A2=E5=8D=95=E7=9B=B8=E5=85=B3=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/lists/store_order/StoreOrderLists.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/admin/lists/store_order/StoreOrderLists.php b/app/admin/lists/store_order/StoreOrderLists.php
index f0e3e979f..7ba04fd0b 100644
--- a/app/admin/lists/store_order/StoreOrderLists.php
+++ b/app/admin/lists/store_order/StoreOrderLists.php
@@ -30,7 +30,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
public function setSearch(): array
{
return [
- '=' => ['order_id', 'pay_type', 'staff_id', 'shipping_type', 'delivery_id'],
+ '=' => ['order_id', 'pay_type', 'staff_id', 'shipping_type', 'delivery_id','paid', 'status', 'is_writeoff'],
'between_time' => 'create_time'
];
}
@@ -59,7 +59,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
$query->whereIn('status', $status);
}
})
- ->field(['id', 'store_id', 'staff_id', 'order_id', 'paid', 'pay_price', 'pay_time', 'pay_type', 'status', 'uid','refund_status'])
+ ->field(['id', 'store_id', 'staff_id', 'order_id', 'paid', 'pay_price', 'pay_time', 'pay_type', 'status', 'uid','refund_status','create_time'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) {
From 98996fa802eb3008167dccb8a7043ab0a225ba9d Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 14:35:14 +0800
Subject: [PATCH 10/53] =?UTF-8?q?feat(UserLabelLists):=20=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E7=94=A8=E6=88=B7=E6=A0=87=E7=AD=BE=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/lists/user_label/UserLabelLists.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/app/admin/lists/user_label/UserLabelLists.php b/app/admin/lists/user_label/UserLabelLists.php
index 4e142b649..53261482b 100644
--- a/app/admin/lists/user_label/UserLabelLists.php
+++ b/app/admin/lists/user_label/UserLabelLists.php
@@ -6,7 +6,7 @@ namespace app\admin\lists\user_label;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\user_label\UserLabel;
use app\common\lists\ListsSearchInterface;
-
+use app\common\model\user\UserShip;
/**
* 用户标签列表
@@ -42,11 +42,14 @@ class UserLabelLists extends BaseAdminDataLists implements ListsSearchInterface
*/
public function lists(): array
{
+ $limit=UserShip::where('id',1)->value('limit');
return UserLabel::where($this->searchWhere)
->field(['label_id', 'label_name'])
->limit($this->limitOffset, $this->limitLength)
->order(['label_id' => 'desc'])
- ->select()
+ ->select()->each(function ($item) use($limit){
+ $item->limit = $limit;
+ })
->toArray();
}
From 300b6b4bb2c1724e728d3b5083f9f06831622bdc Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 15:09:14 +0800
Subject: [PATCH 11/53] =?UTF-8?q?feat(StoreFinanceFlowDayLists):=20?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=B6=E5=85=A5=E8=AE=A1=E7=AE=97=E9=80=BB?=
=?UTF-8?q?=E8=BE=91=E5=A2=9E=E5=8A=A0=E8=B4=A2=E5=8A=A1=E7=B1=BB=E5=9E=8B?=
=?UTF-8?q?=E5=88=A4=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php
index ee7ca21d0..05818471c 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php
@@ -46,7 +46,7 @@ class StoreFinanceFlowDayLists extends BaseAdminDataLists implements ListsSearch
return StoreFinanceFlow::where($this->searchWhere)
->field('
FROM_UNIXTIME(create_time, "%Y-%m-%d") as date,
- SUM(CASE WHEN financial_pm = 1 THEN number ELSE 0 END) as income,
+ SUM(CASE WHEN financial_pm = 1 AND WHERE financial_type=1 THEN number ELSE 0 END) as income,
SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure
')
->limit($this->limitOffset, $this->limitLength)
From 3a80a09c83899954b99c4b0615819381f15c250b Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 15:12:04 +0800
Subject: [PATCH 12/53] =?UTF-8?q?feat(StoreFinanceFlowDayLists):=20?=
=?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=B4=A2=E5=8A=A1=E6=B5=81=E6=B0=B4=E6=97=A5?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E8=AF=AD=E5=8F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php
index 05818471c..2c1cc96fa 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowDayLists.php
@@ -46,7 +46,7 @@ class StoreFinanceFlowDayLists extends BaseAdminDataLists implements ListsSearch
return StoreFinanceFlow::where($this->searchWhere)
->field('
FROM_UNIXTIME(create_time, "%Y-%m-%d") as date,
- SUM(CASE WHEN financial_pm = 1 AND WHERE financial_type=1 THEN number ELSE 0 END) as income,
+ SUM(CASE WHEN financial_pm = 1 AND financial_type = 1 THEN number ELSE 0 END) as income,
SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure
')
->limit($this->limitOffset, $this->limitLength)
From eff3a9a2c6c084258cd6d6ed2f4ca70052c7db68 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 15:13:54 +0800
Subject: [PATCH 13/53] =?UTF-8?q?feat(StoreFinanceFlow):=20=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E8=B4=A2=E5=8A=A1=E6=B5=81=E6=B0=B4=E7=9A=84=E7=BB=9F?=
=?UTF-8?q?=E8=AE=A1=E6=96=B9=E5=BC=8F=EF=BC=8C=E6=8C=89=E5=B9=B4=E4=BB=BD?=
=?UTF-8?q?=E5=92=8C=E6=9C=88=E4=BB=BD=E6=88=96=E6=8C=89=E5=91=A8=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E6=94=B6=E5=85=A5=E5=92=8C=E6=94=AF=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../lists/store_finance_flow/StoreFinanceFlowMonthLists.php | 2 +-
.../lists/store_finance_flow/StoreFinanceFlowWeekLists.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowMonthLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowMonthLists.php
index c91be7381..3ee82eb3c 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowMonthLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowMonthLists.php
@@ -46,7 +46,7 @@ class StoreFinanceFlowMonthLists extends BaseAdminDataLists implements ListsSear
return StoreFinanceFlow::where($this->searchWhere)
->field('
CONCAT(YEAR(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "年", MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "月") as date,
- SUM(CASE WHEN financial_pm = 1 THEN number ELSE 0 END) as income,
+ SUM(CASE WHEN financial_pm = 1 AND financial_type = 1 THEN number ELSE 0 END) as income,
SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure
')
->limit($this->limitOffset, $this->limitLength)
diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowWeekLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowWeekLists.php
index 00513e499..41c2386dc 100644
--- a/app/admin/lists/store_finance_flow/StoreFinanceFlowWeekLists.php
+++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowWeekLists.php
@@ -46,7 +46,7 @@ class StoreFinanceFlowWeekLists extends BaseAdminDataLists implements ListsSearc
return StoreFinanceFlow::where($this->searchWhere)
->field('
CONCAT("第", LPAD(YEAR(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 4, "0"), "-", LPAD(WEEK(FROM_UNIXTIME(create_time, "%Y-%m-%d"), 3), 2, "0"), "周(", LPAD(MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 2, "0"), "月)") as date,
- SUM(CASE WHEN financial_pm = 1 THEN number ELSE 0 END) as income,
+ SUM(CASE WHEN financial_pm = 1 AND financial_type = 1 THEN number ELSE 0 END) as income,
SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure
')
->limit($this->limitOffset, $this->limitLength)
From b95964cbaf30da9f5c36534a3567b1dc6aed2ade Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 15:26:34 +0800
Subject: [PATCH 14/53] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=88=86?=
=?UTF-8?q?=E7=B1=BB=E4=BF=AE=E6=94=B9=E8=A1=A8=E5=AD=98=E5=82=A8=E9=80=BB?=
=?UTF-8?q?=E8=BE=91=E7=9B=B8=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/lists/cate/CateLists.php | 56 +++++++++++++++++---------
app/api/lists/product/ProductLists.php | 31 +++++++-------
2 files changed, 52 insertions(+), 35 deletions(-)
diff --git a/app/api/lists/cate/CateLists.php b/app/api/lists/cate/CateLists.php
index e924419bf..7139e303d 100644
--- a/app/api/lists/cate/CateLists.php
+++ b/app/api/lists/cate/CateLists.php
@@ -6,6 +6,7 @@ namespace app\api\lists\cate;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\cate\Cate;
use app\common\lists\ListsSearchInterface;
+use app\common\model\store_branch_product\StoreBranchProduct;
use app\Request;
use think\facade\Db;
@@ -27,7 +28,7 @@ class CateLists extends BaseAdminDataLists implements ListsSearchInterface
public function setSearch(): array
{
return [
- '=' => ['name', 'data', 'store_id', 'sort', 'pid'],
+ '=' => ['name', 'data', 'store_id', 'sort'],
];
}
@@ -44,10 +45,24 @@ class CateLists extends BaseAdminDataLists implements ListsSearchInterface
public function lists(): array
{
$level = Request()->get('level', 1);
- $this->searchWhere[] = ['level', '=', $level];
- $this->searchWhere[] = ['count', '>', 0];
- $this->searchWhere[] = ['delete_time', '=', null];
- $cate_arr = Db::name('store_product_cate')->where($this->searchWhere)->column('cate_id');
+ $pid = $this->request->get('pid',0);
+ $this->searchWhere[] = ['stock', '>', 0];
+ $this->searchWhere[] = ['status', '=', 1];
+ if($pid == 0 && $level ==1){
+ $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct()
+ ->column('top_cate_id');
+ }
+ if($pid && $level ==2){
+ $this->searchWhere[] = ['top_cate_id','=',$pid];
+ $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct()
+ ->column('two_cate_id');
+ }
+
+ if($pid && $level ==3){
+ $this->searchWhere[] = ['two_cate_id','=',$pid];
+ $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct()
+ ->column('cate_id');
+ }
$lists = [];
if ($cate_arr) {
return Cate::where('id', 'in', $cate_arr)
@@ -56,18 +71,7 @@ class CateLists extends BaseAdminDataLists implements ListsSearchInterface
->order(['sort' => 'desc', 'id' => 'desc'])
->select()->toArray();
}
-
- // ->each(function ($item) {
- // $a = Goodsclass::where('pid', $item['id'])->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])->select();
- // $item['children'] = $a;
- // foreach ($a as $k => &$v) {
- // $b = Goodsclass::where('pid', $v['id'])->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])->select();
- // $v['children'] = $b;
- // }
- // })->toArray();
-
return $lists;
- // return linear_to_tree($lists, 'children');
}
@@ -80,8 +84,24 @@ class CateLists extends BaseAdminDataLists implements ListsSearchInterface
*/
public function count(): int
{
+ $level = Request()->get('level', 1);
+ $pid = $this->request->get('pid',0);
+ if($pid == 0 && $level ==1){
+ $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct()
+ ->column('top_cate_id');
+ }
- return Db::name('store_product_cate')->where($this->searchWhere)
- ->count();
+ if($pid && $level ==2){
+ $this->searchWhere[] = ['top_cate_id','=',$pid];
+ $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct()
+ ->column('two_cate_id');
+ }
+
+ if($pid && $level ==3){
+ $this->searchWhere[] = ['two_cate_id','=',$pid];
+ $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct()
+ ->column('cate_id');
+ }
+ return Cate::where('id', 'in', $cate_arr)->count();
}
}
diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php
index a2aec1a21..9d299fedd 100644
--- a/app/api/lists/product/ProductLists.php
+++ b/app/api/lists/product/ProductLists.php
@@ -33,13 +33,10 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
public function setSearch(): array
{
return [
- '=' => ['store_id', 'cate_id'],
- '%pipe_like%' => ['store_name' => 'store_name|bar_code'],
- ];
- return [
- '=' => ['store_id', 'cate_id'],
+ '=' => ['store_id', 'cate_id','top_cate_id','two_cate_id'],
'%pipe_like%' => ['store_name' => 'store_name|bar_code'],
];
+
}
/**
* @notes 设置支持排序字段
@@ -74,17 +71,17 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
*/
public function lists(): array
{
- $class_all = $this->request->get('class_all');
- if ($class_all) {
- //查3级别的
- $arr = Cate::where('pid', $class_all)->column('id');
- if ($arr) {
- $arr2 = Cate::where('pid', 'in', $arr)->column('id');
- $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)];
- } else {
- $this->searchWhere[] = ['cate_id', '=', $class_all];
- }
- }
+// $class_all = $this->request->get('class_all');
+// if ($class_all) {
+// //查3级别的
+// $arr = Cate::where('pid', $class_all)->column('id');
+// if ($arr) {
+// $arr2 = Cate::where('pid', 'in', $arr)->column('id');
+// $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)];
+// } else {
+// $this->searchWhere[] = ['cate_id', '=', $class_all];
+// }
+// }
$order = $this->request->get('order','');
$field = $this->request->get('field','');
if(empty($order)||empty($field)){
@@ -92,7 +89,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
}else{
$order = [$field => $order];
}
- $fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch';
+ $fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id';
$this->searchWhere[] = ['status', '=', 1];
$this->searchWhere[] = ['stock', '>', 0];
From 855c600f2bcf88ac7aae138dac497d447ce963f3 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 15:33:35 +0800
Subject: [PATCH 15/53] =?UTF-8?q?feat(PayNotifyLogic):=20=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E6=96=B0=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=8E=A8=E9=80=81?=
=?UTF-8?q?=E6=96=B0=E8=AE=A2=E5=8D=95=E4=BF=A1=E6=81=AF=E8=87=B3=E6=8C=87?=
=?UTF-8?q?=E5=AE=9AURL?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 4964f4f8a..5d808912e 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -25,6 +25,7 @@ use app\common\model\user\UserAddress;
use app\common\model\user\UserRecharge;
use app\common\model\user\UserShip;
use app\common\model\user_sign\UserSign;
+use app\common\service\Curl;
use app\common\service\PushService;
use support\Log;
use think\facade\Db;
@@ -585,6 +586,19 @@ class PayNotifyLogic extends BaseLogic
$financeLogic = new StoreFinanceFlowLogic();
$user_sing = new UserSign();
$off_activity = Config::where('name', 'off_activity')->value('value');
+ try{
+ $url=getenv('WETCHA_PUSH');
+ if($url){
+ $order_id=$order['order_id'];
+ $pay_price=$order['pay_price'];
+ $arr=["msgtype"=>"markdown","markdown"=>["content"=> "有新的订单请及时跟踪\n
+ >单号:$order_id
+ >金额:$pay_price"]];
+ (new Curl())->post($url,$arr);
+ }
+ }catch(\Exception $e){
+ Log::error('推送订单失败',['order_id'=>$order['id'],'error'=>$e->getMessage()]);
+ }
if ($off_activity == 1) {
//-----活动价结算更改
$financeLogic->order = $order;
From a944e9936fbcfbdbf8871f79b09099406992b367 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 15:37:04 +0800
Subject: [PATCH 16/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E7=B1=BB?=
=?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=88=86=E7=B1=BB?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../logic/store_product/StoreProductLogic.php | 33 +++++++++++++++++--
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php
index bcecea565..6887fa881 100644
--- a/app/admin/logic/store_product/StoreProductLogic.php
+++ b/app/admin/logic/store_product/StoreProductLogic.php
@@ -127,6 +127,33 @@ class StoreProductLogic extends BaseLogic
}
}
+ /*
+ * 传入三级或者二级分类返还上级分类 一级那全是相同
+ */
+ public static function dealChangeCate($cate_id)
+ {
+ $value =[];
+ $last_cate = Db::name('store_category')->where('id',$cate_id)->value('pid');
+ if(!empty($last_cate)){
+ //2
+ $value['two_cate_id'] = $last_cate;
+ //1
+ $first_cate = Db::name('store_category')->where('id',$value['two_cate_id'])->value('pid');
+ if(empty($first_cate)){//顶级了
+ $value['two_cate_id'] = $cate_id;
+ $value['top_cate_id'] = $last_cate;
+ }else{
+ $value['top_cate_id'] = $first_cate;
+ }
+
+ }else{
+ //1-2 选的1级目录
+ $value['two_cate_id'] = $cate_id;
+ $value['top_cate_id'] = $cate_id;
+ }
+ return $value;
+ }
+
/**
* @notes 编辑商品列表
* @param array $params
@@ -175,15 +202,15 @@ class StoreProductLogic extends BaseLogic
self::updateGoodsclass($params['cate_id'], $value['store_id']);
}
}*/
-
-
+ $dealCate = self::dealChangeCate($params['cate_id']);
//修改
StoreBranchProduct::where('product_id', $params['id'])->update([
'price' => $params['price'], 'vip_price' => $params['vip_price'],
'cost' => $params['cost'],'unit'=>$params['unit'],
'batch'=>$params['batch'],'store_name'=>$params['store_name'],
'manufacturer_information' => $params['manufacturer_information']??'',
- 'store_info' => $params['store_info']??'',
+ 'store_info' => $params['store_info']??'','cate_id'=>$params['cate_id'],
+ 'top_cate_id'=>$dealCate['top_cate_id'],'two_cate_id'=>$dealCate['two_cate_id']
]);
Db::commit();
From abd9e2cb82afa8cf25c715dcef852be5a9098461 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 15:41:50 +0800
Subject: [PATCH 17/53] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A4=8D=E5=88=B6?=
=?UTF-8?q?=E5=92=8C=E6=8E=A8=E9=80=81=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../logic/store_product/StoreProductLogic.php | 3 ++
app/queue/redis/StoreStorageSend.php | 30 +++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php
index 6887fa881..1220fab27 100644
--- a/app/admin/logic/store_product/StoreProductLogic.php
+++ b/app/admin/logic/store_product/StoreProductLogic.php
@@ -310,6 +310,7 @@ class StoreProductLogic extends BaseLogic
$attr_value = StoreProductAttrValue::where('product_id', $id)->findOrEmpty();
Db::startTrans();
try {
+ $dealCate = self::dealChangeCate($find['cate_id']);
$product = [
'product_id' => $find['id'],
'image' => $find['image'],
@@ -318,6 +319,8 @@ class StoreProductLogic extends BaseLogic
'keyword' => $find['keyword'],
'bar_code' => $find['bar_code'],
'cate_id' => $find['cate_id'],
+ 'top_cate_id' => $dealCate['top_cate_id'],
+ 'two_cate_id' => $dealCate['two_cate_id'],
'price' => $find['price'],
'unit' => $find['unit'],
'store_id' => $store_id,
diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php
index 02e7eefe6..04f5ad9ba 100644
--- a/app/queue/redis/StoreStorageSend.php
+++ b/app/queue/redis/StoreStorageSend.php
@@ -46,6 +46,7 @@ class StoreStorageSend implements Consumer
$attr_value = StoreProductAttrValue::where('product_id', $product_arr['id'])->findOrEmpty();
Db::startTrans();
try {
+ $dealCate = self::dealChangeCate($find['cate_id']);
$product = [
'product_id' => $find['id'],
'image' => $find['image'],
@@ -54,6 +55,8 @@ class StoreStorageSend implements Consumer
'keyword' => $find['keyword'],
'bar_code' => $find['bar_code'],
'cate_id' => $find['cate_id'],
+ 'top_cate_id' => $dealCate['top_cate_id'],
+ 'two_cate_id' => $dealCate['two_cate_id'],
'price' => $find['price'],
// 'cost' => $find['cost'], //v1.0
'cost' => $find['cost'],
@@ -179,4 +182,31 @@ class StoreStorageSend implements Consumer
Log::error('store-storage队列消费失败: ' . $e->getMessage() . ',line:' . $e->getLine() . ',file:' . $e->getFile());
return $package;
}
+
+ /*
+ * 传入三级或者二级分类返还上级分类 一级那全是相同
+ */
+ public static function dealChangeCate($cate_id)
+ {
+ $value =[];
+ $last_cate = Db::name('store_category')->where('id',$cate_id)->value('pid');
+ if(!empty($last_cate)){
+ //2
+ $value['two_cate_id'] = $last_cate;
+ //1
+ $first_cate = Db::name('store_category')->where('id',$value['two_cate_id'])->value('pid');
+ if(empty($first_cate)){//顶级了
+ $value['two_cate_id'] = $cate_id;
+ $value['top_cate_id'] = $last_cate;
+ }else{
+ $value['top_cate_id'] = $first_cate;
+ }
+
+ }else{
+ //1-2 选的1级目录
+ $value['two_cate_id'] = $cate_id;
+ $value['top_cate_id'] = $cate_id;
+ }
+ return $value;
+ }
}
From 10ed5f432c2a385733e8cb33860bb398ff22e37d Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 16:01:13 +0800
Subject: [PATCH 18/53] =?UTF-8?q?=E8=80=81=E6=95=B0=E6=8D=AE=E5=85=BC?=
=?UTF-8?q?=E5=AE=B9=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/lists/store_order/StoreOrderLists.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/admin/lists/store_order/StoreOrderLists.php b/app/admin/lists/store_order/StoreOrderLists.php
index 7ba04fd0b..39c010c45 100644
--- a/app/admin/lists/store_order/StoreOrderLists.php
+++ b/app/admin/lists/store_order/StoreOrderLists.php
@@ -80,8 +80,8 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
$product = StoreOrderCartInfo::where('oid', $item['id'])->field(['id', 'oid', 'product_id', 'cart_info'])
->limit(3)->select();
foreach ($product as &$items) {
- $items['store_name'] = $items['cart_info']['name'];
- $items['image'] = $items['cart_info']['image'];
+ $items['store_name'] = $items['cart_info']['name']??'';
+ $items['image'] = $items['cart_info']['image']??'';
}
$item['product'] = $product;
return $item;
From cf3dc5d25909ba397e099da881a576df49080111 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 16:12:02 +0800
Subject: [PATCH 19/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=A8=E5=BA=97?=
=?UTF-8?q?=E6=94=B6=E6=AC=BE=E9=80=BB=E8=BE=91=E7=9A=84=E6=93=8D=E4=BD=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/statistics/logic/OrderLogic.php | 12 ++++++++++++
app/store/logic/WorkbenchLogic.php | 3 ++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/app/statistics/logic/OrderLogic.php b/app/statistics/logic/OrderLogic.php
index 3f1617ac7..274653768 100644
--- a/app/statistics/logic/OrderLogic.php
+++ b/app/statistics/logic/OrderLogic.php
@@ -67,6 +67,18 @@ class OrderLogic extends BaseLogic
return bcadd($todayAmount, $pay_price, 2);
}
+ public static function dealFlexiblePrice($where,$start,$end)
+ {
+ $todayAmount = UserRecharge::where($where)
+ ->whereBetweenTime('create_time', $start, $end)
+ ->sum('price');
+ $pay_price = StoreOrder::where($where)
+ ->whereBetweenTime('create_time', $start, $end)
+ ->sum('pay_price');
+ return bcadd($todayAmount, $pay_price, 2);
+
+ }
+
public static function sales($where,$time){
$select=StoreOrder::where($where)->whereDay('create_time',$time)->limit(10)->order('id desc')->field('id,order_id,pay_price,create_time')->select();
return $select?->toArray();
diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php
index 72431a400..748df2080 100644
--- a/app/store/logic/WorkbenchLogic.php
+++ b/app/store/logic/WorkbenchLogic.php
@@ -84,7 +84,8 @@ class WorkbenchLogic extends BaseLogic
$data['income_amount'] = StoreFinanceFlow::where($storeFinanceWhere)->whereBetweenTime('create_time', $startTime, $endTime)->sum('number');
//门店收款金额
$all_where['paid'] = 1;
- $data['receipt_amount'] = OrderLogic::dayPayPrice($all_where,date('Y-m-d',time()));
+// $data['receipt_amount'] = OrderLogic::dayPayPrice($all_where,date('Y-m-d',time()));
+ $data['receipt_amount'] = OrderLogic::dealFlexiblePrice($all_where,$startTime,$endTime);
// $data['receipt_amount'] = UserRecharge::where($userRechargeWhere)->whereBetweenTime('create_time', $startTime, $endTime)->sum('price');
//保证金金额
$data['deposit_amount'] = StoreFinanceFlow::where($storeFinanceWhereTwo)->whereBetweenTime('create_time', $startTime, $endTime)->sum('number');
From 6238c1d5941047038770d76266d91dbf97d47a4f Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 16:38:00 +0800
Subject: [PATCH 20/53] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=AE=A2?=
=?UTF-8?q?=E5=8D=95=E6=8E=A8=E9=80=81=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E5=85=85=E5=80=BC=E9=87=91=E9=A2=9D=E9=99=90=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/controller/store/StoreController.php | 3 +
app/queue/redis/OrderWetchaPushSend.php | 68 ++++++++++++++++++++
2 files changed, 71 insertions(+)
create mode 100644 app/queue/redis/OrderWetchaPushSend.php
diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php
index 38fe87375..666bc0fe2 100644
--- a/app/api/controller/store/StoreController.php
+++ b/app/api/controller/store/StoreController.php
@@ -77,6 +77,9 @@ class StoreController extends BaseApiController
return $this->fail('验证码错误');
}
}
+ if($params['price']>10000){
+ return $this->fail('充值金额不能大于10000');
+ }
$find=User::where('mobile',$params['mobile'])->find();
if(!$find){
$params['create_uid']=$this->userId;
diff --git a/app/queue/redis/OrderWetchaPushSend.php b/app/queue/redis/OrderWetchaPushSend.php
new file mode 100644
index 000000000..0f6315125
--- /dev/null
+++ b/app/queue/redis/OrderWetchaPushSend.php
@@ -0,0 +1,68 @@
+value('name');
+ $cart_info=StoreOrderCartInfo::where('oid',$order['id'])->field('cart_info')->select();
+ $product_info="\r\n>商品信息:------------------";
+ foreach($cart_info as $k=>$v['cart_info']){
+ $a=$v['cart_info']['cart_info']['name'].' 数量:'.$v['cart_info']['cart_info']['cart_num'].' 价格:'.$v['cart_info']['cart_info']['pay_price'].'元';
+ $product_info.="\r\n>$a";
+ }
+ $arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的订单请及时跟踪
+ >订单号:$order_id
+ >门店信息:$store_name"
+ .$product_info
+ ."\r\n>下单时间:$pay_time
+ >订单金额:$total_price
+ >支付金额:$pay_price
+ >支付方式:$pay_type
+ >下单用户手机号:$phone"]];
+ (new Curl())->postJson($url, json_encode($arr));
+ }
+ }
+ // 消费失败时
+ public function onConsumeFailure(\Throwable $exception, $package)
+ {
+ $package['max_attempts'] = 0;
+ Log::error('推送订单失败', ['order_id' => $package['data'], 'error' => $package['error']]);
+ return true;
+ }
+}
From fef754e25aa77ed52359fa4e9fe821cea0d81b13 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 16:57:16 +0800
Subject: [PATCH 21/53] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=AE=A2?=
=?UTF-8?q?=E5=8D=95=E6=A0=B8=E9=94=80=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E6=A0=B8=E9=94=80=E5=90=8E=E6=9B=B4=E6=96=B0=E9=97=A8?=
=?UTF-8?q?=E5=BA=97=E4=BD=99=E9=A2=9D=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 29 +-
app/common/logic/PayNotifyLogic copy.php | 999 +++++++++++++++++++++
app/common/logic/PayNotifyLogic.php | 40 +-
app/common/logic/StoreFinanceFlowLogic.php | 16 +-
4 files changed, 1043 insertions(+), 41 deletions(-)
create mode 100644 app/common/logic/PayNotifyLogic copy.php
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index e033c3815..50ebcfd5e 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -15,6 +15,7 @@ use app\common\model\dict\DictData;
use app\common\model\dict\DictType;
use app\common\model\order\Cart;
use app\common\model\store_branch_product\StoreBranchProduct;
+use app\common\model\store_finance_flow\StoreFinanceFlow;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
use app\common\model\store_product\StoreProduct;
@@ -405,10 +406,11 @@ class OrderLogic extends BaseLogic
*/
public static function writeOff($params): bool
{
- $data = StoreOrder::with('store')->where([
+ $order = StoreOrder::with('store')->where([
'verify_code' => $params['verify_code']
])->find();
- if (empty($data)) {
+ if (empty($order)) {
+ self::setError('订单不存在');
return false;
}
Db::startTrans();
@@ -420,7 +422,7 @@ class OrderLogic extends BaseLogic
'update_time' => time(),
'store_id' => $params['store_id'],
'staff_id' => $params['staff_id']??0,
- ], ['id' => $data['id']]);
+ ], ['id' => $order['id']]);
(new StoreOrderCartInfo())->update([
'verify_code'=>$params['verify_code'].'-1',
'writeoff_time' => time(),
@@ -428,20 +430,33 @@ class OrderLogic extends BaseLogic
'store_id' => $params['store_id'],
'staff_id' => $params['staff_id']??0,
'update_time' => time(),
- ], ['oid' => $data['id']]);
+ ], ['oid' => $order['id']]);
// $financeFlow = (new StoreFinanceFlowLogic)->getStoreOrder($data['id'], $data['store_id']);
// if (!empty($financeFlow)) {
// $capitalFlowLogic = new CapitalFlowLogic($data->store, 'store');
// $capitalFlowLogic->storeIncome('store_order_income', 'order', $data['id'], $financeFlow['number']);
// }
- $order=StoreOrder::where('id',$data['id'])->find();
- // PayNotifyLogic::afterPay($order);
PayNotifyLogic::descStock($order['id']);
- if($order['uid'] && $order['total_price'] >= 500){
+ $financeFlow=new StoreFinanceFlow();
+ $financeFlowLogic=new StoreFinanceFlowLogic();
+ $select_1=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>['in'=>14,15],'other_uid'=>['>'=>0]])->select();
+ foreach($select_1 as $k=>$v){
+ $financeFlowLogic->updateStatusUser($v['id'],$v['other_uid'],$v['number'],$v['order_id']);
+ }
+ if($order['uid'] && $order['pay_price'] >= 500){
$user_number = bcmul($order['pay_price'], '0.10', 2);
User::where('id', $order['uid'])->inc('integral', $user_number)->update();
UserSign::where(['uid' => $order['uid'],'order_id' => $order['order_id']])->update(['status'=>1]);
}
+ if ($order['spread_uid'] > 0) {
+ $spread_number=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>12,'other_uid'=>$order['spread_uid']])->value('number');
+ if($spread_number){
+ $financeFlowLogic->updateStatusUser($v['id'],$order['spread_uid'],$spread_number,$v['order_id']);
+ }
+ }
+ $deposit=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>11])->value('number');
+ $money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number');
+ $financeFlowLogic->updateStatusStore($v['id'],$order['store_id'],$money,$deposit);
Db::commit();
return true;
diff --git a/app/common/logic/PayNotifyLogic copy.php b/app/common/logic/PayNotifyLogic copy.php
new file mode 100644
index 000000000..fac778279
--- /dev/null
+++ b/app/common/logic/PayNotifyLogic copy.php
@@ -0,0 +1,999 @@
+getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile());
+ throw new \Exception($e->getMessage());
+ }
+ }
+
+ /**
+ * 余额支付
+ * @param $orderSn
+ * @param $extra
+ * @return bool
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public static function balancePay($orderSn, $extra = [])
+ {
+ $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
+ $user = User::where('id', $order['uid'])->find();
+ if ($user['now_money'] < $order['pay_price']) {
+ throw new \Exception('余额不足');
+ }
+ $order->money = $order['pay_price'];
+ $order->paid = 1;
+ $order->pay_time = time();
+ if (!$order->save()) {
+ throw new \Exception('订单保存出错');
+ }
+ if($order['is_storage']==1){
+ $order->status=2;
+ UserProductStorageLogic::add($order);
+ }
+ // 减去余额
+ $user->now_money = bcsub($user['now_money'], $order['pay_price'], 2);
+ $user->save();
+
+ if ($order['spread_uid'] > 0 && $user['user_ship'] == 1) {
+ $oldUser = User::where('id', $order['spread_uid'])->value('purchase_funds');
+ if ($oldUser < $order['pay_price']) {
+ $order['pay_price'] = $oldUser;
+ }
+ }
+ // self::addUserSing($order);
+ $capitalFlowDao = new CapitalFlowLogic($user);
+ $capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 0, $order['store_id']);
+ self::dealProductLog($order);
+// if ($order['shipping_type'] == 3) {
+// self::descStock($order['id']);
+// }
+ self::afterPay($order);
+ if ($extra && $extra['store_id']) {
+ $params = [
+ 'verify_code' => $order['verify_code'],
+ 'store_id' => $extra['store_id'],
+ 'staff_id' => $extra['staff_id']
+ ];
+ OrderLogic::writeOff($params);
+ }
+ // Redis::send('push-platform-print', ['id' => $order['id']], 60);
+ // 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 gift_pay($orderSn, $extra = [])
+ {
+ $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
+ $user = User::where('id', $order['uid'])->find();
+ if ($user['integral'] < $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->integral = bcsub($user['integral'], $order['pay_price'], 2);
+ $user->save();
+ //入礼品券表扣款记录
+ $sing[] = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '订单扣除兑换券',
+ 'store_id' => $order['store_id'],
+ 'number' => $order['pay_price'],
+ 'financial_pm' => 0,
+ 'user_ship' => $user['user_ship'],
+ ];
+ (new UserSign())->saveAll($sing);
+
+ if ($extra && $extra['store_id']) {
+ $params = [
+ 'verify_code' => $order['verify_code'],
+ 'store_id' => $extra['store_id'],
+ 'staff_id' => $extra['staff_id']
+ ];
+ OrderLogic::lessWriteOff($params);
+ }
+ self::dealProductLog($order);
+ }
+
+
+ /**
+ * 采购款支付
+ * @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('订单保存出错');
+ }
+ if($order['is_storage']==1){
+ $order->status=2;
+ UserProductStorageLogic::add($order);
+ }
+ // 减去采购款
+ $user->purchase_funds = bcsub($user['purchase_funds'], $order['pay_price'], 2);
+ $user->save();
+
+ $capitalFlowDao = new CapitalFlowLogic($user);
+ $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'], '', 1, $order['store_id']);
+ // if ($user['user_ship'] == 1) {
+ // self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS);
+ // }
+ // self::addUserSing($order);
+ self::afterPay($order);
+ if ($extra && $extra['store_id']) {
+ $params = [
+ 'verify_code' => $order['verify_code'],
+ 'store_id' => $extra['store_id'],
+ 'staff_id' => $extra['staff_id']
+ ];
+ OrderLogic::writeOff($params);
+ }
+ self::dealProductLog($order);
+ // if($order['shipping_type'] == 3){
+ // self::descStock($order['id']);
+ // }
+
+
+ // Redis::send('push-platform-print', ['id' => $order['id']], 60);
+ // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
+ }
+
+ /**
+ * @notes 微信通用回调
+ * @param $orderSn
+ * @param array $extra
+ * @date 2023/2/27 15:28
+ */
+ public static function wechat_common($orderSn, $extra = [])
+ {
+ $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
+
+ if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) {
+ return true;
+ }
+ $order->status = 1;
+ $order->paid = 1;
+ $order->pay_time = time();
+ if($order['is_storage']==1){
+ $order->status=2;
+ UserProductStorageLogic::add($order);
+ }
+ if ($order->pay_type != 10) {
+ $order->pay_price = bcdiv($extra['amount']['payer_total'], 100, 2);
+ } else {
+ $extra['transaction_id'] = time();
+ }
+ $user = User::where('id', $order['uid'])->find();
+ if ($order->pay_type == OrderEnum::CASHIER_ORDER_PAY || $order->pay_type == OrderEnum::CASHIER_ORDER_ALI_PAY) { //收银台支付
+ $order->status = 2;
+ } else {
+ $capitalFlowDao = new CapitalFlowLogic($user);
+ //微信支付和用户余额无关
+ $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1, $order['store_id']);
+ }
+ $order->save();
+ self::afterPay($order, $extra['transaction_id']);
+ // self::addUserSing($order);
+ self::dealProductLog($order);
+ if ($order['shipping_type'] == 3) {
+ self::descStock($order['id']);
+ }
+ if (!empty($extra['payer']['openid']) && $order->pay_type == 7) {
+ Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 4);
+ }
+ return true;
+ }
+
+ //退款
+ public static function refund($orderSn, $extra = [])
+ {
+ //更新状态
+ $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
+ if ($order->isEmpty() || $order->status == OrderEnum::REFUND_PAY) {
+ //充值
+ $orderRe = UserRecharge::where('order_id', $orderSn)->findOrEmpty();
+ if ($orderRe->isEmpty() || $orderRe->status == -1) {
+ return true;
+ }
+ $orderRe->status = -1;
+ $orderRe->refund_price = $orderRe->price;
+ $orderRe->refund_time = time();
+ $orderRe->remarks = '';
+ $orderRe->save();
+
+ return true;
+ }
+ $order->status = OrderEnum::REFUND_PAY;
+ $order->refund_status = OrderEnum::REFUND_STATUS_FINISH;
+ $order->refund_price = bcdiv($extra['amount']['refund'], 100, 2);
+ $order->refund_reason_time = time();
+ $order->refund_num += 1;
+ $order->save();
+ //日志记录
+ //加用户余额,采购款, 日志记录 加数量
+ $user = User::where('id', $order['uid'])->findOrEmpty();
+ $capitalFlowDao = new CapitalFlowLogic($user);
+ $deal_money = bcdiv($extra['amount']['refund'], 100, 2);
+ $check_user_sing = UserSign::where('order_id',$order['order_id'])->count();
+ if (in_array($order['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) {
+ if ($order['pay_type'] == PayEnum::BALANCE_PAY) { //用户余额
+ $user->now_money = bcadd($user->now_money, $deal_money, 2);
+ $user->save();
+ //增加数量
+ self::addStock($order['id']);
+ //退款
+ $capitalFlowDao->userIncome('system_balance_back', 'system_back', $order['id'], $deal_money);
+ }
+ if ($order['pay_type'] == PayEnum::PURCHASE_FUNDS) { //采购款
+ $user->purchase_funds = bcadd($user->purchase_funds, $deal_money, 2);
+ $user->save();
+ //增加数量
+ self::addStock($order['id']);
+ //退款
+ $capitalFlowDao->userIncome('system_purchase_back', 'system_back', $order['id'], $deal_money);
+ }
+ if($check_user_sing){
+ self::descUserSing($order);
+ }
+ return true;
+ }
+ //积分
+ if($check_user_sing){
+ self::descUserSing($order);
+ }
+ //微信日志 user_order_refund
+ $capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money, '', 1);
+ //处理财务流水退还
+ self::store_finance_back($orderSn);
+ self::addStock($order['id']); //微信
+ return true;
+ // self::afterPay($order,$extra['transaction_id']);
+ }
+
+ //退积分
+ public static function descUserSing($order)
+ {
+ $user_sing = new UserSign();
+ if ($order['uid'] > 0 ) {
+ $user_number = bcmul($order['refund_price'], '0.10', 2);
+ $sing = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '退款扣除兑换券',
+ 'financial_pm' => 0,
+ 'store_id' => $order['store_id'],
+ 'number' => $user_number,
+ ];
+ $user_sing->save($sing);
+ $now_int = User::where('id',$order['uid'])->find();
+ if($now_int){
+ if($now_int['integral'] > $user_number){
+ User::where('id',$order['uid'])->dec('integral',$user_number)->update();
+ }else{
+ User::where('id',$order['uid'])->dec('integral',$now_int['integral'])->update();
+ }
+
+ }
+ }
+ return true;
+
+ }
+
+
+
+ /**
+ * 财务退还金额相关
+ * @param $orderSn
+ * @return void
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public static function store_finance_back($orderSn)
+ {
+ $data = StoreFinanceFlow::where('order_sn', $orderSn)
+ ->where(['financial_pm' => 1])
+ ->select()->toArray();
+ foreach ($data as &$value) {
+ unset($value['id']);
+ $value['financial_record_sn'] = (new StoreFinanceFlowLogic)->getSn();
+ $value['financial_pm'] = 0;
+ $value['financial_type'] = OrderEnum::PAY_BACK;
+ $value['create_time'] = time();
+ }
+ (new StoreFinanceFlow)->saveAll($data);
+ }
+
+ /**
+ * 现金退款相关
+ * @param $orderSn
+ * @param $extra
+ * @return true
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public static function cash_refund($orderSn, $extra = [])
+ {
+ $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
+ if ($order->isEmpty() || $order->status == OrderEnum::REFUND_PAY) {
+ return true;
+ }
+ $order->refund_status = OrderEnum::REFUND_STATUS_FINISH;
+ $order->refund_price = $order->pay_price;
+ $order->refund_reason_time = time();
+ $order->refund_num += 1;
+ $order->save();
+ //日志记录
+ $model = new StoreCashFinanceFlow();
+ $model->store_id = $order['store_id'] ?? 0;
+ $model->cash_price = $order->pay_price;
+ $model->receivable = $order->pay_price;
+ $model->remark = '退款';
+ $model->type = 1;
+ $model->status = YesNoEnum::YES;
+ $model->save();
+ //增加数量
+ self::addStock($order['id']);
+ return true;
+ }
+
+ /**
+ * 充值现金退款相关
+ * @param $orderId
+ * @param $extra
+ * @return true
+ */
+ public static function recharge_cash_refund($orderId, $extra = [])
+ {
+ $order = UserRecharge::where('id', $orderId)->findOrEmpty();
+ if ($order->isEmpty() || $order->status == -1) {
+ return true;
+ }
+ $order->status = -1;
+ $order->refund_price = $order->price;
+ $order->refund_time = time();
+ $order->remarks = '';
+ $order->save();
+ return true;
+ }
+
+ //入冻结礼品券
+ public static function addUserSing($order)
+ {
+ $user_sing = new UserSign();
+ if ($order['uid'] > 0 && $order['total_price'] >= 500) {
+ $user_number = bcmul($order['pay_price'], '0.10', 2);
+ $sing = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '购买商品获得兑换券',
+ 'financial_pm' => 1,
+ 'store_id' => $order['store_id'],
+ 'number' => $user_number,
+ ];
+ $user_sing->save($sing);
+ }
+ return true;
+ }
+
+
+ /**
+ * 充值
+ */
+ public static function recharge($orderSn, $extra = [], $type = 'wechat')
+ {
+ $order = UserRecharge::where('order_id', $orderSn)->findOrEmpty();
+ if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) {
+ return true;
+ }
+ if ($type == 'wechat') {
+ $price = bcdiv($extra['amount']['payer_total'], 100, 2);
+ } else {
+ $price = $extra['buyer_pay_amount'];
+ }
+ $order->price = $price;
+ $order->paid = 1;
+ $order->pay_time = time();
+ $order->save();
+ $uid = $order->uid;
+ $user = User::where('id', $uid)->findOrEmpty();
+ //用户的财务add
+ $capitalFlowDao = new CapitalFlowLogic($user);
+ $capitalFlowDao->userIncome('user_balance_recharge', 'user_recharge', $order['id'], $price);
+
+ if ($user->isEmpty()) {
+ return true;
+ }
+ bcscale(2);
+ // $user->now_money = bcadd($user->now_money, $price, 2);//v.1
+ //更新等级
+ if ($price >= Config::where('name','recharge')->value('value')) {
+ $user->user_ship = 1; //v.1
+ }
+ $user->purchase_funds = bcadd($user->purchase_funds, $price, 2);
+ $user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2);
+ $user->save();
+ if($order['other_uid']>0){
+ $uid=$order['other_uid'];
+ }
+ PushService::push('wechat_mmp_' . $uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]);
+ PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]);
+ if (!empty($extra['payer']['openid'])) {
+ Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 3], 4);
+ }
+ return true;
+ }
+
+ /**
+ * 现金支付
+ */
+ public static function cash_pay($orderSn)
+ {
+ $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
+
+ if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) {
+ return true;
+ }
+ $order->paid = 1;
+ $order->pay_time = time();
+ $order->status = 2;
+ if (!$order->save()) {
+ throw new \Exception('订单保存出错');
+ }
+ self::afterPay($order);
+ $cashFlowLogic = new CashFlowLogic();
+ $cashFlowLogic->insert($order['store_id'], $order['pay_price']);
+ self::dealProductLog($order);
+ if ($order['shipping_type'] == 3) {
+ self::descStock($order['id']);
+ }
+ // Redis::send('push-platform-print', ['id' => $order['id']]);
+ return true;
+ }
+
+ /**
+ * @notes 阿里回调
+ * @param $orderSn
+ * @param array $extra
+ * @author 段誉
+ * @date 2023/2/27 15:28
+ */
+ public static function alipay_cashier($orderSn, $extra = [])
+ {
+ $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty();
+
+ if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) {
+ return true;
+ }
+ if ($order->pay_type != 10) {
+ $order->money = $extra['buyer_pay_amount'];
+ $order->paid = 1;
+ $order->pay_time = time();
+ $order->status = 1;
+ $order->save();
+ } else {
+ $extra['transaction_id'] = time();
+ }
+ if ($order->pay_type == 9) {
+ $order->status = 2;
+ self::afterPay($order);
+ }
+ self::dealProductLog($order);
+ if ($order['shipping_type'] == 3) {
+ self::descStock($order['id']);
+ }
+
+ // if ($order->pay_type == 9) {
+ // $extra['create_time'] = $order['create_time'];
+ // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
+ // Redis::send('push-platform-print', ['id' => $order['id']]);
+ // }
+ // else {
+ // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
+ // }
+ return true;
+ }
+
+ /**
+ * 支付后逻辑
+ * @param $order
+ * @return void
+ */
+ public static function afterPay($order, $transaction_id = 0)
+ {
+ $financeLogic = new StoreFinanceFlowLogic();
+ $user_sing = new UserSign();
+ $off_activity = Config::where('name', 'off_activity')->value('value');
+ if ($off_activity == 1) {
+ //-----活动价结算更改
+ $financeLogic->order = $order;
+ $financeLogic->user = ['uid' => $order['uid']];
+ $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付
+ $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']);
+ if ($order['uid'] > 0 && $order['total_price'] > 500 && $order['pay_type'] !=18
+ && $order['pay_type'] !=3) {
+ $user_number = bcmul($order['pay_price'], '0.10', 2);
+ $sing = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '购买商品获得兑换券',
+ 'financial_pm' => 1,
+ 'store_id' => $order['store_id'],
+ 'number' => $user_number,
+ ];
+ $user_sing->save($sing);
+ }
+ return false;
+ }
+ $vipFen = 0;
+ if ($order['uid'] > 0) {
+ // 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去
+ //用户下单该用户等级为1得时候才处理冻结金额
+ $user = User::where('id', $order['uid'])->find();
+ //纯在分销关系的时候要去判断分销出来的用户的采购款的额度 (只有会员按照这个逻辑拆分,其余的还是按照正常的支付金额)
+ if ($order['spread_uid'] > 0) {
+ $oldUser = User::where('id', $order['spread_uid'])->field('purchase_funds,user_ship')->find();
+ if ($oldUser && $oldUser['user_ship'] == 1) {
+ if ($oldUser['purchase_funds'] < $order['pay_price']) {
+ $vipFen = $oldUser['purchase_funds'];
+ }
+ }
+ } elseif ($user['user_ship'] == 1 && $order['pay_type'] != PayEnum::CASH_PAY) {
+ $vipFrozenAmount = self::dealFrozenPrice($order['id']);
+ //为1的时候要去减活动价
+ // $final_price = bcsub($order['pay_price'],$order['deduction_price'],2);
+ // d($final_price,$vipFrozenAmount);
+ $order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2);
+ self::dealVipAmount($order, $order['pay_type']);
+ }
+ if($order['total_price'] > 500 && $order['pay_type'] !=18
+ && $order['pay_type'] !=3){
+ $user_number = bcmul($order['pay_price'], '0.10', 2);
+ $sing = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '购买商品获得兑换券',
+ 'financial_pm' => 1,
+ 'store_id' => $order['store_id'],
+ 'number' => $user_number,
+ 'status' => 0,
+ ];
+ $user_sing->save($sing);
+ }
+
+ // User::where('id', $order['uid'])->inc('integral', $user_number)->update();
+ }
+
+
+ $financeLogic->order = $order;
+ $financeLogic->user = ['uid' => $order['uid']];
+ // if ($order->pay_type != 9 || $order->pay_type != 10) {
+ $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付
+ $count_frees = 0;
+
+ //平台手续费
+ $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2);
+ $count_frees = bcadd($count_frees, $fees, 2);
+ if ($fees > 0) {
+ $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
+ $financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出
+ }
+ // $frozen = bcsub($order->profit, $fees, 2);
+ //缴纳齐全了就加商户没有就加到平台
+ $money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find();
+ $deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度
+ $store_profit = bcdiv(bcmul($order['pay_price'], '0.05', 2), 1, 2);
+ $count_frees = bcadd($count_frees, $store_profit, 2);
+ if ($deposit > 0) {
+ if ($deposit > $store_profit) {
+ if ($store_profit > 0) {
+ SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $store_profit)->update();
+ $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
+ $financeLogic->in($transaction_id, 0, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
+ }
+ } else {
+ $money = bcsub($store_profit, $deposit, 2);
+ if ($deposit > 0) {
+ SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $deposit)->update();
+ $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
+ }
+ if ($money) {
+ SystemStore::where('id', $order['store_id'])->inc('store_money', $money)->update();
+ $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
+ }
+ }
+ } else {
+ if ($store_profit > 0) {
+ SystemStore::where('id', $order['store_id'])->inc('store_money', $store_profit)->update();
+ $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
+ }
+ }
+ // if ($order['is_vip'] >= 1) {
+ if ($order['spread_uid'] > 0) {
+ $financeLogic->other_arr['vip_uid'] = $order['spread_uid'];
+ if ($vipFen) {
+ $fees = bcdiv(bcmul($vipFen, '0.08', 2), 1, 2);
+ } else {
+ $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2);
+ }
+ $count_frees = bcadd($count_frees, $fees, 2);
+ if ($fees > 0) {
+ User::where('id', $order['spread_uid'])->inc('now_money', $fees)->update();
+ //记录用户余额收入
+ $GiveUser = User::where('id', $order['spread_uid'])->find();
+ $capitalFlowDao = new CapitalFlowLogic($GiveUser);
+ $capitalFlowDao->userIncome('system_balance_add', 'order', $order['id'], $fees);
+
+ $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //vip订单获得
+ $financeLogic->out($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
+ }
+ }
+ $fees = bcdiv(bcmul($order['pay_price'], '0.01', 2), 1, 2);
+ $count_frees = bcadd($count_frees, bcmul($fees, 3, 2), 2);
+ $village_uid = 0;
+ $brigade_uid = 0;
+ //查询用户对应的村长和队长
+ if ($order['uid'] > 0) {
+ $address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find();
+ if ($address) {
+ $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid');
+ if ($arr1) {
+ $uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id');
+ if ($uid) {
+ User::where('id', $uid)->inc('integral', $fees)->update();
+ $village_uid = $uid;
+ }
+ }
+ $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid');
+ if ($arr2) {
+ $uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id');
+ if ($uid) {
+ User::where('id', $uid)->inc('integral', $fees)->update();
+ $brigade_uid = $uid;
+ }
+ }
+ }
+ }
+ if ($fees > 0) {
+ //村长获得
+ // $sing = [];
+
+ // $sing[] = [
+ // 'uid' => $village_uid,
+ // 'order_id' => $order['order_id'],
+ // 'title' => '村长订单获得兑换券',
+ // 'store_id' => $order['store_id'],
+ // 'number' => $fees,
+ // 'financial_pm' => 1,
+ // 'user_ship' => 2,
+ // ];
+ // $sing[] = [
+ // 'uid' => $brigade_uid,
+ // 'order_id' => $order['order_id'],
+ // 'title' => '队长订单获得兑换券',
+ // 'store_id' => $order['store_id'],
+ // 'number' => $fees,
+ // 'financial_pm' => 1,
+ // 'user_ship' => 3,
+ // ];
+ // $sing[] = [
+ // 'uid' => $village_uid,
+ // 'order_id' => $order['order_id'],
+ // 'title' => '订单扣除兑换券',
+ // 'store_id' => $order['store_id'],
+ // 'number' => $fees,
+ // 'financial_pm' => 0,
+ // 'user_ship' => 2,
+ // ];
+ // $sing[] = [
+ // 'uid' => $brigade_uid,
+ // 'order_id' => $order['order_id'],
+ // 'title' => '订单扣除兑换券',
+ // 'store_id' => $order['store_id'],
+ // 'number' => $fees,
+ // 'financial_pm' => 0,
+ // 'user_ship' => 3,
+ // ];
+ if ($village_uid > 0) {
+ SystemStore::where('id', $village_uid)->inc('store_money', $fees)->update();
+ $financeLogic->other_arr['vip_uid'] = $village_uid;
+ }
+ $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
+ $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
+ //队长获得
+ if ($brigade_uid > 0) {
+ SystemStore::where('id', $brigade_uid)->inc('store_money', $fees)->update();
+ $financeLogic->other_arr['vip_uid'] = $brigade_uid;
+ }
+ $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
+ $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
+ // $user_sing->saveAll($sing);
+ //其他获得
+ $financeLogic->other_arr['vip_uid'] = 0;
+ $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
+ $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
+ }
+ // }
+ $fees = bcsub($order['pay_price'], $count_frees, 2);
+ //供应链订单获得
+ if ($fees > 0) {
+ $financeLogic->in($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
+ $financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
+ }
+ // }
+ $financeLogic->save();
+ // }
+ }
+
+ /**
+ * 回调日志
+ * @param $order
+ * @param $extra
+ * @return void
+ */
+ public static function notifyLog($order, $extra)
+ {
+ $data = [
+ 'pay_type' => 'wechat',
+ 'type' => OrderEnum::PAY,
+ 'amount' => $extra['amount']['payer_total'], //分
+ 'order_sn' => $order,
+ 'out_trade_no' => $extra['transaction_id'],
+ 'attach' => $extra['attach'],
+ 'create_time' => date('Y-m-d H:i:s', time()),
+ ];
+ PayNotify::create($data);
+ }
+
+ /**
+ * 冻结金额
+ * @param $oid
+ * @return int|mixed
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+
+ public static function dealFrozenPrice($oid)
+ {
+ $detail = StoreOrderCartInfo::where('oid', $oid)->select()->toArray();
+ $total_vip = 0;
+ foreach ($detail as $value) {
+ $total_vip += $value['cart_info']['vip_frozen_price'];
+ }
+ return $total_vip;
+ }
+
+
+ /**
+ * 处理用户为vip1时得冻结资金
+ * @param $order
+ * @param $pay_type
+ * @param $transaction_id
+ * @return true
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public static function dealVipAmount($order, $pay_type = 1, $transaction_id = 0)
+ {
+ $total_vip = self::dealFrozenPrice($order['id']);
+ $data = [
+ 'order_id' => $order['id'],
+ 'transaction_id' => $transaction_id ?? 0,
+ 'order_sn' => $order['order_id'],
+ 'user_id' => $order['uid'],
+ 'number' => $total_vip,
+ 'pay_type' => $pay_type ?? 1,
+ 'status' => 0,
+ 'store_id' => $order['store_id'],
+ 'staff_id' => $order['staff_id'],
+ 'create_time' => time()
+ ];
+ Db::name('vip_flow')->insert($data);
+ return true;
+ }
+
+ /**
+ * 商品统计逻辑
+ * @param $order
+ * @return true
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public static function dealProductLog($order)
+ {
+ $store_id = $order['store_id'];
+ $cart_id = $order['cart_id'];
+ $uid = $order['uid'];
+ if ($uid && $cart_id && $store_id) {
+ $cart_id = explode(',', $cart_id);
+ $productLog = StoreProductLog::where([
+ 'uid' => $uid
+ ])->whereIn('cart_id', $cart_id)
+ ->select()->toArray();
+
+ foreach ($productLog as &$value) {
+ $value['pay_uid'] = $uid;
+ $value['oid'] = $order['id'];
+ $cart_info = StoreOrderCartInfo::where([
+ 'uid' => $uid, 'old_cart_id' => $value['cart_id'], 'store_id' => $store_id
+ ])->find();
+ $value['order_num'] = $cart_info['cart_num'] ?? 1;
+ $value['pay_num'] = $cart_info['cart_num'] ?? 1;
+ $value['pay_price'] = $cart_info['price'] ?? 0;
+ $value['cost_price'] = $cart_info['cart_info']['cost'] ?? 0;
+ $value['update_time'] = time();
+ unset($value['create_time'], $value['delete_time']);
+ }
+
+ (new StoreProductLog())->saveAll($productLog);
+ }
+ return true;
+ }
+
+
+ public static function descSwap($oid)
+ {
+ $updateData = [];
+ $goods_list = StoreOrderCartInfo::where('oid', $oid)->select()->toArray();
+ foreach ($goods_list as $v) {
+ $StoreBranchProduct = StoreBranchProduct::where(
+ [
+ 'store_id' => $v['store_id'],
+ 'product_id' => $v['product_id'],
+ ]
+ )->withTrashed()->find();
+ $updateData[] = [
+ 'id' => $StoreBranchProduct['id'],
+ 'swap' => $StoreBranchProduct['swap'] - $v['cart_num'],
+ 'sales' => ['inc', $v['cart_num']]
+ ];
+ }
+
+ (new StoreBranchProduct())->saveAll($updateData);
+ }
+
+
+ /**
+ * 扣库存
+ * @param $oid
+ * @return void
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public static function descStock($oid)
+ {
+ $updateData = [];
+ $goods_list = StoreOrderCartInfo::where('oid', $oid)->select()->toArray();
+ foreach ($goods_list as $v) {
+ $StoreBranchProduct = StoreBranchProduct::where(
+ [
+ 'store_id' => $v['store_id'],
+ 'product_id' => $v['product_id'],
+ ]
+ )->withTrashed()->find();
+ if ($StoreBranchProduct) {
+ $updateData[] = [
+ 'id' => $StoreBranchProduct['id'],
+ 'stock' => $StoreBranchProduct['stock'] - $v['cart_num'],
+ 'sales' => ['inc', $v['cart_num']]
+ ];
+ }
+ }
+
+ (new StoreBranchProduct())->saveAll($updateData);
+ }
+
+ /**
+ * 加库存
+ * @param $oid
+ * @return void
+ * @throws \think\db\exception\DataNotFoundException
+ * @throws \think\db\exception\DbException
+ * @throws \think\db\exception\ModelNotFoundException
+ */
+ public static function addStock($oid)
+ {
+ $updateData = [];
+ $goods_list = StoreOrderCartInfo::where('oid', $oid)->select()->toArray();
+ foreach ($goods_list as $v) {
+ $StoreBranchProduct = StoreBranchProduct::where(
+ [
+ 'store_id' => $v['store_id'],
+ 'product_id' => $v['product_id'],
+ ]
+ )->withTrashed()->find();
+ if ($StoreBranchProduct) {
+ $updateData[] = [
+ 'id' => $StoreBranchProduct['id'],
+ 'stock' => $StoreBranchProduct['stock'] + $v['cart_num'],
+ // 'sales' => ['inc', $v['cart_num']]
+ // 'sales' => ['inc', $v['cart_num']]
+ ];
+ }
+ }
+
+ (new StoreBranchProduct())->saveAll($updateData);
+ }
+}
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 5d808912e..d98d02b16 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -586,19 +586,6 @@ class PayNotifyLogic extends BaseLogic
$financeLogic = new StoreFinanceFlowLogic();
$user_sing = new UserSign();
$off_activity = Config::where('name', 'off_activity')->value('value');
- try{
- $url=getenv('WETCHA_PUSH');
- if($url){
- $order_id=$order['order_id'];
- $pay_price=$order['pay_price'];
- $arr=["msgtype"=>"markdown","markdown"=>["content"=> "有新的订单请及时跟踪\n
- >单号:$order_id
- >金额:$pay_price"]];
- (new Curl())->post($url,$arr);
- }
- }catch(\Exception $e){
- Log::error('推送订单失败',['order_id'=>$order['id'],'error'=>$e->getMessage()]);
- }
if ($off_activity == 1) {
//-----活动价结算更改
$financeLogic->order = $order;
@@ -683,46 +670,35 @@ class PayNotifyLogic extends BaseLogic
if ($deposit > 0) {
if ($deposit > $store_profit) {
if ($store_profit > 0) {
- SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $store_profit)->update();
+ // SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $store_profit)->update();
$financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
$financeLogic->in($transaction_id, 0, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
}
} else {
$money = bcsub($store_profit, $deposit, 2);
if ($deposit > 0) {
- SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $deposit)->update();
+ // SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $deposit)->update();
$financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
}
if ($money) {
- SystemStore::where('id', $order['store_id'])->inc('store_money', $money)->update();
+ // SystemStore::where('id', $order['store_id'])->inc('store_money', $money)->update();
$financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
}
}
} else {
if ($store_profit > 0) {
- SystemStore::where('id', $order['store_id'])->inc('store_money', $store_profit)->update();
+ // SystemStore::where('id', $order['store_id'])->inc('store_money', $store_profit)->update();
$financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费
}
}
// if ($order['is_vip'] >= 1) {
if ($order['spread_uid'] > 0) {
- $financeLogic->other_arr['vip_uid'] = $order['spread_uid'];
if ($vipFen) {
$fees = bcdiv(bcmul($vipFen, '0.08', 2), 1, 2);
} else {
$fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2);
}
$count_frees = bcadd($count_frees, $fees, 2);
- if ($fees > 0) {
- User::where('id', $order['spread_uid'])->inc('now_money', $fees)->update();
- //记录用户余额收入
- $GiveUser = User::where('id', $order['spread_uid'])->find();
- $capitalFlowDao = new CapitalFlowLogic($GiveUser);
- $capitalFlowDao->userIncome('system_balance_add', 'order', $order['id'], $fees);
-
- $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //vip订单获得
- $financeLogic->out($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
- }
}
$fees = bcdiv(bcmul($order['pay_price'], '0.01', 2), 1, 2);
$count_frees = bcadd($count_frees, bcmul($fees, 3, 2), 2);
@@ -736,7 +712,7 @@ class PayNotifyLogic extends BaseLogic
if ($arr1) {
$uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id');
if ($uid) {
- User::where('id', $uid)->inc('integral', $fees)->update();
+ // User::where('id', $uid)->inc('integral', $fees)->update();
$village_uid = $uid;
}
}
@@ -744,7 +720,7 @@ class PayNotifyLogic extends BaseLogic
if ($arr2) {
$uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id');
if ($uid) {
- User::where('id', $uid)->inc('integral', $fees)->update();
+ // User::where('id', $uid)->inc('integral', $fees)->update();
$brigade_uid = $uid;
}
}
@@ -791,14 +767,14 @@ class PayNotifyLogic extends BaseLogic
// 'user_ship' => 3,
// ];
if ($village_uid > 0) {
- SystemStore::where('id', $village_uid)->inc('store_money', $fees)->update();
+ // SystemStore::where('id', $village_uid)->inc('store_money', $fees)->update();
$financeLogic->other_arr['vip_uid'] = $village_uid;
}
$financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
$financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
//队长获得
if ($brigade_uid > 0) {
- SystemStore::where('id', $brigade_uid)->inc('store_money', $fees)->update();
+ // SystemStore::where('id', $brigade_uid)->inc('store_money', $fees)->update();
$financeLogic->other_arr['vip_uid'] = $brigade_uid;
}
$financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php
index a65052b9a..299b9e05d 100644
--- a/app/common/logic/StoreFinanceFlowLogic.php
+++ b/app/common/logic/StoreFinanceFlowLogic.php
@@ -5,6 +5,7 @@ namespace app\common\logic;
use app\common\enum\OrderEnum;
use app\common\enum\PayEnum;
use app\common\model\store_finance_flow\StoreFinanceFlow;
+use app\common\model\system_store\SystemStore;
use app\common\model\user\User;
class StoreFinanceFlowLogic extends BaseLogic
@@ -128,7 +129,7 @@ class StoreFinanceFlowLogic extends BaseLogic
}
/**
- * 核销后更新余额
+ * 核销后更新用户余额
*/
public function updateStatusUser($id,$uid,$money,$order_id){
StoreFinanceFlow::where('id', $id)->update(['status' => 1]);
@@ -137,6 +138,17 @@ class StoreFinanceFlowLogic extends BaseLogic
$capitalFlowDao->userIncome('system_balance_add', 'order', $order_id, $money);
$find->inc('now_money',$money)->update();
}
-
+ /**
+ * 核销后更新门店余额
+ */
+ public function updateStatusStore($id,$store_id,$money,$deposit){
+ StoreFinanceFlow::where('id', $id)->update(['status' => 1]);
+ if($money){
+ SystemStore::where('id', $store_id)->inc('store_money', $money)->update();
+ }
+ if($deposit){
+ SystemStore::where('id', $store_id)->inc('paid_deposit', $deposit)->update();
+ }
+ }
}
From 5113989f7bd492a20630c269f602671abcdf6ffa Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 17:13:48 +0800
Subject: [PATCH 22/53] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86=20Sto?=
=?UTF-8?q?reProductLists.php=20=E4=B8=AD=E7=9A=84=E6=9F=A5=E8=AF=A2?=
=?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E4=BD=BF=E5=85=B6=E6=9B=B4=E5=8A=A0?=
=?UTF-8?q?=E7=81=B5=E6=B4=BB=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/admin/lists/store_product/StoreProductLists.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php
index ceabcc76b..cdaa4ba66 100644
--- a/app/admin/lists/store_product/StoreProductLists.php
+++ b/app/admin/lists/store_product/StoreProductLists.php
@@ -65,8 +65,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
$item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name');
$item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name');
return $item;
- })
- ->toArray();
+ })?->toArray();
}
From 6cb0bb359a5aa9420687bc73535c235536ac708b Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 17:28:10 +0800
Subject: [PATCH 23/53] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=AE=A2?=
=?UTF-8?q?=E5=8D=95=E9=80=BB=E8=BE=91=E5=92=8C=E9=97=A8=E5=BA=97=E8=B4=A2?=
=?UTF-8?q?=E5=8A=A1=E6=B5=81=E6=B0=B4=E9=80=BB=E8=BE=91=E4=BB=A5=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E6=A0=B8=E9=94=80=E6=B5=81=E7=A8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 8 ++++----
app/common/logic/StoreFinanceFlowLogic.php | 5 +++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 50ebcfd5e..f1d156db3 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -449,14 +449,14 @@ class OrderLogic extends BaseLogic
UserSign::where(['uid' => $order['uid'],'order_id' => $order['order_id']])->update(['status'=>1]);
}
if ($order['spread_uid'] > 0) {
- $spread_number=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>12,'other_uid'=>$order['spread_uid']])->value('number');
- if($spread_number){
- $financeFlowLogic->updateStatusUser($v['id'],$order['spread_uid'],$spread_number,$v['order_id']);
+ $spread_find=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>12,'other_uid'=>$order['spread_uid']])->find();
+ if($spread_find){
+ $financeFlowLogic->updateStatusUser($spread_find['id'],$order['spread_uid'],$spread_find['number'],$order['order_id']);
}
}
$deposit=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>11])->value('number');
$money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number');
- $financeFlowLogic->updateStatusStore($v['id'],$order['store_id'],$money,$deposit);
+ $financeFlowLogic->updateStatusStore($order['id'],$order['store_id'],$money,$deposit);
Db::commit();
return true;
diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php
index 299b9e05d..f5bb794f9 100644
--- a/app/common/logic/StoreFinanceFlowLogic.php
+++ b/app/common/logic/StoreFinanceFlowLogic.php
@@ -141,8 +141,9 @@ class StoreFinanceFlowLogic extends BaseLogic
/**
* 核销后更新门店余额
*/
- public function updateStatusStore($id,$store_id,$money,$deposit){
- StoreFinanceFlow::where('id', $id)->update(['status' => 1]);
+ public function updateStatusStore($order_id,$store_id,$money,$deposit){
+ StoreFinanceFlow::where(['order_id'=>$order_id,'financial_pm'=>1,'financial_type'=>11])->update(['status' => 1]);
+ StoreFinanceFlow::where(['order_id'=>$order_id,'financial_pm'=>1,'financial_type'=>2])->update(['status' => 1]);
if($money){
SystemStore::where('id', $store_id)->inc('store_money', $money)->update();
}
From dbeaf6d96a5c122e6994c4208f71d0d468df3520 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 17:40:03 +0800
Subject: [PATCH 24/53] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=B4=A2?=
=?UTF-8?q?=E5=8A=A1=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic copy.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/common/logic/PayNotifyLogic copy.php b/app/common/logic/PayNotifyLogic copy.php
index fac778279..a03f8fd3e 100644
--- a/app/common/logic/PayNotifyLogic copy.php
+++ b/app/common/logic/PayNotifyLogic copy.php
@@ -601,6 +601,7 @@ class PayNotifyLogic extends BaseLogic
];
$user_sing->save($sing);
}
+ $financeLogic->save();
return false;
}
$vipFen = 0;
From a7ba0955d95a488195f4c3e51915a42d847b4a8f Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 17:43:46 +0800
Subject: [PATCH 25/53] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=B4=A2?=
=?UTF-8?q?=E5=8A=A1=E9=80=BB=E8=BE=91=E4=BF=9D=E5=AD=98=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index d98d02b16..d704c2c4a 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -593,6 +593,7 @@ class PayNotifyLogic extends BaseLogic
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付
$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'] !=18
&& $order['pay_type'] !=3) {
$user_number = bcmul($order['pay_price'], '0.10', 2);
From 1cbb200ed20fedb01c484f5afb18ff140db8bf30 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 17:51:39 +0800
Subject: [PATCH 26/53] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=87=87=E8=B4=AD?=
=?UTF-8?q?=E6=AC=BE=E5=86=BB=E7=BB=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 164 ++++++++++++++++++++++++++++
1 file changed, 164 insertions(+)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 5d808912e..4a7d769ce 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -25,6 +25,7 @@ use app\common\model\user\UserAddress;
use app\common\model\user\UserRecharge;
use app\common\model\user\UserShip;
use app\common\model\user_sign\UserSign;
+use app\common\model\vip_flow\VipFlow;
use app\common\service\Curl;
use app\common\service\PushService;
use support\Log;
@@ -212,6 +213,147 @@ class PayNotifyLogic extends BaseLogic
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
// PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
+ }
+
+ //采购款支付后如果有对应的冻结的话就去反对应的log
+ public static function addFlowLog($order)
+ {
+ //查询当前用户有无对应的充值的冻结金额
+ if($order['uid'] >0 ){
+ $query = VipFlow::where([
+ 'user_id'=>$order['uid'],
+ 'type'=>2,
+ 'status'=>0
+ ]);
+ $query1 = clone $query;
+ $ids = $query->column('id');
+ $check = $query->sum('back_num');
+ $count = $query1->count();
+ if($check && $check >0){
+ $backPurchase = bcsub($order['pay_price'],0.1,2);
+ if($count == 1){
+ //存在拆单子否
+ //少了就冻结减去这个对应的金额
+ $one = VipFlow::where([
+ 'user_id'=>$order['uid'],
+ 'type'=>2,
+ 'status'=>0
+ ])->find();
+ $data = [
+ 'vip_flow_id'=>$one['id'],
+ 'order_id' => $order['id'],
+ 'order_sn' => $order['order_id'],
+ 'user_id' => $order['uid'],
+ 'pay_type' => $pay_type ?? 1,
+ 'status' => 1,
+ 'type' => 1,
+ 'store_id' => $order['store_id'],
+ 'staff_id' => $order['staff_id'],
+ 'create_time' => time()
+ ];
+ if($one['back_num'] >= $backPurchase){
+ $data['number'] =$backPurchase;
+ Db::name('la_vip_flow_log')->insert($data);
+ //总的减去采购款百分之十剩余的
+ $wait = bcsub($one['back_num'],$backPurchase,2);
+ if(empty($wait)){
+ VipFlow::where('id',$one['id'])->update(
+ [
+ 'back_num'=>0,
+ 'status'=>1
+ ]
+ );
+ }else{
+ //add
+ VipFlow::where('id',$one['id'])->update([
+ [
+ 'back_num'=>$wait
+ ]
+ ]);
+ }
+ //并且加到对应的用户的采购款中
+ User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
+ }else{
+ //对比采购款支付的多少 多了就拿冻结金额即可
+ $data['number'] =$one['number'];
+ //都存到对应的log日志
+ Db::name('la_vip_flow_log')->insert($data);
+ VipFlow::where('id',$one['id'])->update(
+ [
+ 'back_num'=>0,
+ 'status'=>1
+ ]
+ );
+ //并且加到对应的用户的采购款中
+ User::where('id',$order['uid'])->inc('purchase_funds',$one['number'])->update();
+ }
+
+ }else{
+ //大于0的时候
+ //先处理金额大的再处理剩余的
+ /**** 把所有的金额改为正的再加一条后再加***/
+ VipFlow::where([
+ 'user_id'=>$order['uid'],
+ 'type'=>2,
+ 'status'=>0
+ ])->update([
+ 'status'=>1,
+ 'remark'=>json_encode($ids)
+ ]);
+ if ($check >= $backPurchase) {
+ //补一条待解冻的
+// $data = [
+// 'order_id' => $order['id'],
+// 'transaction_id' => $transaction_id ?? 0,
+// 'order_sn' => $order['order_id'],
+// 'user_id' => $order['uid'],
+// 'number' => $total_vip,
+// 'back_num' => $total_vip,
+// 'pay_type' => $pay_type ?? 1,
+// 'status' => 0,
+// 'type' => 1,
+// 'store_id' => $order['store_id'],
+// 'staff_id' => $order['staff_id'],
+// 'create_time' => time()
+// ];
+// Db::name('vip_flow')->insert($data);
+
+ }else{
+ //log
+ $data = [
+ 'vip_flow_id'=>0,
+ 'remark'=>$ids,
+ 'order_id' => $order['id'],
+ 'order_sn' => $order['order_id'],
+ 'user_id' => $order['uid'],
+ 'pay_type' => $pay_type ?? 1,
+ 'status' => 1,
+ 'type' => 1,
+ 'store_id' => $order['store_id'],
+ 'staff_id' => $order['staff_id'],
+ 'create_time' => time()
+ ];
+ $data['number'] =$check;
+ Db::name('la_vip_flow_log')->insert($data);
+ User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
+ }
+
+
+
+
+
+ }
+
+ }
+ return true;
+
+ }
+
+
+
+
+
+
}
/**
@@ -453,6 +595,27 @@ class PayNotifyLogic extends BaseLogic
return true;
}
+ public static function dealRechargeFrozen($order)
+ {
+ $total_vip = bcmul($order['price'],0.1,2);
+ $data = [
+ 'order_id' => $order['id'],
+ 'transaction_id' => $transaction_id ?? 0,
+ 'order_sn' => $order['order_id'],
+ 'user_id' => $order['uid'],
+ 'number' => $total_vip,
+ 'back_num' => $total_vip,
+ 'pay_type' => $pay_type ?? 1,
+ 'status' => 0,
+ 'type' => 1,
+ 'store_id' => $order['store_id'],
+ 'staff_id' => $order['staff_id'],
+ 'create_time' => time()
+ ];
+ Db::name('vip_flow')->insert($data);
+ return true;
+ }
+
/**
* 充值
@@ -498,6 +661,7 @@ class PayNotifyLogic extends BaseLogic
if($order['other_uid']>0){
$uid=$order['other_uid'];
}
+ self::dealRechargeFrozen($order);
PushService::push('wechat_mmp_' . $uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]);
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]);
if (!empty($extra['payer']['openid'])) {
From 3e9a1e7f74588c50c9cb3099cdab372c49095f74 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 17:56:50 +0800
Subject: [PATCH 27/53] =?UTF-8?q?feat(CartList):=20=E8=B4=AD=E7=89=A9?=
=?UTF-8?q?=E8=BD=A6API=E5=A2=9E=E5=8A=A0=E6=BB=A1=E9=A2=9D=E4=BC=98?=
=?UTF-8?q?=E6=83=A0=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/lists/order/CartList.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php
index de0fc8e24..b5ffd0813 100644
--- a/app/api/lists/order/CartList.php
+++ b/app/api/lists/order/CartList.php
@@ -108,7 +108,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
$data= [
'off_activity' => $this->off_activity,
'total_price' => $this->total_price,
- 'msg' => '',
+ 'msg' => '您已选购满500元,支付后可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品券',
'pay_price' => $this->total_price
];
if($this->off_activity==1){
@@ -116,6 +116,8 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
if($this->activity_price<500){
$data['msg']='还差'.bcsub(500,$this->activity_price,2).'元可获得10%品牌礼品券';
$data['pay_price']= $this->activity_price;
+ }else{
+ $data['msg']= '您已选购满500元,支付后可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品券';
}
}
return $data;
From 5d2719c8f7fd8d357341145caa3a32c23d8ebb8f Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 18:00:04 +0800
Subject: [PATCH 28/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=B9=E6=B4=BB?=
=?UTF-8?q?=E5=8A=A8=E5=8A=A0=E5=85=91=E6=8D=A2=E5=88=B8=E7=9A=84=E9=80=BB?=
=?UTF-8?q?=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 1dc074f92..0d00a6857 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -349,10 +349,6 @@ class PayNotifyLogic extends BaseLogic
}
-
-
-
-
}
@@ -794,8 +790,7 @@ class PayNotifyLogic extends BaseLogic
$order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2);
self::dealVipAmount($order, $order['pay_type']);
}
- if($order['total_price'] > 500 && $order['pay_type'] !=18
- && $order['pay_type'] !=3){
+ if($order['total_price'] >= 500 ){
$user_number = bcmul($order['pay_price'], '0.10', 2);
$sing = [
'uid' => $order['uid'],
From bc6855fc7c3cfa5856e4fa77412d08b669ee8b8d Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 18:23:00 +0800
Subject: [PATCH 29/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E5=85=A5?=
=?UTF-8?q?=E5=86=BB=E7=BB=93=E5=85=91=E6=8D=A2=E5=88=B8=E4=B8=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 117 +++++++++++++---------------
1 file changed, 52 insertions(+), 65 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 0d00a6857..311be253b 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -206,6 +206,7 @@ class PayNotifyLogic extends BaseLogic
OrderLogic::writeOff($params);
}
self::dealProductLog($order);
+ self::addFlowLog($order);
// if($order['shipping_type'] == 3){
// self::descStock($order['id']);
// }
@@ -220,9 +221,9 @@ class PayNotifyLogic extends BaseLogic
{
//查询当前用户有无对应的充值的冻结金额
if($order['uid'] >0 ){
- $query = VipFlow::where([
+ $query = UserSign::where([
'user_id'=>$order['uid'],
- 'type'=>2,
+ 'type'=>1,
'status'=>0
]);
$query1 = clone $query;
@@ -234,30 +235,27 @@ class PayNotifyLogic extends BaseLogic
if($count == 1){
//存在拆单子否
//少了就冻结减去这个对应的金额
- $one = VipFlow::where([
+ $one = UserSign::where([
'user_id'=>$order['uid'],
- 'type'=>2,
+ 'type'=>1,
'status'=>0
])->find();
$data = [
- 'vip_flow_id'=>$one['id'],
- 'order_id' => $order['id'],
- 'order_sn' => $order['order_id'],
- 'user_id' => $order['uid'],
- 'pay_type' => $pay_type ?? 1,
- 'status' => 1,
- 'type' => 1,
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '充值获得冻结兑换券',
+ 'financial_pm' => 1,
'store_id' => $order['store_id'],
- 'staff_id' => $order['staff_id'],
- 'create_time' => time()
+ 'type' => 1,
];
+
if($one['back_num'] >= $backPurchase){
$data['number'] =$backPurchase;
- Db::name('la_vip_flow_log')->insert($data);
+ Db::name('user_sign_log')->insert($data);
//总的减去采购款百分之十剩余的
$wait = bcsub($one['back_num'],$backPurchase,2);
if(empty($wait)){
- VipFlow::where('id',$one['id'])->update(
+ UserSign::where('id',$one['id'])->update(
[
'back_num'=>0,
'status'=>1
@@ -265,7 +263,7 @@ class PayNotifyLogic extends BaseLogic
);
}else{
//add
- VipFlow::where('id',$one['id'])->update([
+ UserSign::where('id',$one['id'])->update([
[
'back_num'=>$wait
]
@@ -273,12 +271,13 @@ class PayNotifyLogic extends BaseLogic
}
//并且加到对应的用户的采购款中
User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
- }else{
+ }
+ else{
//对比采购款支付的多少 多了就拿冻结金额即可
$data['number'] =$one['number'];
//都存到对应的log日志
- Db::name('la_vip_flow_log')->insert($data);
- VipFlow::where('id',$one['id'])->update(
+ Db::name('user_sign_log')->insert($data);
+ UserSign::where('id',$one['id'])->update(
[
'back_num'=>0,
'status'=>1
@@ -292,56 +291,46 @@ class PayNotifyLogic extends BaseLogic
//大于0的时候
//先处理金额大的再处理剩余的
/**** 把所有的金额改为正的再加一条后再加***/
- VipFlow::where([
+ UserSign::where([
'user_id'=>$order['uid'],
- 'type'=>2,
+ 'type'=>1,
'status'=>0
])->update([
'status'=>1,
- 'remark'=>json_encode($ids)
+ 'title'=>json_encode($ids)
]);
if ($check >= $backPurchase) {
//补一条待解冻的
-// $data = [
-// 'order_id' => $order['id'],
-// 'transaction_id' => $transaction_id ?? 0,
-// 'order_sn' => $order['order_id'],
-// 'user_id' => $order['uid'],
-// 'number' => $total_vip,
-// 'back_num' => $total_vip,
-// 'pay_type' => $pay_type ?? 1,
-// 'status' => 0,
-// 'type' => 1,
-// 'store_id' => $order['store_id'],
-// 'staff_id' => $order['staff_id'],
-// 'create_time' => time()
-// ];
-// Db::name('vip_flow')->insert($data);
+ $left = bcsub($check,$backPurchase,2);
+ if($left > 0){
+ $data = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '补冻结兑换券',
+ 'financial_pm' => 0,
+ 'store_id' => $order['store_id'],
+ 'type' => 1,
+ ];
+ $data['number'] =$check;
+ Db::name('user_sign')->insert($data);
+ }
+ User::where('id',$order['uid'])->inc('purchase_funds',$backPurchase)->update();//add
}else{
//log
$data = [
- 'vip_flow_id'=>0,
- 'remark'=>$ids,
- 'order_id' => $order['id'],
- 'order_sn' => $order['order_id'],
- 'user_id' => $order['uid'],
- 'pay_type' => $pay_type ?? 1,
- 'status' => 1,
- 'type' => 1,
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '充值获得冻结兑换券',
+ 'financial_pm' => 1,
'store_id' => $order['store_id'],
- 'staff_id' => $order['staff_id'],
- 'create_time' => time()
+ 'type' => 1,
];
$data['number'] =$check;
- Db::name('la_vip_flow_log')->insert($data);
+ Db::name('user_sign_log')->insert($data);
User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
}
-
-
-
-
}
}
@@ -349,7 +338,7 @@ class PayNotifyLogic extends BaseLogic
}
-
+ return true;
}
/**
@@ -594,21 +583,19 @@ class PayNotifyLogic extends BaseLogic
public static function dealRechargeFrozen($order)
{
$total_vip = bcmul($order['price'],0.1,2);
- $data = [
- 'order_id' => $order['id'],
- 'transaction_id' => $transaction_id ?? 0,
- 'order_sn' => $order['order_id'],
- 'user_id' => $order['uid'],
+ $user_sing = new UserSign();
+ $sing = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '充值获得冻结兑换券',
+ 'financial_pm' => 1,
+ 'store_id' => $order['store_id'],
+ 'type' => 1,
'number' => $total_vip,
'back_num' => $total_vip,
- 'pay_type' => $pay_type ?? 1,
- 'status' => 0,
- 'type' => 1,
- 'store_id' => $order['store_id'],
- 'staff_id' => $order['staff_id'],
- 'create_time' => time()
];
- Db::name('vip_flow')->insert($data);
+ $user_sing->save($sing);
+
return true;
}
From a2b6431813eef2ab1195be7599dfc8c67aadf99f Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 18:29:34 +0800
Subject: [PATCH 30/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86?=
=?UTF-8?q?=E5=9B=9E=E8=B0=83=E8=A1=A8=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 311be253b..68780e46a 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -222,7 +222,7 @@ class PayNotifyLogic extends BaseLogic
//查询当前用户有无对应的充值的冻结金额
if($order['uid'] >0 ){
$query = UserSign::where([
- 'user_id'=>$order['uid'],
+ 'uid'=>$order['uid'],
'type'=>1,
'status'=>0
]);
@@ -236,7 +236,7 @@ class PayNotifyLogic extends BaseLogic
//存在拆单子否
//少了就冻结减去这个对应的金额
$one = UserSign::where([
- 'user_id'=>$order['uid'],
+ 'uid'=>$order['uid'],
'type'=>1,
'status'=>0
])->find();
@@ -292,7 +292,7 @@ class PayNotifyLogic extends BaseLogic
//先处理金额大的再处理剩余的
/**** 把所有的金额改为正的再加一条后再加***/
UserSign::where([
- 'user_id'=>$order['uid'],
+ 'uid'=>$order['uid'],
'type'=>1,
'status'=>0
])->update([
From 7d775aa4bf734f8c8a8278f894fa90616d7516c6 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 18:34:33 +0800
Subject: [PATCH 31/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=84=E7=90=86?=
=?UTF-8?q?=E5=9B=9E=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 68780e46a..8dc4245b5 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -206,7 +206,14 @@ class PayNotifyLogic extends BaseLogic
OrderLogic::writeOff($params);
}
self::dealProductLog($order);
- self::addFlowLog($order);
+ $count = UserSign::where([
+ 'uid'=>$order['uid'],
+ 'type'=>1,
+ 'status'=>0
+ ])->count();
+ if($count){
+ self::addFlowLog($order);
+ }
// if($order['shipping_type'] == 3){
// self::descStock($order['id']);
// }
@@ -245,7 +252,6 @@ class PayNotifyLogic extends BaseLogic
'order_id' => $order['order_id'],
'title' => '充值获得冻结兑换券',
'financial_pm' => 1,
- 'store_id' => $order['store_id'],
'type' => 1,
];
@@ -308,7 +314,6 @@ class PayNotifyLogic extends BaseLogic
'order_id' => $order['order_id'],
'title' => '补冻结兑换券',
'financial_pm' => 0,
- 'store_id' => $order['store_id'],
'type' => 1,
];
$data['number'] =$check;
@@ -323,7 +328,6 @@ class PayNotifyLogic extends BaseLogic
'order_id' => $order['order_id'],
'title' => '充值获得冻结兑换券',
'financial_pm' => 1,
- 'store_id' => $order['store_id'],
'type' => 1,
];
$data['number'] =$check;
From 7b31bbd361be96e7b6e29e492779764da43a9096 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 18:34:39 +0800
Subject: [PATCH 32/53] =?UTF-8?q?feat(CartList):=20=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=88=97=E8=A1=A8=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=BA=BF=E4=B8=8B=E9=97=A8=E5=BA=97?=
=?UTF-8?q?=E5=85=91=E6=8D=A2=E7=A4=BC=E5=93=81=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/lists/order/CartList.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php
index b5ffd0813..faf0599e0 100644
--- a/app/api/lists/order/CartList.php
+++ b/app/api/lists/order/CartList.php
@@ -114,7 +114,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
if($this->off_activity==1){
$data['pay_price']=$this->activity_price;
if($this->activity_price<500){
- $data['msg']='还差'.bcsub(500,$this->activity_price,2).'元可获得10%品牌礼品券';
+ $data['msg']='还差'.bcsub(500,$this->activity_price,2).'元可获得10%品牌礼品券,可到线下门店兑换礼品';
$data['pay_price']= $this->activity_price;
}else{
$data['msg']= '您已选购满500元,支付后可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品券';
From 44f881d0a9a261b7150e0dec5c24052580920726 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 18:37:40 +0800
Subject: [PATCH 33/53] =?UTF-8?q?feat(CartList):=20=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=BC=98=E6=83=A0=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E5=B1=95=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/lists/order/CartList.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php
index faf0599e0..9704200fe 100644
--- a/app/api/lists/order/CartList.php
+++ b/app/api/lists/order/CartList.php
@@ -108,16 +108,16 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
$data= [
'off_activity' => $this->off_activity,
'total_price' => $this->total_price,
- 'msg' => '您已选购满500元,支付后可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品券',
+ 'msg' => '您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品',
'pay_price' => $this->total_price
];
if($this->off_activity==1){
$data['pay_price']=$this->activity_price;
if($this->activity_price<500){
- $data['msg']='还差'.bcsub(500,$this->activity_price,2).'元可获得10%品牌礼品券,可到线下门店兑换礼品';
+ $data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品';
$data['pay_price']= $this->activity_price;
}else{
- $data['msg']= '您已选购满500元,支付后可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品券';
+ $data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品';
}
}
return $data;
From 891865e98f724097796b924ab8498ca6d1d9f15e Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 18:38:26 +0800
Subject: [PATCH 34/53] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=B4=AD?=
=?UTF-8?q?=E7=89=A9=E8=BD=A6=E6=94=AF=E4=BB=98=E4=BF=A1=E6=81=AF=E6=8F=8F?=
=?UTF-8?q?=E8=BF=B0=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=8F=A5=E5=8F=B7=E4=BB=A5?=
=?UTF-8?q?=E7=AC=A6=E5=90=88=E8=AF=AD=E6=B3=95=E8=A7=84=E8=8C=83=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/lists/order/CartList.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php
index 9704200fe..d46a21334 100644
--- a/app/api/lists/order/CartList.php
+++ b/app/api/lists/order/CartList.php
@@ -108,16 +108,16 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
$data= [
'off_activity' => $this->off_activity,
'total_price' => $this->total_price,
- 'msg' => '您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品',
+ 'msg' => '您已选购满500元,支付成功后即可获得'.bcmul($this->total_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。',
'pay_price' => $this->total_price
];
if($this->off_activity==1){
$data['pay_price']=$this->activity_price;
if($this->activity_price<500){
- $data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品';
+ $data['msg']='还差'.bcsub(500,$this->activity_price,2).'即可获得10%的品牌礼品兑换券,可到线下门店兑换礼品。';
$data['pay_price']= $this->activity_price;
}else{
- $data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品';
+ $data['msg']= '您已选购满500元,支付成功后即可获得'.bcmul($this->activity_price,0.1,2).'元品牌礼品兑换券,可到线下门店兑换礼品。';
}
}
return $data;
From b12e9b2ef6ceba0bbd220d9bf302b1f4de878acc Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 18:51:15 +0800
Subject: [PATCH 35/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=AD=E5=8F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 8dc4245b5..98e90d31b 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -227,7 +227,7 @@ class PayNotifyLogic extends BaseLogic
public static function addFlowLog($order)
{
//查询当前用户有无对应的充值的冻结金额
- if($order['uid'] >0 ){
+ if($order['uid'] >0){
$query = UserSign::where([
'uid'=>$order['uid'],
'type'=>1,
@@ -256,10 +256,12 @@ class PayNotifyLogic extends BaseLogic
];
if($one['back_num'] >= $backPurchase){
+
$data['number'] =$backPurchase;
Db::name('user_sign_log')->insert($data);
//总的减去采购款百分之十剩余的
- $wait = bcsub($one['back_num'],$backPurchase,2);
+ $wait = bcsub($one['back_num'],$backPurchase,2)??0;
+
if(empty($wait)){
UserSign::where('id',$one['id'])->update(
[
@@ -269,12 +271,13 @@ class PayNotifyLogic extends BaseLogic
);
}else{
//add
- UserSign::where('id',$one['id'])->update([
+ UserSign::where('id',$one['id'])->update(
[
'back_num'=>$wait
]
- ]);
+ );
}
+
//并且加到对应的用户的采购款中
User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
}
@@ -293,7 +296,8 @@ class PayNotifyLogic extends BaseLogic
User::where('id',$order['uid'])->inc('purchase_funds',$one['number'])->update();
}
- }else{
+ }
+ else{
//大于0的时候
//先处理金额大的再处理剩余的
/**** 把所有的金额改为正的再加一条后再加***/
From 2dd50089e8da854517a721f2afa369b92a54d553 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 18:56:50 +0800
Subject: [PATCH 36/53] =?UTF-8?q?feat(LoginLogic):=20=E6=A0=B9=E6=8D=AE?=
=?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E5=88=A4=E6=96=AD=E7=94=A8=E6=88=B7?=
=?UTF-8?q?=E6=98=AF=E5=90=A6=E4=B8=BA=E6=96=B0=E7=94=A8=E6=88=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/LoginLogic.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php
index 798b3b577..cf0b3eff2 100644
--- a/app/api/logic/LoginLogic.php
+++ b/app/api/logic/LoginLogic.php
@@ -451,10 +451,10 @@ class LoginLogic extends BaseLogic
UserAuth::where(['user_id'=>$userId])->update(['user_id'=>$find['id']]);
}
}
- $data=[
- 'mobile'=>$params['mobile'],
- 'is_new_user' => YesNoEnum::NO
- ];
+ $data=['is_new_user' => YesNoEnum::NO];
+ if(isset($params['mobile']) && $params['mobile']!=''){
+ $data['mobile']=$params['mobile'];
+ }
if(!empty($params['nickname'])){
$data['nickname'] = $params['nickname'];
}
From df67ee76991e90fe2747cf2c0918e9bb5d5b47d2 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 18:59:34 +0800
Subject: [PATCH 37/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A4=BC=E5=93=81?=
=?UTF-8?q?=E5=88=B8=E6=A0=B8=E9=94=80=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 5 +++++
app/common/logic/PayNotifyLogic.php | 25 ++++++++++++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index f1d156db3..e9eb7e96c 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -458,6 +458,11 @@ class OrderLogic extends BaseLogic
$money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number');
$financeFlowLogic->updateStatusStore($order['id'],$order['store_id'],$money,$deposit);
+ $check = Db::name('user_sign_log')->where('order_id',$order['order_id'])->find();
+ if($check){
+ User::where('id',$order['uid'])->inc('purchase_funds',$check['number'])->update();
+ }
+
Db::commit();
return true;
} catch (\Exception $e) {
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 98e90d31b..db33821e3 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -256,11 +256,12 @@ class PayNotifyLogic extends BaseLogic
];
if($one['back_num'] >= $backPurchase){
+ $wait = bcsub($one['back_num'],$backPurchase,2)??0;
- $data['number'] =$backPurchase;
+ $data['number'] =$wait;
Db::name('user_sign_log')->insert($data);
//总的减去采购款百分之十剩余的
- $wait = bcsub($one['back_num'],$backPurchase,2)??0;
+
if(empty($wait)){
UserSign::where('id',$one['id'])->update(
@@ -273,13 +274,13 @@ class PayNotifyLogic extends BaseLogic
//add
UserSign::where('id',$one['id'])->update(
[
- 'back_num'=>$wait
+ 'back_num'=>$backPurchase
]
);
}
//并且加到对应的用户的采购款中
- User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
+// User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
}
else{
//对比采购款支付的多少 多了就拿冻结金额即可
@@ -293,7 +294,7 @@ class PayNotifyLogic extends BaseLogic
]
);
//并且加到对应的用户的采购款中
- User::where('id',$order['uid'])->inc('purchase_funds',$one['number'])->update();
+// User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
}
}
@@ -322,8 +323,18 @@ class PayNotifyLogic extends BaseLogic
];
$data['number'] =$check;
Db::name('user_sign')->insert($data);
+
+ $data = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'],
+ 'title' => '充值获得冻结兑换券',
+ 'financial_pm' => 1,
+ 'type' => 1,
+ ];
+ $data['number'] =$backPurchase;
+ Db::name('user_sign_log')->insert($data);
}
- User::where('id',$order['uid'])->inc('purchase_funds',$backPurchase)->update();//add
+// User::where('id',$order['uid'])->inc('purchase_funds',$backPurchase)->update();//add
}else{
//log
@@ -336,7 +347,7 @@ class PayNotifyLogic extends BaseLogic
];
$data['number'] =$check;
Db::name('user_sign_log')->insert($data);
- User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
+// User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
}
}
From b5a6fab3b21e5707837dec2142c00b313a09c15b Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 19:04:10 +0800
Subject: [PATCH 38/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index e9eb7e96c..ed335f205 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -461,6 +461,7 @@ class OrderLogic extends BaseLogic
$check = Db::name('user_sign_log')->where('order_id',$order['order_id'])->find();
if($check){
User::where('id',$order['uid'])->inc('purchase_funds',$check['number'])->update();
+ Db::name('user_sign_log')->where('order_id',$order['order_id'])->update(['status'=>1]);
}
Db::commit();
From 862b05496e3a793716c87febed6b11407bc0761a Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 19:11:10 +0800
Subject: [PATCH 39/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index db33821e3..2eebad45c 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -211,6 +211,7 @@ class PayNotifyLogic extends BaseLogic
'type'=>1,
'status'=>0
])->count();
+
if($count){
self::addFlowLog($order);
}
@@ -257,12 +258,9 @@ class PayNotifyLogic extends BaseLogic
if($one['back_num'] >= $backPurchase){
$wait = bcsub($one['back_num'],$backPurchase,2)??0;
-
- $data['number'] =$wait;
+ $data['number'] =$backPurchase;
Db::name('user_sign_log')->insert($data);
//总的减去采购款百分之十剩余的
-
-
if(empty($wait)){
UserSign::where('id',$one['id'])->update(
[
@@ -274,7 +272,7 @@ class PayNotifyLogic extends BaseLogic
//add
UserSign::where('id',$one['id'])->update(
[
- 'back_num'=>$backPurchase
+ 'back_num'=>$wait
]
);
}
From f64294494cee8a7f3ba55aad1561794826604295 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 19:34:08 +0800
Subject: [PATCH 40/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E5=85=A5?=
=?UTF-8?q?=E5=86=BB=E7=BB=93=E7=A4=BC=E5=93=81=E5=88=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 49 +++++++++++++++++++++++++++--
app/common/logic/PayNotifyLogic.php | 13 +++++---
2 files changed, 55 insertions(+), 7 deletions(-)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index ed335f205..f30d16240 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -458,9 +458,54 @@ class OrderLogic extends BaseLogic
$money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number');
$financeFlowLogic->updateStatusStore($order['id'],$order['store_id'],$money,$deposit);
- $check = Db::name('user_sign_log')->where('order_id',$order['order_id'])->find();
+ $check = Db::name('user_sign_log')->where('order_id',$order['order_id'])
+ ->where(['status'=>0])
+ ->find();
if($check){
- User::where('id',$order['uid'])->inc('purchase_funds',$check['number'])->update();
+// User::where('id',$order['uid'])->inc('purchase_funds',$check['number'])->update();
+// $user_number = bcmul($order['pay_price'], '0.10', 2);
+
+ $base = UserSign::where([
+ 'uid'=>$order['uid'],
+ 'type'=>1,
+ 'status'=>0
+ ])->find();
+ $user_sing = new UserSign();
+ if($base['number'] > 0 && $base['number'] >= $check['number']){
+ $sing = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'].'-b',
+ 'title' => '返还兑换券',
+ 'financial_pm' => 1,
+ 'store_id' => $order['store_id'],
+ ];
+ $sing['number'] = $check['number'];
+ $user_sing->save($sing);
+ if($base['number'] == $check['number']){
+ UserSign::where([
+ 'uid'=>$order['uid'],
+ 'type'=>1,
+ 'status'=>0
+ ])->update(['status'=>1]);
+ }
+ }
+ if($base['number'] < $check['number']){
+ $sing = [
+ 'uid' => $order['uid'],
+ 'order_id' => $order['order_id'].'-b',
+ 'title' => '返还兑换券',
+ 'financial_pm' => 1,
+ 'store_id' => $base['number'],
+ ];
+ $sing['number'] = $check['number'];
+ $user_sing->save($sing);
+ UserSign::where([
+ 'uid'=>$order['uid'],
+ 'type'=>1,
+ 'status'=>0
+ ])->update(['status'=>1]);
+ }
+
Db::name('user_sign_log')->where('order_id',$order['order_id'])->update(['status'=>1]);
}
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 2eebad45c..373aa64c0 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -236,10 +236,12 @@ class PayNotifyLogic extends BaseLogic
]);
$query1 = clone $query;
$ids = $query->column('id');
- $check = $query->sum('back_num');
+ $check = $query->sum('number');
$count = $query1->count();
if($check && $check >0){
- $backPurchase = bcsub($order['pay_price'],0.1,2);
+ $backPurchase = bcmul($order['pay_price'],0.1,2);
+
+
if($count == 1){
//存在拆单子否
//少了就冻结减去这个对应的金额
@@ -259,12 +261,13 @@ class PayNotifyLogic extends BaseLogic
if($one['back_num'] >= $backPurchase){
$wait = bcsub($one['back_num'],$backPurchase,2)??0;
$data['number'] =$backPurchase;
+
Db::name('user_sign_log')->insert($data);
//总的减去采购款百分之十剩余的
if(empty($wait)){
UserSign::where('id',$one['id'])->update(
[
- 'back_num'=>0,
+ 'number'=>0,
'status'=>1
]
);
@@ -272,7 +275,7 @@ class PayNotifyLogic extends BaseLogic
//add
UserSign::where('id',$one['id'])->update(
[
- 'back_num'=>$wait
+ 'number'=>$wait
]
);
}
@@ -287,7 +290,7 @@ class PayNotifyLogic extends BaseLogic
Db::name('user_sign_log')->insert($data);
UserSign::where('id',$one['id'])->update(
[
- 'back_num'=>0,
+ 'number'=>0,
'status'=>1
]
);
From fb03d9c2ff9d2670c905311b20c14d580416cda4 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 19:43:44 +0800
Subject: [PATCH 41/53] =?UTF-8?q?=E6=A0=B8=E9=94=80=E5=90=8E=E5=88=B0?=
=?UTF-8?q?=E8=B4=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 13 ++++++++-
app/common/logic/PayNotifyLogic.php | 44 ++++++++++++++---------------
2 files changed, 34 insertions(+), 23 deletions(-)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index f30d16240..347b25849 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -460,7 +460,7 @@ class OrderLogic extends BaseLogic
$check = Db::name('user_sign_log')->where('order_id',$order['order_id'])
->where(['status'=>0])
- ->find();
+ ->find();//$check['number']扣的
if($check){
// User::where('id',$order['uid'])->inc('purchase_funds',$check['number'])->update();
// $user_number = bcmul($order['pay_price'], '0.10', 2);
@@ -481,6 +481,11 @@ class OrderLogic extends BaseLogic
];
$sing['number'] = $check['number'];
$user_sing->save($sing);
+ //减少
+ UserSign::where('id',$check['id'])->update(
+ [
+ 'number'=>$check['number']
+ ]);
if($base['number'] == $check['number']){
UserSign::where([
'uid'=>$order['uid'],
@@ -499,6 +504,12 @@ class OrderLogic extends BaseLogic
];
$sing['number'] = $check['number'];
$user_sing->save($sing);
+
+ UserSign::where('id',$check['id'])->update(
+ [
+ 'number'=>$base['number']
+ ]);
+
UserSign::where([
'uid'=>$order['uid'],
'type'=>1,
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 373aa64c0..f02c22d70 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -259,26 +259,26 @@ class PayNotifyLogic extends BaseLogic
];
if($one['back_num'] >= $backPurchase){
- $wait = bcsub($one['back_num'],$backPurchase,2)??0;
+// $wait = bcsub($one['back_num'],$backPurchase,2)??0;
$data['number'] =$backPurchase;
Db::name('user_sign_log')->insert($data);
//总的减去采购款百分之十剩余的
- if(empty($wait)){
- UserSign::where('id',$one['id'])->update(
- [
- 'number'=>0,
- 'status'=>1
- ]
- );
- }else{
- //add
- UserSign::where('id',$one['id'])->update(
- [
- 'number'=>$wait
- ]
- );
- }
+// if(empty($wait)){
+// UserSign::where('id',$one['id'])->update(
+// [
+// 'number'=>0,
+// 'status'=>1
+// ]
+// );
+// }else{
+// //add
+// UserSign::where('id',$one['id'])->update(
+// [
+// 'number'=>$wait
+// ]
+// );
+// }
//并且加到对应的用户的采购款中
// User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
@@ -288,12 +288,12 @@ class PayNotifyLogic extends BaseLogic
$data['number'] =$one['number'];
//都存到对应的log日志
Db::name('user_sign_log')->insert($data);
- UserSign::where('id',$one['id'])->update(
- [
- 'number'=>0,
- 'status'=>1
- ]
- );
+// UserSign::where('id',$one['id'])->update(
+// [
+// 'number'=>0,
+// 'status'=>1
+// ]
+// );
//并且加到对应的用户的采购款中
// User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
}
From 614c34db8ea384422b487fad7b57f0edb3a51925 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 19:55:56 +0800
Subject: [PATCH 42/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 14 ++++++--------
app/common/logic/PayNotifyLogic.php | 4 +++-
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 347b25849..b694a0c78 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -478,19 +478,18 @@ class OrderLogic extends BaseLogic
'title' => '返还兑换券',
'financial_pm' => 1,
'store_id' => $order['store_id'],
+ 'status' => 1,
];
$sing['number'] = $check['number'];
$user_sing->save($sing);
//减少
- UserSign::where('id',$check['id'])->update(
+ UserSign::where('id',$check['sid'])->update(
[
'number'=>$check['number']
]);
if($base['number'] == $check['number']){
UserSign::where([
- 'uid'=>$order['uid'],
- 'type'=>1,
- 'status'=>0
+ 'id'=>$order['sid']
])->update(['status'=>1]);
}
}
@@ -501,19 +500,18 @@ class OrderLogic extends BaseLogic
'title' => '返还兑换券',
'financial_pm' => 1,
'store_id' => $base['number'],
+ 'status' => 1,
];
$sing['number'] = $check['number'];
$user_sing->save($sing);
- UserSign::where('id',$check['id'])->update(
+ UserSign::where('id',$check['sid'])->update(
[
'number'=>$base['number']
]);
UserSign::where([
- 'uid'=>$order['uid'],
- 'type'=>1,
- 'status'=>0
+ 'id'=>$order['sid']
])->update(['status'=>1]);
}
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index f02c22d70..e746a956b 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -251,6 +251,7 @@ class PayNotifyLogic extends BaseLogic
'status'=>0
])->find();
$data = [
+ 'sid'=>$one['id'],
'uid' => $order['uid'],
'order_id' => $order['order_id'],
'title' => '充值获得冻结兑换券',
@@ -323,10 +324,11 @@ class PayNotifyLogic extends BaseLogic
'type' => 1,
];
$data['number'] =$check;
- Db::name('user_sign')->insert($data);
+ $sid = Db::name('user_sign')->insertGetId($data);
$data = [
'uid' => $order['uid'],
+ 'sid' => $sid,
'order_id' => $order['order_id'],
'title' => '充值获得冻结兑换券',
'financial_pm' => 1,
From a6c5da49d65090d43f338b0df474720bc914a4ec Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 20:00:29 +0800
Subject: [PATCH 43/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=A3=E9=99=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index b694a0c78..206f9b115 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -483,10 +483,7 @@ class OrderLogic extends BaseLogic
$sing['number'] = $check['number'];
$user_sing->save($sing);
//减少
- UserSign::where('id',$check['sid'])->update(
- [
- 'number'=>$check['number']
- ]);
+ UserSign::where('id',$check['sid'])->dec('number',$check['number'])->update();
if($base['number'] == $check['number']){
UserSign::where([
'id'=>$order['sid']
@@ -505,10 +502,8 @@ class OrderLogic extends BaseLogic
$sing['number'] = $check['number'];
$user_sing->save($sing);
- UserSign::where('id',$check['sid'])->update(
- [
- 'number'=>$base['number']
- ]);
+ UserSign::where('id',$check['sid'])->dec('number',$base['number'])->update();
+
UserSign::where([
'id'=>$order['sid']
From 1b1210728c1f76b1f9b8d606b01f2c5982f2fbe5 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 20:01:23 +0800
Subject: [PATCH 44/53] =?UTF-8?q?feat(WechatLoginValidate):=20=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0=E7=94=A8=E6=88=B7=E5=9C=BA=E6=99=AF=E4=B8=8D=E5=86=8D?=
=?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=89=8B=E6=9C=BA=E5=8F=B7=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/validate/WechatLoginValidate.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/api/validate/WechatLoginValidate.php b/app/api/validate/WechatLoginValidate.php
index 18425f745..079a744a9 100644
--- a/app/api/validate/WechatLoginValidate.php
+++ b/app/api/validate/WechatLoginValidate.php
@@ -91,7 +91,7 @@ class WechatLoginValidate extends BaseValidate
*/
public function sceneUpdateUser()
{
- return $this->only(['mobile']);
+ return $this->only([]);
}
From cba0505f632308150993e3a676fba0851a94c99a Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 20:03:43 +0800
Subject: [PATCH 45/53] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=99=BB?=
=?UTF-8?q?=E5=BD=95=E6=8E=A7=E5=88=B6=E5=99=A8=E4=BB=A5=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/controller/LoginController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/api/controller/LoginController.php b/app/api/controller/LoginController.php
index dd8ab2244..a2e35b993 100644
--- a/app/api/controller/LoginController.php
+++ b/app/api/controller/LoginController.php
@@ -77,7 +77,7 @@ class LoginController extends BaseApiController
*/
public function updateUser()
{
- $params = (new WechatLoginValidate())->post()->goCheck("updateUser");
+ $params = $this->request->post();
$result = LoginLogic::updateUser($params, $this->userId);
if ($result === false) {
return $this->fail(LoginLogic::getError());
From 69216e05cdddf9dda98fe4ac998aa84e1bc45d4f Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 20:04:58 +0800
Subject: [PATCH 46/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=A3=E9=99=A4?=
=?UTF-8?q?=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 206f9b115..7f256fe1a 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -482,6 +482,7 @@ class OrderLogic extends BaseLogic
];
$sing['number'] = $check['number'];
$user_sing->save($sing);
+ User::where('id',$order['uid'])->inc('integral',$check['number'])->update();
//减少
UserSign::where('id',$check['sid'])->dec('number',$check['number'])->update();
if($base['number'] == $check['number']){
@@ -496,13 +497,14 @@ class OrderLogic extends BaseLogic
'order_id' => $order['order_id'].'-b',
'title' => '返还兑换券',
'financial_pm' => 1,
- 'store_id' => $base['number'],
+ 'store_id' => $order['store_id'],
'status' => 1,
];
- $sing['number'] = $check['number'];
+ $sing['number'] = $base['number'];
$user_sing->save($sing);
UserSign::where('id',$check['sid'])->dec('number',$base['number'])->update();
+ User::where('id',$order['uid'])->inc('integral',$base['number'])->update();
UserSign::where([
From f3004f2382cf00213aae1b183c67efbe505810ca Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 20:05:08 +0800
Subject: [PATCH 47/53] =?UTF-8?q?feat(LoginLogic):=20=E6=9B=B4=E6=96=B0?=
=?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AFAPI=E9=80=BB=E8=BE=91?=
=?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/LoginLogic.php | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php
index cf0b3eff2..c4d715a3d 100644
--- a/app/api/logic/LoginLogic.php
+++ b/app/api/logic/LoginLogic.php
@@ -441,20 +441,22 @@ class LoginLogic extends BaseLogic
*/
public static function updateUser($params, $userId)
{
- $find=User::where(['mobile' =>$params['mobile']])->find();
- if($find){
- $auth=UserAuth::where(['user_id'=>$find['id']])->find();//别人的
- if($auth){
- self::$error ='该手机号已绑定';
- return false;
- }else{
- UserAuth::where(['user_id'=>$userId])->update(['user_id'=>$find['id']]);
- }
- }
$data=['is_new_user' => YesNoEnum::NO];
+
if(isset($params['mobile']) && $params['mobile']!=''){
$data['mobile']=$params['mobile'];
+ $find=User::where(['mobile' =>$params['mobile']])->find();
+ if($find){
+ $auth=UserAuth::where(['user_id'=>$find['id']])->find();//别人的
+ if($auth){
+ self::$error ='该手机号已绑定';
+ return false;
+ }else{
+ UserAuth::where(['user_id'=>$userId])->update(['user_id'=>$find['id']]);
+ }
+ }
}
+
if(!empty($params['nickname'])){
$data['nickname'] = $params['nickname'];
}
From 8bc15dd181d8292c1484778e1626b075383c5382 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 20:09:03 +0800
Subject: [PATCH 48/53] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index e746a956b..bca087b71 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -300,10 +300,10 @@ class PayNotifyLogic extends BaseLogic
}
}
- else{
+ /* else{
//大于0的时候
//先处理金额大的再处理剩余的
- /**** 把所有的金额改为正的再加一条后再加***/
+ //把所有的金额改为正的再加一条后再加
UserSign::where([
'uid'=>$order['uid'],
'type'=>1,
@@ -353,7 +353,7 @@ class PayNotifyLogic extends BaseLogic
// User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
}
- }
+ }*/
}
return true;
From 90d05227f2984166e69fb24a25e116e64a5c4cd2 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 20:35:06 +0800
Subject: [PATCH 49/53] =?UTF-8?q?=E5=85=85=E5=80=BC=E5=88=B0=E8=B4=A6?=
=?UTF-8?q?=E7=A4=BC=E5=93=81=E5=88=B8=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/logic/order/OrderLogic.php | 6 ++--
app/common/logic/PayNotifyLogic.php | 44 +++++++++++++++++------------
2 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php
index 7f256fe1a..a50baf6c9 100644
--- a/app/api/logic/order/OrderLogic.php
+++ b/app/api/logic/order/OrderLogic.php
@@ -458,7 +458,7 @@ class OrderLogic extends BaseLogic
$money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number');
$financeFlowLogic->updateStatusStore($order['id'],$order['store_id'],$money,$deposit);
- $check = Db::name('user_sign_log')->where('order_id',$order['order_id'])
+ /* $check = Db::name('user_sign_log')->where('order_id',$order['order_id'])
->where(['status'=>0])
->find();//$check['number']扣的
if($check){
@@ -468,7 +468,7 @@ class OrderLogic extends BaseLogic
$base = UserSign::where([
'uid'=>$order['uid'],
'type'=>1,
- 'status'=>0
+ 'status'=>1
])->find();
$user_sing = new UserSign();
if($base['number'] > 0 && $base['number'] >= $check['number']){
@@ -513,7 +513,7 @@ class OrderLogic extends BaseLogic
}
Db::name('user_sign_log')->where('order_id',$order['order_id'])->update(['status'=>1]);
- }
+ }*/
Db::commit();
return true;
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index bca087b71..8c03f4776 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -206,15 +206,15 @@ class PayNotifyLogic extends BaseLogic
OrderLogic::writeOff($params);
}
self::dealProductLog($order);
- $count = UserSign::where([
- 'uid'=>$order['uid'],
- 'type'=>1,
- 'status'=>0
- ])->count();
-
- if($count){
- self::addFlowLog($order);
- }
+// $count = UserSign::where([
+// 'uid'=>$order['uid'],
+// 'type'=>1,
+// 'status'=>0
+// ])->count();
+//
+// if($count){
+// self::addFlowLog($order);
+// }
// if($order['shipping_type'] == 3){
// self::descStock($order['id']);
// }
@@ -234,15 +234,14 @@ class PayNotifyLogic extends BaseLogic
'type'=>1,
'status'=>0
]);
- $query1 = clone $query;
- $ids = $query->column('id');
+// $query1 = clone $query;
+// $ids = $query->column('id');
$check = $query->sum('number');
- $count = $query1->count();
+// $count = $query1->count();
if($check && $check >0){
$backPurchase = bcmul($order['pay_price'],0.1,2);
-
- if($count == 1){
+// if($count == 1){
//存在拆单子否
//少了就冻结减去这个对应的金额
$one = UserSign::where([
@@ -257,13 +256,15 @@ class PayNotifyLogic extends BaseLogic
'title' => '充值获得冻结兑换券',
'financial_pm' => 1,
'type' => 1,
+ 'status' => 1,
];
- if($one['back_num'] >= $backPurchase){
-// $wait = bcsub($one['back_num'],$backPurchase,2)??0;
+ if($one['number'] >= $backPurchase){
+// $wait = bcsub($one['number'],$backPurchase,2)??0;
$data['number'] =$backPurchase;
Db::name('user_sign_log')->insert($data);
+
//总的减去采购款百分之十剩余的
// if(empty($wait)){
// UserSign::where('id',$one['id'])->update(
@@ -355,7 +356,7 @@ class PayNotifyLogic extends BaseLogic
}*/
- }
+// }
return true;
}
@@ -613,10 +614,12 @@ class PayNotifyLogic extends BaseLogic
'financial_pm' => 1,
'store_id' => $order['store_id'],
'type' => 1,
+ 'status' => 1,
'number' => $total_vip,
'back_num' => $total_vip,
];
$user_sing->save($sing);
+ User::where('id',$order->uid)->inc('integral',$total_vip)->update();
return true;
}
@@ -666,7 +669,12 @@ class PayNotifyLogic extends BaseLogic
if($order['other_uid']>0){
$uid=$order['other_uid'];
}
- self::dealRechargeFrozen($order);
+ $check = UserSign::where(['uid'=>$order->uid,'type'=>1])->count();
+ if(empty($check)){
+ self::dealRechargeFrozen($order);
+
+ }
+
PushService::push('wechat_mmp_' . $uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]);
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]);
if (!empty($extra['payer']['openid'])) {
From 195e2fa3f760c14db8dda24d60e4dad78d830fce Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 20:47:16 +0800
Subject: [PATCH 50/53] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E8=88=B9=E5=8F=AA=E7=AD=89=E7=BA=A7=E5=8F=98=E6=9B=B4?=
=?UTF-8?q?=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/controller/store/StoreController.php | 1 +
app/common/logic/PayNotifyLogic.php | 10 ++--------
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php
index 666bc0fe2..369c9709a 100644
--- a/app/api/controller/store/StoreController.php
+++ b/app/api/controller/store/StoreController.php
@@ -103,6 +103,7 @@ class StoreController extends BaseApiController
'order_id'=>getNewOrderId('CZ'),
'price'=>$params['price']??1000,
'recharge_type'=>'INDUSTRYMEMBERS',
+ 'user_ship'=>$params['user_ship']??0,
];
$order = UserRecharge::create($data);
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index e746a956b..2105d0434 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -652,14 +652,8 @@ class PayNotifyLogic extends BaseLogic
bcscale(2);
// $user->now_money = bcadd($user->now_money, $price, 2);//v.1
//更新等级
- $limit_1=UserShip::where('id',1)->value('limit');
- $limit_4=UserShip::where('id',4)->value('limit');
- if ($price >= $limit_1 &&$price<$limit_4) {
- $user->user_ship = 1; //v.1
- }
- if ($price>$limit_4) {
- $user->user_ship = 4;
- }
+ $user->user_ship = $order['user_ship'];
+
$user->purchase_funds = bcadd($user->purchase_funds, $price, 2);
$user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2);
$user->save();
From 750dd6aacb38f53d74b2e7e2d52d10c66174727b Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 20:47:58 +0800
Subject: [PATCH 51/53] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=96=B0?=
=?UTF-8?q?=E5=B1=9E=E6=80=A7user=5Fship=E5=88=B0=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/store/controller/store_order/StoreOrderController.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php
index fbaa308e9..6527e6e78 100644
--- a/app/store/controller/store_order/StoreOrderController.php
+++ b/app/store/controller/store_order/StoreOrderController.php
@@ -371,6 +371,7 @@ class StoreOrderController extends BaseAdminController
'order_id' => getNewOrderId('CZ'),
'price' => $params['price'],
'recharge_type' => 'INDUSTRYMEMBERS',
+ 'user_ship'=>$params['user_ship']??0,
];
$order = UserRecharge::create($data);
$order['pay_price'] = $order['price'];
From 65764cc8746a64e5d8c050db78c2423f1677f7b9 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Thu, 27 Jun 2024 20:57:48 +0800
Subject: [PATCH 52/53] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9StoreController?=
=?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87=E6=89=8B=E6=9C=BA?=
=?UTF-8?q?=E5=8F=B7=E6=88=96=E8=B4=A6=E6=88=B7=E6=9F=A5=E8=AF=A2=E7=94=A8?=
=?UTF-8?q?=E6=88=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/api/controller/store/StoreController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php
index 369c9709a..21b5b5b5c 100644
--- a/app/api/controller/store/StoreController.php
+++ b/app/api/controller/store/StoreController.php
@@ -80,7 +80,7 @@ class StoreController extends BaseApiController
if($params['price']>10000){
return $this->fail('充值金额不能大于10000');
}
- $find=User::where('mobile',$params['mobile'])->find();
+ $find=User::where('account|mobile',$params['mobile'])->find();
if(!$find){
$params['create_uid']=$this->userId;
$find=UserUserLogic::StoreAdd($params);
From 6a7bb757d0dca5abb75def600193b06cd3549087 Mon Sep 17 00:00:00 2001
From: liu <1873441552@qq.com>
Date: Thu, 27 Jun 2024 21:12:47 +0800
Subject: [PATCH 53/53] =?UTF-8?q?=E5=8F=96=E6=B6=88=E9=99=90=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/common/logic/PayNotifyLogic.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php
index 5876e8a8f..86ea0a28e 100644
--- a/app/common/logic/PayNotifyLogic.php
+++ b/app/common/logic/PayNotifyLogic.php
@@ -765,8 +765,7 @@ 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'] !=18
- && $order['pay_type'] !=3) {
+ if ($order['uid'] > 0 && $order['total_price'] >= 500 ) {
$user_number = bcmul($order['pay_price'], '0.10', 2);
$sing = [
'uid' => $order['uid'],