From f2d777d5e3a435c688f0912d41d508d2ca6a3e41 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Thu, 13 Jun 2024 17:05:43 +0800 Subject: [PATCH 001/145] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E4=B8=BA0=E6=97=B6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/order/OrderController.php | 3 +++ app/common/enum/OrderEnum.php | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/api/controller/order/OrderController.php b/app/api/controller/order/OrderController.php index fa1f79a2c..70ec3e5a5 100644 --- a/app/api/controller/order/OrderController.php +++ b/app/api/controller/order/OrderController.php @@ -185,6 +185,9 @@ class OrderController extends BaseApiController $user=User::where('id',$this->userId)->find(); $order = OrderLogic::createOrder($cartId, $addressId, $user, $params); + if($order['pay_price'] <= 0){ + $pay_type = 3; + } if ($order != false) { switch ($pay_type) { case PayEnum::BALANCE_PAY: diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index c6ea7ec5b..4c0560214 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -28,12 +28,16 @@ class OrderEnum const SUPPLIER_ORDER_OBTAINS = 6; const PLATFORM_ORDER_PAY = 7; const SYSTEM_SET = 8; - const CASHIER_ORDER_PAY = 9; + const CASHIER_ORDER_PAY = 9;//微信条码 const CASHIER_CASH_ORDER_PAY = 10; const ORDER_MARGIN = 11; const ORDER_COMMITION = 12; + const CASHIER_ORDER_ALI_PAY = 13;//支付宝条码 + + const CASHIER_FACE_PAY = 17;//现金收银 + /** * 收入支出类型 @@ -87,6 +91,7 @@ class OrderEnum /**小程序下单**/ const ONLINE = [1,2]; + const OFFLINE = [3]; /** * 账户类型 * @USER 用户 From 6280a3e6b68120dc0fca2058d6fcc96034df0d78 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Thu, 13 Jun 2024 17:25:39 +0800 Subject: [PATCH 002/145] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 6 +- app/store/controller/WorkbenchController.php | 18 +++ app/store/logic/WorkbenchLogic.php | 162 +++++++++++++++++++ 3 files changed, 185 insertions(+), 1 deletion(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 5cbe5aebe..231ea429f 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -105,7 +105,7 @@ class PayNotifyLogic extends BaseLogic $extra['transaction_id'] = time(); } $user = User::where('id', $order['uid'])->find(); - if ($order->pay_type == 9) { + if ($order->pay_type == OrderEnum::CASHIER_ORDER_PAY || $order->pay_type == OrderEnum::CASHIER_ORDER_ALI_PAY) {//收银台支付 $order->status = 2; } else { $capitalFlowDao = new CapitalFlowLogic($user); @@ -275,6 +275,10 @@ class PayNotifyLogic extends BaseLogic $amount = min($deposit, $frozen); $financeLogic->in($transaction_id, $amount, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id']); } + //入商户帐 + if($deposit <= 0 && $frozen > 0){ + SystemStore::where('id',$order['store_id'])->inc('store_money',$frozen); + } } $financeLogic->save(); } diff --git a/app/store/controller/WorkbenchController.php b/app/store/controller/WorkbenchController.php index 267a13ecc..6788b71ca 100644 --- a/app/store/controller/WorkbenchController.php +++ b/app/store/controller/WorkbenchController.php @@ -142,4 +142,22 @@ class WorkbenchController extends BaseAdminController return $workbench->get_product_ranking(); } + + #[ + ApiDoc\Title('收银台数据统计'), + ApiDoc\url('/store/workbench/business_statistics'), + ApiDoc\Method('GET'), + ApiDoc\NotHeaders(), + ApiDoc\Author('中国队长'), + ApiDoc\Query(), + ApiDoc\Header(ref: [Definitions::class, "token"]), + ApiDoc\ResponseSuccess("data", type: "array"), + ] + public function business_statistics() + { + $params = $this->request->get(); + $params['store_id'] = $this->request->adminInfo['store_id']; + $result = WorkbenchLogic::revenueStatistics($params); + return $this->data($result); + } } diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index 01fb12a11..bbfdaf095 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -15,14 +15,19 @@ namespace app\store\logic; +use app\common\enum\OrderEnum; use app\common\enum\PayEnum; +use app\common\enum\YesNoEnum; use app\common\logic\BaseLogic; use app\common\logic\store_order\StoreOrderLogic; +use app\common\logic\StoreFinanceFlowLogic; use app\common\model\order\Cart; use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow; +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_visit\StoreVisit; +use app\common\model\system_store\SystemStore; use app\common\service\ConfigService; use app\common\service\FileService; @@ -529,4 +534,161 @@ class WorkbenchLogic extends BaseLogic return $data; } + + public static function revenueStatistics($params) + { + + //当日营业额的统计 当日利润的统计 当日成本合集的统计 当日加到保证金的 当日的现金收银 + $today = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]); + $turnover_today = $today + ->whereDay('create_time') + ->sum('pay_price'); + $profit_today = $today + ->whereDay('create_time') + ->sum('profit'); + $cost_today = $today + ->whereDay('create_time') + ->sum('cost'); + + $deposit = StoreFinanceFlow::where(['store_id'=>$params['store_id']]) + ->where('financial_type',OrderEnum::ORDER_MARGIN); + $deposit_today =$deposit + ->whereDay('create_time') + ->sum('number'); + + $cash_today = StoreCashFinanceFlow::where('store_id',$params['store_id']) + ->whereDay('create_time') + ->where('status',YesNoEnum::YES) + ->sum('receipts'); + + //总的营业额的统计 总的利润的统计 总的成本合集的统计 总的加到保证金的 + $all = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]); + $turnover_all = $all + ->sum('pay_price'); + $profit_all = $all + ->sum('profit'); + $cost_all = $all + ->sum('cost'); + $deposit_all = SystemStore::where('id',$params['store_id']) + ->value('paid_deposit'); + $cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id']) + ->where('status',YesNoEnum::YES) + ->sum('receipts'); + + + $time = self::getLastSevenDays(); + $newArr = []; + foreach ($time as $value){ + $data = self::dealSearch($params['store_id'],$value); + $newArr[$value] = $data; + } + return [ + 'today'=>[ + 'turnover_today'=>$turnover_today, + 'profit_today'=>$profit_today, + 'cost_today'=>$cost_today, + 'deposit_today'=>$deposit_today, + 'cash_today'=>$cash_today, + ], + 'all'=>[ + 'turnover_all'=>$turnover_all, + 'profit_all'=>$profit_all, + 'cost_all'=>$cost_all, + 'deposit_all'=>$deposit_all, + 'cash_all'=>$cash_all, + ], + 'time'=>$newArr + ]; + + + // 可以选时间 当日订单数 本月订单数 拆分线上和线下的方式 ---v.01 + /* if($params['start_time'] && $params['end_time']){ + $startTime = $params['start_time']; + $endTime = $params['end_time']; + $endTime = date('Y-m-d', strtotime($endTime) + 86400); + }else{ + $startTime = date('Y-m-d',time()); + $endTime = date('Y-m-d', strtotime($startTime) + 86400); + } + + //当日订单和当月订单 + $base = StoreOrder::where('paid',YesNoEnum::YES); + $offline_order_today_num =$base + ->whereIn('shipping_type',OrderEnum::OFFLINE) + ->whereDay('create_time') + ->count(); + + $offline_order_today_month = $base + ->whereIn('shipping_type',OrderEnum::OFFLINE) + ->whereMonth('create_time') + ->count(); + //条码收银的-->微信和支付宝的没那个 + + //线下现金收银 + whereIn('pay_type',[OrderEnum::CASHIER_ORDER_PAY, + OrderEnum::CASHIER_ORDER_ALI_PAY,OrderEnum::CASHIER_FACE_PAY]) + $cash = StoreCashFinanceFlow::where('store_id',$params['store_id']) + ->whereBetweenTime('create_time', $startTime, $endTime) + ->where('status',YesNoEnum::YES); + $cash_count = $cash->count(); + $cash_receipt = $cash->sum('receipts');*/ + + } + + + public static function getLastSevenDays() + { + $dates = []; + $today = new \DateTime(); // 获取当前日期 + + for ($i = 0; $i < 30; $i++) { + $date = clone $today; // 克隆当前日期对象,以避免修改原始对象 + $date->modify("-$i day"); // 减去相应的天数 + $dates[] = $date->format('Y-m-d'); // 格式化日期并添加到数组中 + } + + return $dates; + } + + + public static function dealSearch($store_id,$startTime) + { + $endTime = date('Y-m-d', strtotime($startTime) + 86400); + //当日营业额的统计 当日利润的统计 当日成本合集的统计 当日加到保证金的 当日的现金收银 + $today = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$store_id]); + $turnover_today = $today + ->whereBetweenTime('create_time', $startTime, $endTime) + ->sum('pay_price'); + $profit_today = $today + ->whereBetweenTime('create_time', $startTime, $endTime) + ->sum('profit'); + $cost_today = $today + ->whereBetweenTime('create_time', $startTime, $endTime) + ->sum('cost'); + + $deposit = StoreFinanceFlow::where(['store_id'=>$store_id]) + ->where('financial_type',OrderEnum::ORDER_MARGIN); + $deposit_today =$deposit + ->whereBetweenTime('create_time', $startTime, $endTime) + ->sum('number'); + + $cash_today = StoreCashFinanceFlow::where('store_id',$store_id) + ->whereBetweenTime('create_time', $startTime, $endTime) + ->where('status',YesNoEnum::YES) + ->sum('receipts'); + return [ + 'turnover_today'=>$turnover_today, + 'profit_today'=>$profit_today, + 'cost_today'=>$cost_today, + 'deposit_today'=>$deposit_today, + 'cash_today'=>$cash_today, + ]; + + } + + + + + + } From 192169542e1217af42f1b252d5ff28c9b5b90729 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 13 Jun 2024 17:49:42 +0800 Subject: [PATCH 003/145] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=86=E7=B1=BB=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreBranchProductLogic.php | 4 +-- .../logic/store_product/StoreProductLogic.php | 14 ++++----- app/api/controller/IndexController.php | 8 +++-- app/common/logic/PayNotifyLogic.php | 1 + app/queue/redis/StoreStorageSend.php | 2 +- app/store/controller/cate/CateController.php | 31 +++++++++++++++++++ .../StoreBranchProductLogic.php | 23 -------------- .../logic/store_product/StoreProductLogic.php | 23 -------------- 8 files changed, 48 insertions(+), 58 deletions(-) create mode 100644 app/store/controller/cate/CateController.php diff --git a/app/admin/logic/store_branch_product/StoreBranchProductLogic.php b/app/admin/logic/store_branch_product/StoreBranchProductLogic.php index 7222a920a..8ff39dd8a 100644 --- a/app/admin/logic/store_branch_product/StoreBranchProductLogic.php +++ b/app/admin/logic/store_branch_product/StoreBranchProductLogic.php @@ -69,7 +69,7 @@ class StoreBranchProductLogic extends BaseLogic }else{ if($params['statis']!=$StoreProduct['statis']){ if($params['statis']==1){ - StoreProductLogic::updateGoodsclass($params['cate_id']); + StoreProductLogic::updateGoodsclass($params['cate_id'],$StoreProduct['store_id']); }else{ self::store_product_cate_update($params['id'], $StoreProduct['cate_id'], $StoreProduct['store_id'],0); @@ -101,7 +101,7 @@ class StoreBranchProductLogic extends BaseLogic } } if($type==1){ - StoreProductLogic::updateGoodsclass($cate_id); + StoreProductLogic::updateGoodsclass($cate_id,$store_id); } } /** diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 7629e7066..73fb5bc12 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -177,7 +177,7 @@ class StoreProductLogic extends BaseLogic /** * 更新商品分类 */ - public static function updateGoodsclass($cate_id, $type = 0) + public static function updateGoodsclass($cate_id, $store_id=0,$type = 0) { $one = StoreCategory::where('id', $cate_id)->find(); if ($one) { @@ -185,21 +185,21 @@ class StoreProductLogic extends BaseLogic $two = StoreCategory::where('id', $one['pid'])->find(); if ($two) { if ($two['pid'] != 0) { - self::cate_update($cate_id, $two['id'], 0, 3); - self::cate_update($two['id'], $two['pid'], 0, 2); - self::cate_update($two['pid'], 0, 0, 1); + self::cate_update($cate_id, $two['id'], $store_id, 3); + self::cate_update($two['id'], $two['pid'], $store_id, 2); + self::cate_update($two['pid'], 0, $store_id, 1); } } } } - public static function cate_update($cate_id = 0, $pid = 0, $product_id = 0, $level = 1) + public static function cate_update($cate_id = 0, $pid = 0, $store_id = 0, $level = 1) { - $find = Db::name('store_product_cate')->where(['store_id' => 1, 'cate_id' => $cate_id, 'level' => $level])->find(); + $find = Db::name('store_product_cate')->where(['store_id' => $store_id, 'cate_id' => $cate_id, 'level' => $level])->find(); if ($find) { Db::name('store_product_cate')->where('id', $find['id'])->inc('count', 1)->update(); } else { - Db::name('store_product_cate')->insert(['pid' => $pid, 'store_id' => 1, 'cate_id' => $cate_id, 'count' => 1, 'level' => $level, 'create_time' => time(), 'update_time' => time()]); + Db::name('store_product_cate')->insert(['pid' => $pid, 'store_id' => $store_id, 'cate_id' => $cate_id, 'count' => 1, 'level' => $level, 'create_time' => time(), 'update_time' => time()]); } } /** diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 1205aadba..8a31ce440 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -2,9 +2,11 @@ namespace app\api\controller; +use app\admin\logic\store_product\StoreProductLogic; use app\admin\validate\tools\GenerateTableValidate; use app\admin\logic\tools\GeneratorLogic; use app\common\logic\store_order\StoreOrderLogic; +use app\common\model\store_branch_product\StoreBranchProduct; use app\common\service\pay\PayService; use app\common\service\wechat\WechatTemplate; use Exception; @@ -25,9 +27,11 @@ class IndexController extends BaseApiController public function index() { - Redis::send('push-platform-print', ['order_id' => 119]); - d(2); + $arr=StoreBranchProduct::where('store_id',5)->select(); + foreach ($arr as $item){ + StoreProductLogic::updateGoodsclass($item['cate_id'],5); + } try { $wechat = new PayService(1); $time = time(); diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 5cbe5aebe..2aaa30f04 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -79,6 +79,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']); self::afterPay($order); Redis::send('push-platform-print', ['id' => $order['id']], 60); + PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index a96e88ad4..97196696d 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -65,7 +65,7 @@ class StoreStorageSend implements Consumer if ($product_arr['stock'] > 0) { $this->storage($find, $store_id, $admin_id, $product_arr); } - StoreProductLogic::updateGoodsclass($find['cate_id']); + StoreProductLogic::updateGoodsclass($find['cate_id'],$store_id); Db::commit(); return true; } catch (\Exception $e) { diff --git a/app/store/controller/cate/CateController.php b/app/store/controller/cate/CateController.php new file mode 100644 index 000000000..870d369b9 --- /dev/null +++ b/app/store/controller/cate/CateController.php @@ -0,0 +1,31 @@ +dataLists(new CateLists()); + } + + +} diff --git a/app/store/logic/store_branch_product/StoreBranchProductLogic.php b/app/store/logic/store_branch_product/StoreBranchProductLogic.php index ad7a331ce..b08da5d3b 100644 --- a/app/store/logic/store_branch_product/StoreBranchProductLogic.php +++ b/app/store/logic/store_branch_product/StoreBranchProductLogic.php @@ -127,29 +127,6 @@ class StoreBranchProductLogic extends BaseLogic return StoreProduct::findOrEmpty($params['id'])->toArray(); } - /** - * 更新商品分类 - */ - public static function updateGoodsclass($id, $type = 0) - { - $pid = StoreCategory::where('id', $id)->value('pid'); - if ($pid) { - $goodsclass = StoreCategory::where('id', $pid)->field('pid,children')->find(); - if ($goodsclass) { - if (count($goodsclass['children']) >= 1) { - if (!in_array($id, $goodsclass['children'])) { - $arr = $goodsclass['children']; - array_push($arr, $id); - StoreCategory::where('id', $pid)->update(['children' => $arr]); - if ($goodsclass['pid'] != 0 && $type == 0) { - self::updateGoodsclass($pid, 1); - } - } - } - } - } - } - /** * @notes 商品上下架 * @param array $params diff --git a/app/store/logic/store_product/StoreProductLogic.php b/app/store/logic/store_product/StoreProductLogic.php index 1dd27998d..150040c2f 100644 --- a/app/store/logic/store_product/StoreProductLogic.php +++ b/app/store/logic/store_product/StoreProductLogic.php @@ -122,27 +122,4 @@ class StoreProductLogic extends BaseLogic { return StoreProduct::findOrEmpty($params['id'])->toArray(); } - - /** - * 更新商品分类 - */ - public static function updateGoodsclass($id, $type = 0) - { - $pid = StoreCategory::where('id', $id)->value('pid'); - if ($pid) { - $goodsclass = StoreCategory::where('id', $pid)->field('pid,children')->find(); - if ($goodsclass) { - if (count($goodsclass['children']) >= 1) { - if (!in_array($id, $goodsclass['children'])) { - $arr = $goodsclass['children']; - array_push($arr, $id); - StoreCategory::where('id', $pid)->update(['children' => $arr]); - if ($goodsclass['pid'] != 0 && $type == 0) { - self::updateGoodsclass($pid, 1); - } - } - } - } - } - } } From 2c3d82e17f8b40eaafb7bb591535d12b44275628 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 14 Jun 2024 09:15:28 +0800 Subject: [PATCH 004/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=E6=9B=B4=E6=96=B0=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/admin/logic/store_product/StoreProductLogic.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 73fb5bc12..d80c5964a 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -189,6 +189,13 @@ class StoreProductLogic extends BaseLogic self::cate_update($two['id'], $two['pid'], $store_id, 2); self::cate_update($two['pid'], 0, $store_id, 1); } + }else{ + if ($one['pid'] == 0) { + self::cate_update($one['id'], 0, $store_id, 1); + }else{ + self::cate_update($one['id'], $one['pid'], $store_id, 2); + self::cate_update($one['pid'], 0, $store_id, 1); + } } } } From 445c784d1f76f166f0d39630f89df2b0b258ae0b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 14 Jun 2024 09:48:45 +0800 Subject: [PATCH 005/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86=E3=80=81=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=92=8C=E7=94=A8=E6=88=B7=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreBranchProductLogic.php | 8 ++++---- .../logic/store_product/StoreProductLogic.php | 10 ++++++---- app/api/logic/order/OrderLogic.php | 14 ++++---------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/admin/logic/store_branch_product/StoreBranchProductLogic.php b/app/admin/logic/store_branch_product/StoreBranchProductLogic.php index 8ff39dd8a..ce3508e37 100644 --- a/app/admin/logic/store_branch_product/StoreBranchProductLogic.php +++ b/app/admin/logic/store_branch_product/StoreBranchProductLogic.php @@ -67,9 +67,9 @@ class StoreBranchProductLogic extends BaseLogic } $data['cate_id']=$params['cate_id']; }else{ - if($params['statis']!=$StoreProduct['statis']){ - if($params['statis']==1){ - StoreProductLogic::updateGoodsclass($params['cate_id'],$StoreProduct['store_id']); + if($params['status']!=$StoreProduct['status']){ + if($params['status']==1){ + StoreProductLogic::updateGoodsclass($StoreProduct['cate_id'],$StoreProduct['store_id']); }else{ self::store_product_cate_update($params['id'], $StoreProduct['cate_id'], $StoreProduct['store_id'],0); @@ -92,7 +92,7 @@ class StoreBranchProductLogic extends BaseLogic public static function store_product_cate_update($id,$cate_id,$store_id,$type=1) { $find=Db::name('store_product_cate')->where(['cate_id'=>$cate_id,'store_id'=>$store_id])->find(); - if($find['pid']>0){ + if($find &&$find['pid']>0){ $two=Db::name('store_product_cate')->where(['cate_id'=>$find['pid'],'store_id'=>$store_id])->find(); Db::name('store_product_cate')->where('id',$find['id'])->dec('count',1)->update(); Db::name('store_product_cate')->where('id',$two['id'])->dec('count',1)->update(); diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index d80c5964a..3ba94c4f0 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -145,7 +145,9 @@ class StoreProductLogic extends BaseLogic */ public static function delete(array $params): bool { - return StoreProduct::destroy($params['id']); + $res = StoreProduct::destroy($params['id']); + StoreBranchProduct::where('product_id', $params['id'])->update(['delete_time'=>time()]); + return $res; } @@ -177,7 +179,7 @@ class StoreProductLogic extends BaseLogic /** * 更新商品分类 */ - public static function updateGoodsclass($cate_id, $store_id=0,$type = 0) + public static function updateGoodsclass($cate_id, $store_id = 0, $type = 0) { $one = StoreCategory::where('id', $cate_id)->find(); if ($one) { @@ -189,10 +191,10 @@ class StoreProductLogic extends BaseLogic self::cate_update($two['id'], $two['pid'], $store_id, 2); self::cate_update($two['pid'], 0, $store_id, 1); } - }else{ + } else { if ($one['pid'] == 0) { self::cate_update($one['id'], 0, $store_id, 1); - }else{ + } else { self::cate_update($one['id'], $one['pid'], $store_id, 2); self::cate_update($one['pid'], 0, $store_id, 1); } diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index e016bff55..895a42e05 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -79,15 +79,9 @@ class OrderLogic extends BaseLogic $cart_select[$k]['price'] = $find['price']; $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 - if ($user && $user['user_ship'] >= 1) { - $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - $onePrice = bcsub($find['vip_price'], $find['cost'], 2); - }else{ - $onePrice = bcsub($find['price'], $find['cost'], 2); - } + $onePrice = bcsub($find['price'], $find['cost'], 2); + //利润 $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 $cart_select[$k]['cost'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //成本 @@ -114,7 +108,7 @@ class OrderLogic extends BaseLogic self::$cost = bcadd(self::$cost, $cart_select[$k]['cost'], 2); self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - $pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + $pay_price =self::$pay_price;// bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 $vipPrice = 0; //成本价 收益 $order = [ @@ -133,7 +127,7 @@ class OrderLogic extends BaseLogic 'shipping_type' => $params['shipping_type'] ?? 2, //配送方式 1=快递 ,2=门店自提 'activity' => '减免', 'activity_price' => self::$activity_price, - 'activities' => self::$activity_price>0?1:0, + 'activities' =>0, 'deduction_price' => self::$activity_price ]; From f0a6491adbc8039a1ffee0f50b10a43546f095fa Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Fri, 14 Jun 2024 10:54:24 +0800 Subject: [PATCH 006/145] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreBranchProductLists.php | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php index 59bb61b77..a15a4e13a 100644 --- a/app/admin/lists/store_branch_product/StoreBranchProductLists.php +++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php @@ -4,6 +4,7 @@ namespace app\admin\lists\store_branch_product; use app\admin\lists\BaseAdminDataLists; +use app\common\model\cate\Cate; use app\common\model\store_category\StoreCategory; use app\common\model\store_product_unit\StoreProductUnit; use app\common\model\system_store\SystemStore; @@ -47,7 +48,16 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI public function lists(): array { $status = $this->params['status'] ?? ''; - return StoreBranchProduct::where($this->searchWhere) + $class_all=$this->request->get('class_all'); + $where=[]; + if($class_all){ + $arr=Cate::where('pid',$class_all)->column('id'); + if($arr){ + $arr2=Cate::where('pid','in',$arr)->column('id'); + $where[]=['cate_id','in',array_merge($arr,$arr2)]; + } + } + return StoreBranchProduct::where($this->searchWhere)->where($where) ->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'status']) ->when(!empty($this->adminInfo['store_id']), function ($query) { $query->where('store_id', $this->adminInfo['store_id']); @@ -85,7 +95,16 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI public function count(): int { $status = $this->params['status'] ?? ''; - return StoreBranchProduct::where($this->searchWhere) + $class_all=$this->request->get('class_all'); + $where=[]; + if($class_all){ + $arr=Cate::where('pid',$class_all)->column('id'); + if($arr){ + $arr2=Cate::where('pid','in',$arr)->column('id'); + $where[]=['cate_id','in',array_merge($arr,$arr2)]; + } + } + return StoreBranchProduct::where($this->searchWhere)->where($where) ->when(!empty($this->adminInfo['store_id']), function ($query) { $query->where('store_id', $this->adminInfo['store_id']); }) From b1d6d23f736f6cefa3b3906c50a8a22424214c8b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 14 Jun 2024 11:50:35 +0800 Subject: [PATCH 007/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E8=AE=A2=E5=8D=95=E8=8E=B7=E5=BE=97=E7=AD=89=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E5=80=BC=E5=92=8C=E5=A4=84=E7=90=86VIP=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=AD=89=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/enum/OrderEnum.php | 12 +++- app/common/logic/PayNotifyLogic.php | 80 ++++++++++++++-------- app/common/logic/StoreFinanceFlowLogic.php | 14 ++-- 3 files changed, 67 insertions(+), 39 deletions(-) diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index 4c0560214..215162939 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -16,9 +16,14 @@ class OrderEnum * @MERCHANT_ORDER_PAY 商户订单支付 * @PLATFORM_ORDER_OBTAINS 平台订单获得 * @SUPPLIER_ORDER_OBTAINS 供应链订单获得 + * @VIP_ORDER_OBTAINS 会员订单获得 + * @VILLAGE_ORDER_OBTAINS 村长获得 + * @BRIGADE_ORDER_OBTAINS 队长获得 + * @OTHER_ORDER_OBTAINS 其他获得 * @PLATFORM_ORDER_PAY 平台订单支付 * @SYSTEM_SET 系统设置 * @OWN_GET 平台收入 + * @ORDER_MARGIN 商户保证金 */ const USER_ORDER_PAY = 1; const MERCHANT_ORDER_OBTAINS = 2; @@ -30,11 +35,12 @@ class OrderEnum const SYSTEM_SET = 8; const CASHIER_ORDER_PAY = 9;//微信条码 const CASHIER_CASH_ORDER_PAY = 10; - const ORDER_MARGIN = 11; - const ORDER_COMMITION = 12; - + const VIP_ORDER_OBTAINS = 12; const CASHIER_ORDER_ALI_PAY = 13;//支付宝条码 + const VILLAGE_ORDER_OBTAINS = 14; + const BRIGADE_ORDER_OBTAINS = 15; + const OTHER_ORDER_OBTAINS = 16; const CASHIER_FACE_PAY = 17;//现金收银 diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index d0b1e159e..f7cfcf2c2 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -12,6 +12,7 @@ use app\common\model\store_finance_flow\StoreFinanceFlow; use app\common\model\store_order\StoreOrder; use app\common\model\system_store\SystemStore; use app\common\model\user\User; +use app\common\model\user\UserAddress; use app\common\model\user\UserRecharge; use app\common\model\user\UserShip; use app\common\service\PushService; @@ -29,8 +30,8 @@ class PayNotifyLogic extends BaseLogic public static function handle($action, $orderSn, $extra = []) { - // Db::startTrans(); - // try { + Db::startTrans(); + try { if ($action != 'cash_pay' && $action != 'balancePay') { $payNotifyLogLogic = new PayNotifyLogLogic(); if ($action == 'refund') { @@ -40,13 +41,13 @@ class PayNotifyLogic extends BaseLogic } } self::$action($orderSn, $extra); - // Db::commit(); + Db::commit(); return true; - // } catch (\Exception $e) { - // Db::rollback(); - // Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile()); - // throw new \Exception($e->getMessage()); - // } + } catch (\Exception $e) { + Db::rollback(); + Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile()); + throw new \Exception($e->getMessage()); + } } /** @@ -80,7 +81,6 @@ class PayNotifyLogic extends BaseLogic 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' => '您有一笔新的订单']); - } /** @@ -106,7 +106,7 @@ class PayNotifyLogic extends BaseLogic $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) {//收银台支付 + if ($order->pay_type == OrderEnum::CASHIER_ORDER_PAY || $order->pay_type == OrderEnum::CASHIER_ORDER_ALI_PAY) { //收银台支付 $order->status = 2; } else { $capitalFlowDao = new CapitalFlowLogic($user); @@ -117,7 +117,7 @@ class PayNotifyLogic extends BaseLogic //活动期间消费 $check = DictType::where('type', 'activities')->find(); - if (isset($check) && $check['status'] == 1 && in_array($order->pay_type,[9,17])==false && $user['user_ship'] == 0) { + if (isset($check) && $check['status'] == 1 && in_array($order->pay_type, [9, 17]) == false && $user['user_ship'] == 0) { self::dealChange($order['uid']); } @@ -172,7 +172,7 @@ class PayNotifyLogic extends BaseLogic //用户的财务add $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userIncome('user_balance_recharge', 'user_recharge', $order['id'], $price); - + if ($user->isEmpty()) { return true; } @@ -183,8 +183,8 @@ class PayNotifyLogic extends BaseLogic //更新等级 self::dealLevel($uid, $user->total_recharge_amount); - if (!empty($extra['payer']['openid']) ) { - Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'],'logistics_type'=>3], 5); + if (!empty($extra['payer']['openid'])) { + Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 3], 5); } return true; } @@ -258,31 +258,51 @@ class PayNotifyLogic extends BaseLogic $financeLogic = new StoreFinanceFlowLogic(); $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); //用户单入账 + // if ($order->pay_type != 9 || $order->pay_type != 10) { + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY); //用户订单支付 //商户应该获得的钱 每个商品的price-ot_price 利润 - if (isset($order->profit) && $order->profit > 0) { - //手续费 + // if (isset($order->profit) && $order->profit > 0) { + //平台手续费 $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); - $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_COMMITION, $order['store_id']); //手续费入账 - $financeLogic->out($transaction_id, $order['profit'], OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0); //商户获得的 + $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'],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); + // $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); //剩余额度 - if ($deposit > 0 && $frozen > 0) { - $amount = min($deposit, $frozen); - $financeLogic->in($transaction_id, $amount, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id']); + $deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度 + $store_profit= bcdiv(bcmul($order['pay_price'], '0.05', 2), 1, 2); + if ($deposit > 0 ) { + if($deposit>$store_profit){ + $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'],0,$order['pay_type']); + }else{ + $money=bcsub($store_profit,$deposit,2); + $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'],0,$order['pay_type']); + $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //平台手续费 + } + }else{ + $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //平台手续费 } - //入商户帐 - if($deposit <= 0 && $frozen > 0){ - SystemStore::where('id',$order['store_id'])->inc('store_money',$frozen); + if($order['is_vip']==1 ){ + if($order['spread_uid']>0){ + $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; + $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); + $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'],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); + $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //vip订单获得 + $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'],0,$order['pay_type']); + $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //vip订单获得 + $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'],0,$order['pay_type']); + $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //vip订单获得 + $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'],0,$order['pay_type']); } - } + // } $financeLogic->save(); - } + // } } //等级处理 diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php index c1489abb8..dfcf265aa 100644 --- a/app/common/logic/StoreFinanceFlowLogic.php +++ b/app/common/logic/StoreFinanceFlowLogic.php @@ -11,6 +11,7 @@ class StoreFinanceFlowLogic extends BaseLogic public $order; public $user; + public $other_arr; public $index = 0; public $financeSn; public $list = []; @@ -24,9 +25,9 @@ class StoreFinanceFlowLogic extends BaseLogic * @param $staffId * @param $status */ - public function out($transaction_id,$number, $financialType, $storeId = 0, $staffId = 0, $status = 1) + public function out($transaction_id,$number, $financialType, $storeId = 0, $staffId = 0, $status = 1,$pay_type=7) { - $this->setData($number, $financialType, 0, $storeId, $staffId, $status,$transaction_id); + $this->setData($number, $financialType, 0, $storeId, $staffId, $status,$transaction_id,$pay_type); } /** @@ -38,12 +39,12 @@ class StoreFinanceFlowLogic extends BaseLogic * @param $staffId * @param $status */ - public function in($transaction_id,$number, $financialType, $storeId = 0, $staffId = 0, $status = 1) + public function in($transaction_id,$number, $financialType, $storeId = 0, $staffId = 0, $status = 1,$pay_type=7) { - $this->setData($number, $financialType, 1, $storeId, $staffId, $status,$transaction_id); + $this->setData($number, $financialType, 1, $storeId, $staffId, $status,$transaction_id,$pay_type); } - public function setData($number, $financialType, $pm, $storeId, $staffId, $status,$transaction_id) + public function setData($number, $financialType, $pm, $storeId, $staffId, $status,$transaction_id,$pay_type=7) { if (empty($this->financeSn)) { $this->financeSn = $this->getSn(); @@ -53,10 +54,11 @@ class StoreFinanceFlowLogic extends BaseLogic 'transaction_id' => $transaction_id, 'order_sn' => $this->order['order_id'], 'user_id' => $this->user['uid'], + 'other_uid' => $this->other_arr['vip_uid']??0, 'financial_type' => $financialType, 'financial_pm' => $pm, 'number' => $number, - 'pay_type' => PayEnum::WECHAT_PAY_MINI, + 'pay_type' => $pay_type, 'status' => $status, 'store_id' => $storeId !== '' ? $storeId : $this->order['store_id'], 'staff_id' => $staffId !== '' ? $staffId : $this->order['staff_id'], From 88e6f861ab5ada887334e500230f17389c6b5d98 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 14 Jun 2024 13:46:03 +0800 Subject: [PATCH 008/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E8=B5=84=E9=87=91=E6=B5=81=E5=90=91?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E5=AF=B9VIP=E8=AE=A2=E5=8D=95=E5=92=8C=E6=99=AE?= =?UTF-8?q?=E9=80=9A=E8=AE=A2=E5=8D=95=E7=9A=84=E5=8C=BA=E5=88=86=E5=A4=84?= =?UTF-8?q?=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 90 ++++++++++++++++------------- 1 file changed, 49 insertions(+), 41 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f7cfcf2c2..57381099b 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -259,49 +259,57 @@ class PayNotifyLogic extends BaseLogic $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); //用户订单支付 - //商户应该获得的钱 每个商品的price-ot_price 利润 - // if (isset($order->profit) && $order->profit > 0) { - //平台手续费 - $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY); //用户订单支付 + $count_frees=0; + //商户应该获得的钱 每个商品的price-ot_price 利润 + // if (isset($order->profit) && $order->profit > 0) { - $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'],0,$order['pay_type']); //平台手续费 + //平台手续费 + $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); + $count_frees=bcadd($count_frees,$fees,2); + $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 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); - if ($deposit > 0 ) { - if($deposit>$store_profit){ - $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'],0,$order['pay_type']); - }else{ - $money=bcsub($store_profit,$deposit,2); - $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'],0,$order['pay_type']); - $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //平台手续费 - } - }else{ - $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //平台手续费 - } - if($order['is_vip']==1 ){ - if($order['spread_uid']>0){ - $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; - $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); - $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'],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); - $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //vip订单获得 - $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'],0,$order['pay_type']); - $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //vip订单获得 - $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'],0,$order['pay_type']); - $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'],0,$order['pay_type']); //vip订单获得 - $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'],0,$order['pay_type']); - } - // } - $financeLogic->save(); + $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) { + $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } else { + $money = bcsub($store_profit, $deposit, 2); + $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //平台手续费 + } + } else { + $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //平台手续费 + } + if ($order['is_vip'] == 1) { + if ($order['spread_uid'] > 0) { + $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; + $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); + $count_frees=bcadd($count_frees,$fees,2); + $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 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); + + $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //vip订单获得 + $financeLogic->out($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //vip订单获得 + $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //vip订单获得 + $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } + $financeLogic->in($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //vip订单获得 + $financeLogic->out($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + // } + $financeLogic->save(); // } } From f0b2b3cc5ae4ba0983f956f75fdc2d9e572055ca Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Fri, 14 Jun 2024 13:54:37 +0800 Subject: [PATCH 009/145] =?UTF-8?q?=E5=BA=97=E9=93=BA=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialTransfersController.php | 95 +++++++++++++++ .../FinancialTransfersLists.php | 65 +++++++++++ .../FinancialTransfersLogic.php | 110 ++++++++++++++++++ .../FinancialTransfersValidate.php | 86 ++++++++++++++ .../FinancialTransfers.php | 45 +++++++ 5 files changed, 401 insertions(+) create mode 100644 app/admin/controller/financial_transfers/FinancialTransfersController.php create mode 100644 app/admin/lists/financial_transfers/FinancialTransfersLists.php create mode 100644 app/admin/logic/financial_transfers/FinancialTransfersLogic.php create mode 100644 app/admin/validate/financial_transfers/FinancialTransfersValidate.php create mode 100644 app/common/model/financial_transfers/FinancialTransfers.php diff --git a/app/admin/controller/financial_transfers/FinancialTransfersController.php b/app/admin/controller/financial_transfers/FinancialTransfersController.php new file mode 100644 index 000000000..9dc9990b7 --- /dev/null +++ b/app/admin/controller/financial_transfers/FinancialTransfersController.php @@ -0,0 +1,95 @@ +dataLists(new FinancialTransfersLists()); + } + + + /** + * @notes 添加 + * @return \think\response\Json + * @author admin + * @date 2024/06/14 10:10 + */ + public function add() + { + $params = (new FinancialTransfersValidate())->post()->goCheck('add'); + $result = FinancialTransfersLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(FinancialTransfersLogic::getError()); + } + + + /** + * @notes 编辑 + * @return \think\response\Json + * @author admin + * @date 2024/06/14 10:10 + */ + public function edit() + { + $params = (new FinancialTransfersValidate())->post()->goCheck('edit'); + $result = FinancialTransfersLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(FinancialTransfersLogic::getError()); + } + + + /** + * @notes 删除 + * @return \think\response\Json + * @author admin + * @date 2024/06/14 10:10 + */ + public function delete() + { + $params = (new FinancialTransfersValidate())->post()->goCheck('delete'); + FinancialTransfersLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取详情 + * @return \think\response\Json + * @author admin + * @date 2024/06/14 10:10 + */ + public function detail() + { + $params = (new FinancialTransfersValidate())->goCheck('detail'); + $result = FinancialTransfersLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/admin/lists/financial_transfers/FinancialTransfersLists.php b/app/admin/lists/financial_transfers/FinancialTransfersLists.php new file mode 100644 index 000000000..a9a3b9a0a --- /dev/null +++ b/app/admin/lists/financial_transfers/FinancialTransfersLists.php @@ -0,0 +1,65 @@ + ['store_id', 'admin_id', 'uid', 'status', 'initiation_time', 'confirmation_time', 'mark', 'money', 'remark_time'], + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2024/06/14 10:10 + */ + public function lists(): array + { + return FinancialTransfers::with(['store','staff','admin'])->where($this->searchWhere) +// ->field(['id', 'store_id', 'admin_id', 'status', 'initiation_time', 'confirmation_time', 'mark', 'money', 'remark_time']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author admin + * @date 2024/06/14 10:10 + */ + public function count(): int + { + return FinancialTransfers::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/admin/logic/financial_transfers/FinancialTransfersLogic.php b/app/admin/logic/financial_transfers/FinancialTransfersLogic.php new file mode 100644 index 000000000..bfde44aa3 --- /dev/null +++ b/app/admin/logic/financial_transfers/FinancialTransfersLogic.php @@ -0,0 +1,110 @@ + $params['store_id'], + 'admin_id' => $params['admin_id'], + 'uid' => $params['uid'], + 'status' => $params['status'], + 'initiation_time' => $params['initiation_time'], + 'confirmation_time' => $params['confirmation_time'], + 'mark' => $params['mark'], + 'money' => $params['money'], + 'remark_time' => $params['remark_time'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/14 10:05 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + FinancialTransfers::where('id', $params['id'])->update([ + 'store_id' => $params['store_id'], + 'admin_id' => $params['admin_id'], + 'uid' => $params['uid'], + 'status' => $params['status'], + 'initiation_time' => $params['initiation_time'], + 'confirmation_time' => $params['confirmation_time'], + 'mark' => $params['mark'], + 'money' => $params['money'], + 'remark_time' => $params['remark_time'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/14 10:05 + */ + public static function delete(array $params): bool + { + return FinancialTransfers::destroy($params['id']); + } + + + /** + * @notes 获取详情 + * @param $params + * @return array + * @author admin + * @date 2024/06/14 10:05 + */ + public static function detail($params): array + { + return FinancialTransfers::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/admin/validate/financial_transfers/FinancialTransfersValidate.php b/app/admin/validate/financial_transfers/FinancialTransfersValidate.php new file mode 100644 index 000000000..7b5e468bf --- /dev/null +++ b/app/admin/validate/financial_transfers/FinancialTransfersValidate.php @@ -0,0 +1,86 @@ + 'require', + 'store_id' => 'require', + 'money' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'store_id' => '店铺id', + 'money' => '金额', + ]; + + + /** + * @notes 添加场景 + * @return FinancialTransfersValidate + * @author admin + * @date 2024/06/14 10:10 + */ + public function sceneAdd() + { + return $this->only(['store_id','money']); + } + + + /** + * @notes 编辑场景 + * @return FinancialTransfersValidate + * @author admin + * @date 2024/06/14 10:10 + */ + public function sceneEdit() + { + return $this->only(['id','store_id','money']); + } + + + /** + * @notes 删除场景 + * @return FinancialTransfersValidate + * @author admin + * @date 2024/06/14 10:10 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return FinancialTransfersValidate + * @author admin + * @date 2024/06/14 10:10 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/common/model/financial_transfers/FinancialTransfers.php b/app/common/model/financial_transfers/FinancialTransfers.php new file mode 100644 index 000000000..ff7eaa694 --- /dev/null +++ b/app/common/model/financial_transfers/FinancialTransfers.php @@ -0,0 +1,45 @@ +hasOne(SystemStore::class, 'id','store_id') + ->bind(['store_name'=>'name', 'store_phone'=>'phone','store_detailed_address'=>'detailed_address','store_simple_address'=>'address']); + } + + + public function staff() + { + return $this->hasOne(SystemStoreStaff::class, 'id', 'store_staff_id')->bind(['staff_name']); + } + + + public function admin() + { + return $this->hasOne(Admin::class, 'id','admin_id') + ->bind(['admin_name'=>'name']); + + } + +} \ No newline at end of file From 180ac14af81823f71dd817d9ca64f9a77c543f20 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 14 Jun 2024 13:56:09 +0800 Subject: [PATCH 010/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0'swap'?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=88=B0=E5=95=86=E5=93=81=E5=AD=98=E5=82=A8?= =?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/logic/store_product/StoreProductLogic.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 3ba94c4f0..24e69d270 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -48,6 +48,7 @@ class StoreProductLogic extends BaseLogic 'purchase' => $params['purchase'], 'rose' => $params['rose'], 'is_return' => $params['is_return'], + 'swap' => $params['swap']??0, ]; // if ($params['rose'] > 0) { // $rose_price = bcmul($params['cost'], $params['rose'], 2); @@ -119,6 +120,7 @@ class StoreProductLogic extends BaseLogic 'price' => $params['price'], 'vip_price' => $params['vip_price'], 'cost' => $params['cost'], + 'swap' => $params['swap']??0, ]; StoreProduct::where('id', $params['id'])->update($data); From 12ad62e4f5feb2a54b84a43348cac61c9ed2b399 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Fri, 14 Jun 2024 14:07:03 +0800 Subject: [PATCH 011/145] =?UTF-8?q?=E5=8F=91=E9=80=81=E7=BB=99=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E7=A1=AE=E8=AE=A4=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialTransfersController.php | 16 ++++++++++++ .../FinancialTransfersLogic.php | 25 +++++++++++++++++++ .../FinancialTransfersValidate.php | 7 ++++++ 3 files changed, 48 insertions(+) diff --git a/app/admin/controller/financial_transfers/FinancialTransfersController.php b/app/admin/controller/financial_transfers/FinancialTransfersController.php index 9dc9990b7..bda5429fe 100644 --- a/app/admin/controller/financial_transfers/FinancialTransfersController.php +++ b/app/admin/controller/financial_transfers/FinancialTransfersController.php @@ -29,6 +29,22 @@ class FinancialTransfersController extends BaseAdminController return $this->dataLists(new FinancialTransfersLists()); } + public function send_transfers() + { + $params = (new FinancialTransfersValidate())->post()->goCheck('send'); + $result = FinancialTransfersLogic::dealsend($params); + + if (true === $result) { + return $this->success('发送成功', [], ); + } + return $this->fail(FinancialTransfersLogic::getError()); + + } + + + + + /** * @notes 添加 diff --git a/app/admin/logic/financial_transfers/FinancialTransfersLogic.php b/app/admin/logic/financial_transfers/FinancialTransfersLogic.php index bfde44aa3..05626665c 100644 --- a/app/admin/logic/financial_transfers/FinancialTransfersLogic.php +++ b/app/admin/logic/financial_transfers/FinancialTransfersLogic.php @@ -107,4 +107,29 @@ class FinancialTransfersLogic extends BaseLogic { return FinancialTransfers::findOrEmpty($params['id'])->toArray(); } + + public static function dealsend($params) + { + Db::startTrans(); + try { + FinancialTransfers::where('id',$params['id']) + ->update( + [ + 'status'=>1, + 'initiation_time'=>time() + ] + ); + + Db::commit(); + return true; + }catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + + + } + + } \ No newline at end of file diff --git a/app/admin/validate/financial_transfers/FinancialTransfersValidate.php b/app/admin/validate/financial_transfers/FinancialTransfersValidate.php index 7b5e468bf..f655002f3 100644 --- a/app/admin/validate/financial_transfers/FinancialTransfersValidate.php +++ b/app/admin/validate/financial_transfers/FinancialTransfersValidate.php @@ -36,6 +36,13 @@ class FinancialTransfersValidate extends BaseValidate ]; + public function sceneSend() + { + return $this->only(['id']); + } + + + /** * @notes 添加场景 * @return FinancialTransfersValidate From 78f238e67c3fa46a67ec7cbbcbb18e660f44834f Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 14 Jun 2024 14:15:11 +0800 Subject: [PATCH 012/145] =?UTF-8?q?feat(StoreOrderLogic):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86=E8=AE=A1=E7=AE=97=E4=BB=B7=E6=A0=BC=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=AE=8C=E5=96=84=E4=BA=86=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=BF=A1=E6=81=AF=E7=9A=84=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/store_order/StoreOrderLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index c1111141a..512c18b7b 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -47,7 +47,7 @@ class StoreOrderLogic extends BaseLogic /** 计算价格 */ foreach ($cart_select as $k => $v) { - $find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,cost price,cost,product_id')->find(); + $find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,price,cost,product_id')->find(); if (!$find) { continue; } From a21727f09b97d0b7eb0061814833fbaf5ace666a Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Fri, 14 Jun 2024 15:06:09 +0800 Subject: [PATCH 013/145] =?UTF-8?q?=E5=BA=97=E9=93=BA=E6=8F=90=E7=8E=B0?= =?UTF-8?q?=E5=88=97=E8=A1=A8,=E5=90=8E=E5=8F=B0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=95=86=E6=88=B7=E7=9A=84=E6=8F=90=E7=8E=B0=E9=93=B6=E8=A1=8C?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/system_store/SystemStoreLists.php | 4 +- .../FinancialTransfersLogic.php | 22 ++++++ .../logic/system_store/SystemStoreLogic.php | 8 ++ .../FinancialTransfersValidate.php | 8 ++ .../finance/FinancialTransfersController.php | 75 +++++++++++++++++++ 5 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 app/store/controller/finance/FinancialTransfersController.php diff --git a/app/admin/lists/system_store/SystemStoreLists.php b/app/admin/lists/system_store/SystemStoreLists.php index 40b3804ea..d961fcce8 100644 --- a/app/admin/lists/system_store/SystemStoreLists.php +++ b/app/admin/lists/system_store/SystemStoreLists.php @@ -44,7 +44,9 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac public function lists(): array { return SystemStore::where($this->searchWhere) - ->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show','day_start','day_end']) + ->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show','day_start','day_end' + ,'bank','bank_code','bank_address','realname' + ]) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item){ diff --git a/app/admin/logic/financial_transfers/FinancialTransfersLogic.php b/app/admin/logic/financial_transfers/FinancialTransfersLogic.php index 05626665c..4f48f25ab 100644 --- a/app/admin/logic/financial_transfers/FinancialTransfersLogic.php +++ b/app/admin/logic/financial_transfers/FinancialTransfersLogic.php @@ -130,6 +130,28 @@ class FinancialTransfersLogic extends BaseLogic } + + + public static function storeConfirmation($params,$id) + { + + Db::startTrans(); + try { + FinancialTransfers::where('id',$id) + ->update( + $params + ); + + Db::commit(); + return true; + }catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + + + } } \ No newline at end of file diff --git a/app/admin/logic/system_store/SystemStoreLogic.php b/app/admin/logic/system_store/SystemStoreLogic.php index 853247438..695ea00b6 100644 --- a/app/admin/logic/system_store/SystemStoreLogic.php +++ b/app/admin/logic/system_store/SystemStoreLogic.php @@ -45,6 +45,10 @@ class SystemStoreLogic extends BaseLogic 'province' => $params['province_code'], 'city' => $params['city_code'], 'area' => $params['area_code'], + 'bank' => $params['bank']??'', + 'bank_code' => $params['bank_code']??'', + 'bank_address' => $params['bank_address']??'', + 'realname' => $params['realname']??'', 'street' => $params['street_code'], 'is_store' => $params['is_store'] ?? 0, 'is_send' => $params['is_send'] ?? 0, @@ -102,6 +106,10 @@ class SystemStoreLogic extends BaseLogic 'day_time' => $params['day_time'] ?? 0, 'is_store' => $params['is_store'] ?? 0, 'is_send' => $params['is_send'] ?? 0, + 'bank' => $params['bank']??'', + 'bank_code' => $params['bank_code']??'', + 'bank_address' => $params['bank_address']??'', + 'realname' => $params['realname']??'', 'default_delivery' => $params['default_delivery'] ?? 2, ]); $res=SystemStoreStaff::where('store_id', $params['id'])->where('is_admin', 1)->where('account', $params['phone'])->find(); diff --git a/app/admin/validate/financial_transfers/FinancialTransfersValidate.php b/app/admin/validate/financial_transfers/FinancialTransfersValidate.php index f655002f3..fa8286646 100644 --- a/app/admin/validate/financial_transfers/FinancialTransfersValidate.php +++ b/app/admin/validate/financial_transfers/FinancialTransfersValidate.php @@ -22,6 +22,7 @@ class FinancialTransfersValidate extends BaseValidate 'id' => 'require', 'store_id' => 'require', 'money' => 'require', + 'status' => 'require|number', ]; @@ -33,6 +34,7 @@ class FinancialTransfersValidate extends BaseValidate 'id' => 'id', 'store_id' => '店铺id', 'money' => '金额', + 'status' => '状态', ]; @@ -42,6 +44,12 @@ class FinancialTransfersValidate extends BaseValidate } + public function sceneConfirm() + { + return $this->only(['id','status']); + } + + /** * @notes 添加场景 diff --git a/app/store/controller/finance/FinancialTransfersController.php b/app/store/controller/finance/FinancialTransfersController.php new file mode 100644 index 000000000..5278a430a --- /dev/null +++ b/app/store/controller/finance/FinancialTransfersController.php @@ -0,0 +1,75 @@ +dataLists(new FinancialTransfersLists()); + } + + + #[ + ApiDoc\Title('店铺确认'), + ApiDoc\url('/store/finance/financialTransfers/confirmation'), + ApiDoc\Method('POST'), + ApiDoc\NotHeaders(), + ApiDoc\Author('中国队长'), + ApiDoc\Query(name: 'status', type: 'int', require: true, desc: '状态1确认 0不确认'), + ApiDoc\Query(name: 'id', type: 'int', require: true, desc: '数据id'), + ApiDoc\Query(name: 'mark', type: 'string', require: false, desc: '原因/备注'), + ApiDoc\Header(ref: [Definitions::class, "token"]), + ApiDoc\Query(ref: [Definitions::class, "page"]), + ApiDoc\ResponseSuccess("data", type: "array"), + ] + public function confirmation() + { + $params = (new FinancialTransfersValidate())->post()->goCheck('confirm'); + + $staff_id = $this->request->adminInfo['admin_id']??5; + $data = [ + 'store_staff_id' => $staff_id, + 'mark' => $params['mark']??'', + ]; + $status = -2; + if ($params['status']) { + $status = 2; + $data['confirmation_time'] = time(); + } + $data['status'] = $status; + $result = FinancialTransfersLogic::storeConfirmation($data,$params['id']); + + if (true === $result) { + return $this->success('操作成功' ); + } + return $this->fail(FinancialTransfersLogic::getError()); + + + + } + + +} \ No newline at end of file From 3bbf9476742224f1fbf93d3ea3bea659d683235b Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Fri, 14 Jun 2024 15:34:50 +0800 Subject: [PATCH 014/145] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=87=AD=E8=AF=81=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialTransfersController.php | 27 ++++++++++++++++++- .../FinancialTransfersLogic.php | 7 +++-- .../FinancialTransfersValidate.php | 7 +++++ .../FinancialTransfers.php | 2 +- .../finance/FinancialTransfersController.php | 2 +- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/app/admin/controller/financial_transfers/FinancialTransfersController.php b/app/admin/controller/financial_transfers/FinancialTransfersController.php index bda5429fe..c014be0b8 100644 --- a/app/admin/controller/financial_transfers/FinancialTransfersController.php +++ b/app/admin/controller/financial_transfers/FinancialTransfersController.php @@ -29,17 +29,42 @@ class FinancialTransfersController extends BaseAdminController return $this->dataLists(new FinancialTransfersLists()); } + //确认 public function send_transfers() { $params = (new FinancialTransfersValidate())->post()->goCheck('send'); $result = FinancialTransfersLogic::dealsend($params); if (true === $result) { - return $this->success('发送成功', [], ); + return $this->success('发送成功', [],1,1 ); } return $this->fail(FinancialTransfersLogic::getError()); } + + //财务上传凭证 + public function success_send() + { + $params = (new FinancialTransfersValidate())->post()->goCheck('success'); + $update = [ + 'transfer_picture'=>$params['transfer_picture'] + ]; + $update['status'] = -1; + if($params['status']){ + $update['status'] = 3; + $update['pay_status'] = 1; + } + $update['fail_msg'] = $params['fail_msg']??''; + $result = FinancialTransfersLogic::dealchange($update,$params['id']); + + if (true === $result) { + return $this->success('转账成功' ); + } + return $this->fail(FinancialTransfersLogic::getError()); + + } + + diff --git a/app/admin/logic/financial_transfers/FinancialTransfersLogic.php b/app/admin/logic/financial_transfers/FinancialTransfersLogic.php index 4f48f25ab..8a571e70e 100644 --- a/app/admin/logic/financial_transfers/FinancialTransfersLogic.php +++ b/app/admin/logic/financial_transfers/FinancialTransfersLogic.php @@ -132,9 +132,8 @@ class FinancialTransfersLogic extends BaseLogic } - public static function storeConfirmation($params,$id) + public static function dealchange($params,$id) { - Db::startTrans(); try { FinancialTransfers::where('id',$id) @@ -150,8 +149,8 @@ class FinancialTransfersLogic extends BaseLogic return false; } - + } - + } \ No newline at end of file diff --git a/app/admin/validate/financial_transfers/FinancialTransfersValidate.php b/app/admin/validate/financial_transfers/FinancialTransfersValidate.php index fa8286646..ff106e15b 100644 --- a/app/admin/validate/financial_transfers/FinancialTransfersValidate.php +++ b/app/admin/validate/financial_transfers/FinancialTransfersValidate.php @@ -23,6 +23,7 @@ class FinancialTransfersValidate extends BaseValidate 'store_id' => 'require', 'money' => 'require', 'status' => 'require|number', + 'transfer_picture' => 'require', ]; @@ -35,6 +36,7 @@ class FinancialTransfersValidate extends BaseValidate 'store_id' => '店铺id', 'money' => '金额', 'status' => '状态', + 'transfer_picture' => '财务上传凭证', ]; @@ -49,6 +51,11 @@ class FinancialTransfersValidate extends BaseValidate return $this->only(['id','status']); } + public function sceneSuccess() + { + return $this->only(['id','transfer_picture','status']); + } + /** diff --git a/app/common/model/financial_transfers/FinancialTransfers.php b/app/common/model/financial_transfers/FinancialTransfers.php index ff7eaa694..dede4d2f9 100644 --- a/app/common/model/financial_transfers/FinancialTransfers.php +++ b/app/common/model/financial_transfers/FinancialTransfers.php @@ -25,7 +25,7 @@ class FinancialTransfers extends BaseModel public function store() { return $this->hasOne(SystemStore::class, 'id','store_id') - ->bind(['store_name'=>'name', 'store_phone'=>'phone','store_detailed_address'=>'detailed_address','store_simple_address'=>'address']); + ->bind(['store_name'=>'name', 'store_phone'=>'phone','store_detailed_address'=>'detailed_address','store_simple_address'=>'address','store_bank'=>'bank','store_bank_code'=>'bank_code','store_bank_address'=>'bank_address','store_realName'=>'realname']); } diff --git a/app/store/controller/finance/FinancialTransfersController.php b/app/store/controller/finance/FinancialTransfersController.php index 5278a430a..850222a6a 100644 --- a/app/store/controller/finance/FinancialTransfersController.php +++ b/app/store/controller/finance/FinancialTransfersController.php @@ -60,7 +60,7 @@ class FinancialTransfersController extends BaseAdminController $data['confirmation_time'] = time(); } $data['status'] = $status; - $result = FinancialTransfersLogic::storeConfirmation($data,$params['id']); + $result = FinancialTransfersLogic::dealchange($data,$params['id']); if (true === $result) { return $this->success('操作成功' ); From e14290ef828ed8dfb112eb9892d3253b9f227aea Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 14 Jun 2024 15:53:47 +0800 Subject: [PATCH 015/145] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=20API=20?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/user/UserLogic.php | 28 + app/admin/validate/user/UserValidate.php | 20 +- app/api/controller/BaseApiController.php | 3 +- app/api/controller/IndexController.php | 97 ++- app/api/controller/LoginController.php | 3 +- app/api/controller/PayController.php | 3 +- app/api/controller/UploadController.php | 3 +- app/api/controller/cate/CateController.php | 3 +- app/api/controller/order/CartController.php | 3 +- app/api/controller/order/OrderController.php | 274 ++++--- .../controller/product/ProductController.php | 3 +- app/api/controller/shop/IndexController.php | 3 +- .../store/ProductRecordController.php | 2 - app/api/controller/store/StoreController.php | 3 +- .../store/TransactionRecordController.php | 3 +- app/api/controller/user/AddressController.php | 3 +- app/api/controller/user/UserController.php | 113 ++- .../user/UserFeedbackController.php | 3 +- .../controller/user/UserVisitController.php | 42 +- app/common/controller/BaseLikeController.php | 11 +- app/common/controller/Definitions.php | 15 +- app/common/lists/user/UserShipLists.php | 60 ++ app/store/controller/BaseAdminController.php | 4 +- app/store/controller/ConfigController.php | 126 ++- app/store/controller/DeliveryController.php | 160 ++-- app/store/controller/DownloadController.php | 3 +- app/store/controller/FileController.php | 119 ++- app/store/controller/LoginController.php | 49 +- app/store/controller/StaffController.php | 187 +++-- app/store/controller/UploadController.php | 4 +- app/store/controller/WorkbenchController.php | 179 +++-- app/store/controller/auth/AdminController.php | 115 ++- app/store/controller/auth/MenuController.php | 3 +- app/store/controller/auth/RoleController.php | 4 +- app/store/controller/cart/CartController.php | 3 +- app/store/controller/cate/CateController.php | 3 +- .../controller/finance/FinanceController.php | 77 +- .../finance/StoreBillController.php | 61 +- .../store_order/StoreOrderController.php | 135 ++-- .../StoreRefundOrderController.php | 111 ++- .../store_product/StoreProductController.php | 245 +++--- .../store_product/StoreStorageController.php | 45 +- .../StoreProductAttrValueController.php | 111 ++- .../SystemStoreStorageController.php | 15 +- app/store/controller/user/UserController.php | 41 + .../controller/user/UserShipController.php | 18 + app/store/lists/user/UserLists.php | 60 ++ composer.json | 1 - composer.lock | 71 +- config/plugin/hg/apidoc/app.php | 105 --- config/plugin/hg/apidoc/route.php | 3 - vendor/composer/autoload_psr4.php | 1 - vendor/composer/autoload_static.php | 8 - vendor/composer/installed.json | 72 -- vendor/composer/installed.php | 21 +- vendor/hg/apidoc/.gitignore | 1 - vendor/hg/apidoc/LICENSE | 21 - vendor/hg/apidoc/README.md | 88 --- vendor/hg/apidoc/composer.json | 50 -- vendor/hg/apidoc/src/Auth.php | 192 ----- vendor/hg/apidoc/src/ConfigProvider.php | 24 - vendor/hg/apidoc/src/Controller.php | 451 ----------- vendor/hg/apidoc/src/Install.php | 56 -- vendor/hg/apidoc/src/annotation/AddField.php | 84 -- vendor/hg/apidoc/src/annotation/After.php | 59 -- vendor/hg/apidoc/src/annotation/Author.php | 25 - vendor/hg/apidoc/src/annotation/Before.php | 57 -- .../hg/apidoc/src/annotation/ContentType.php | 25 - vendor/hg/apidoc/src/annotation/Desc.php | 25 - vendor/hg/apidoc/src/annotation/EventBase.php | 80 -- vendor/hg/apidoc/src/annotation/Field.php | 25 - vendor/hg/apidoc/src/annotation/Group.php | 24 - vendor/hg/apidoc/src/annotation/Header.php | 50 -- vendor/hg/apidoc/src/annotation/Md.php | 35 - vendor/hg/apidoc/src/annotation/Method.php | 25 - vendor/hg/apidoc/src/annotation/NotDebug.php | 22 - .../src/annotation/NotDefaultAuthor.php | 22 - .../hg/apidoc/src/annotation/NotHeaders.php | 22 - vendor/hg/apidoc/src/annotation/NotParams.php | 22 - vendor/hg/apidoc/src/annotation/NotParse.php | 24 - vendor/hg/apidoc/src/annotation/NotQuerys.php | 22 - .../src/annotation/NotResponseError.php | 22 - .../src/annotation/NotResponseSuccess.php | 22 - .../hg/apidoc/src/annotation/NotResponses.php | 22 - vendor/hg/apidoc/src/annotation/Param.php | 62 -- vendor/hg/apidoc/src/annotation/ParamBase.php | 88 --- vendor/hg/apidoc/src/annotation/ParamType.php | 25 - vendor/hg/apidoc/src/annotation/Property.php | 62 -- vendor/hg/apidoc/src/annotation/Query.php | 61 -- .../apidoc/src/annotation/ResponseError.php | 52 -- .../apidoc/src/annotation/ResponseErrorMd.php | 35 - .../apidoc/src/annotation/ResponseSuccess.php | 60 -- .../src/annotation/ResponseSuccessMd.php | 35 - vendor/hg/apidoc/src/annotation/Returned.php | 62 -- .../apidoc/src/annotation/RouteMiddleware.php | 26 - .../hg/apidoc/src/annotation/RouteParam.php | 51 -- vendor/hg/apidoc/src/annotation/Sort.php | 25 - vendor/hg/apidoc/src/annotation/Tag.php | 25 - vendor/hg/apidoc/src/annotation/Title.php | 25 - vendor/hg/apidoc/src/annotation/Url.php | 25 - .../hg/apidoc/src/annotation/WithoutField.php | 25 - vendor/hg/apidoc/src/config.php | 106 --- .../src/config/plugin/hg/apidoc/app.php | 97 --- .../src/config/plugin/hg/apidoc/route.php | 3 - .../apidoc/src/exception/ErrorException.php | 64 -- .../hg/apidoc/src/exception/HttpException.php | 33 - vendor/hg/apidoc/src/generator/Index.php | 358 --------- .../hg/apidoc/src/generator/ParseTemplate.php | 341 -------- .../src/middleware/HyperfMiddleware.php | 81 -- .../src/middleware/LaravelMiddleware.php | 17 - .../src/middleware/ThinkPHPMiddleware.php | 17 - .../src/middleware/WebmanMiddleware.php | 88 --- .../hg/apidoc/src/parses/ParseAnnotation.php | 218 ----- .../hg/apidoc/src/parses/ParseApiDetail.php | 743 ------------------ vendor/hg/apidoc/src/parses/ParseApiMenus.php | 318 -------- .../apidoc/src/parses/ParseCodeTemplate.php | 100 --- vendor/hg/apidoc/src/parses/ParseMarkdown.php | 139 ---- vendor/hg/apidoc/src/parses/ParseModel.php | 162 ---- .../hg/apidoc/src/providers/BaseService.php | 172 ---- .../hg/apidoc/src/providers/CommonService.php | 56 -- .../hg/apidoc/src/providers/HyperfService.php | 52 -- .../apidoc/src/providers/LaravelService.php | 110 --- .../apidoc/src/providers/ThinkPHP5Service.php | 94 --- .../apidoc/src/providers/ThinkPHPService.php | 107 --- .../hg/apidoc/src/providers/WebmanService.php | 43 - .../apidoc/src/utils/AbstractAnnotation.php | 36 - vendor/hg/apidoc/src/utils/ApiCrossDomain.php | 22 - vendor/hg/apidoc/src/utils/ApiShare.php | 165 ---- .../hg/apidoc/src/utils/AutoRegisterRouts.php | 154 ---- vendor/hg/apidoc/src/utils/Cache.php | 298 ------- vendor/hg/apidoc/src/utils/ConfigProvider.php | 99 --- vendor/hg/apidoc/src/utils/DirAndFile.php | 258 ------ vendor/hg/apidoc/src/utils/Helper.php | 578 -------------- vendor/hg/apidoc/src/utils/Lang.php | 59 -- vendor/hg/apidoc/src/utils/Request.php | 46 -- 135 files changed, 1390 insertions(+), 9043 deletions(-) create mode 100644 app/common/lists/user/UserShipLists.php create mode 100644 app/store/controller/user/UserController.php create mode 100644 app/store/controller/user/UserShipController.php create mode 100644 app/store/lists/user/UserLists.php delete mode 100644 config/plugin/hg/apidoc/app.php delete mode 100644 config/plugin/hg/apidoc/route.php delete mode 100644 vendor/hg/apidoc/.gitignore delete mode 100644 vendor/hg/apidoc/LICENSE delete mode 100644 vendor/hg/apidoc/README.md delete mode 100644 vendor/hg/apidoc/composer.json delete mode 100644 vendor/hg/apidoc/src/Auth.php delete mode 100644 vendor/hg/apidoc/src/ConfigProvider.php delete mode 100644 vendor/hg/apidoc/src/Controller.php delete mode 100644 vendor/hg/apidoc/src/Install.php delete mode 100644 vendor/hg/apidoc/src/annotation/AddField.php delete mode 100644 vendor/hg/apidoc/src/annotation/After.php delete mode 100644 vendor/hg/apidoc/src/annotation/Author.php delete mode 100644 vendor/hg/apidoc/src/annotation/Before.php delete mode 100644 vendor/hg/apidoc/src/annotation/ContentType.php delete mode 100644 vendor/hg/apidoc/src/annotation/Desc.php delete mode 100644 vendor/hg/apidoc/src/annotation/EventBase.php delete mode 100644 vendor/hg/apidoc/src/annotation/Field.php delete mode 100644 vendor/hg/apidoc/src/annotation/Group.php delete mode 100644 vendor/hg/apidoc/src/annotation/Header.php delete mode 100644 vendor/hg/apidoc/src/annotation/Md.php delete mode 100644 vendor/hg/apidoc/src/annotation/Method.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotDebug.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotDefaultAuthor.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotHeaders.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotParams.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotParse.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotQuerys.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotResponseError.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotResponseSuccess.php delete mode 100644 vendor/hg/apidoc/src/annotation/NotResponses.php delete mode 100644 vendor/hg/apidoc/src/annotation/Param.php delete mode 100644 vendor/hg/apidoc/src/annotation/ParamBase.php delete mode 100644 vendor/hg/apidoc/src/annotation/ParamType.php delete mode 100644 vendor/hg/apidoc/src/annotation/Property.php delete mode 100644 vendor/hg/apidoc/src/annotation/Query.php delete mode 100644 vendor/hg/apidoc/src/annotation/ResponseError.php delete mode 100644 vendor/hg/apidoc/src/annotation/ResponseErrorMd.php delete mode 100644 vendor/hg/apidoc/src/annotation/ResponseSuccess.php delete mode 100644 vendor/hg/apidoc/src/annotation/ResponseSuccessMd.php delete mode 100644 vendor/hg/apidoc/src/annotation/Returned.php delete mode 100644 vendor/hg/apidoc/src/annotation/RouteMiddleware.php delete mode 100644 vendor/hg/apidoc/src/annotation/RouteParam.php delete mode 100644 vendor/hg/apidoc/src/annotation/Sort.php delete mode 100644 vendor/hg/apidoc/src/annotation/Tag.php delete mode 100644 vendor/hg/apidoc/src/annotation/Title.php delete mode 100644 vendor/hg/apidoc/src/annotation/Url.php delete mode 100644 vendor/hg/apidoc/src/annotation/WithoutField.php delete mode 100644 vendor/hg/apidoc/src/config.php delete mode 100644 vendor/hg/apidoc/src/config/plugin/hg/apidoc/app.php delete mode 100644 vendor/hg/apidoc/src/config/plugin/hg/apidoc/route.php delete mode 100644 vendor/hg/apidoc/src/exception/ErrorException.php delete mode 100644 vendor/hg/apidoc/src/exception/HttpException.php delete mode 100644 vendor/hg/apidoc/src/generator/Index.php delete mode 100644 vendor/hg/apidoc/src/generator/ParseTemplate.php delete mode 100644 vendor/hg/apidoc/src/middleware/HyperfMiddleware.php delete mode 100644 vendor/hg/apidoc/src/middleware/LaravelMiddleware.php delete mode 100644 vendor/hg/apidoc/src/middleware/ThinkPHPMiddleware.php delete mode 100644 vendor/hg/apidoc/src/middleware/WebmanMiddleware.php delete mode 100644 vendor/hg/apidoc/src/parses/ParseAnnotation.php delete mode 100644 vendor/hg/apidoc/src/parses/ParseApiDetail.php delete mode 100644 vendor/hg/apidoc/src/parses/ParseApiMenus.php delete mode 100644 vendor/hg/apidoc/src/parses/ParseCodeTemplate.php delete mode 100644 vendor/hg/apidoc/src/parses/ParseMarkdown.php delete mode 100644 vendor/hg/apidoc/src/parses/ParseModel.php delete mode 100644 vendor/hg/apidoc/src/providers/BaseService.php delete mode 100644 vendor/hg/apidoc/src/providers/CommonService.php delete mode 100644 vendor/hg/apidoc/src/providers/HyperfService.php delete mode 100644 vendor/hg/apidoc/src/providers/LaravelService.php delete mode 100644 vendor/hg/apidoc/src/providers/ThinkPHP5Service.php delete mode 100644 vendor/hg/apidoc/src/providers/ThinkPHPService.php delete mode 100644 vendor/hg/apidoc/src/providers/WebmanService.php delete mode 100644 vendor/hg/apidoc/src/utils/AbstractAnnotation.php delete mode 100644 vendor/hg/apidoc/src/utils/ApiCrossDomain.php delete mode 100644 vendor/hg/apidoc/src/utils/ApiShare.php delete mode 100644 vendor/hg/apidoc/src/utils/AutoRegisterRouts.php delete mode 100644 vendor/hg/apidoc/src/utils/Cache.php delete mode 100644 vendor/hg/apidoc/src/utils/ConfigProvider.php delete mode 100644 vendor/hg/apidoc/src/utils/DirAndFile.php delete mode 100644 vendor/hg/apidoc/src/utils/Helper.php delete mode 100644 vendor/hg/apidoc/src/utils/Lang.php delete mode 100644 vendor/hg/apidoc/src/utils/Request.php diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index aaa9bf58e..353b97607 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -63,6 +63,34 @@ class UserLogic extends BaseLogic return false; } } + + public static function StoreAdd(array $params) + { + $passwordSalt = Config::get('project.unique_identification'); + $password = create_password($params['password'], $passwordSalt); + $defaultAvatar = config('project.default_image.admin_avatar'); + $avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar; + + Db::startTrans(); + try { + $res=User::create([ + 'avatar' => $avatar, + 'real_name' =>'', + 'nickname' => '用户'.time(), + 'account' => $params['mobile'], + 'password' => $password, + 'mobile' => $params['mobile'], + 'user_money' => $params['user_money'] + ]); + + Db::commit(); + return $res; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } /** * @notes 编辑用户列表 * @param array $params diff --git a/app/admin/validate/user/UserValidate.php b/app/admin/validate/user/UserValidate.php index b6a91c8ee..43df446b7 100644 --- a/app/admin/validate/user/UserValidate.php +++ b/app/admin/validate/user/UserValidate.php @@ -27,7 +27,14 @@ class UserValidate extends BaseValidate 'mobile' => 'require|mobile', 'is_disable' => 'in:0,1', 'sex' => 'in:1,2', - 'user_money' => 'float' + 'user_money' => 'float', + 'province' => 'require', + 'city' => 'require', + 'district' => 'require', + 'street' => 'require', + 'village' => 'require', + 'brigade' => 'require', + 'user_ship' => 'require', ]; @@ -45,6 +52,13 @@ class UserValidate extends BaseValidate 'is_disable' => '是否禁用', 'sex' => '用户性别', 'user_money' => '用户余额', + 'province' => '省', + 'city' => '市', + 'district' => '区', + 'street' => '街道', + 'village' => '村', + 'brigade' => ' 队', + 'user_ship' => ' 会员类型', ]; @@ -59,6 +73,10 @@ class UserValidate extends BaseValidate return $this->remove('id',true); } + public function scenestoreAdd() + { + return $this->only(['mobile','province','city','district','street','village','brigade','user_ship']); + } /** * @notes 编辑场景 diff --git a/app/api/controller/BaseApiController.php b/app/api/controller/BaseApiController.php index e3d9026ad..516bf8bec 100644 --- a/app/api/controller/BaseApiController.php +++ b/app/api/controller/BaseApiController.php @@ -2,8 +2,7 @@ namespace app\api\controller; use app\common\controller\BaseLikeController; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class BaseApiController extends BaseLikeController { diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 8a31ce440..8dd609b2b 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -13,13 +13,12 @@ use Exception; use support\Cache; use think\facade\Db; use Webman\Config; -use hg\apidoc\annotation as ApiDoc; use support\Log; use Yansongda\Pay\Exception\InvalidSignException; use Monolog\Handler\RotatingFileHandler; use Webman\RedisQueue\Redis; -#[ApiDoc\NotParse()] + class IndexController extends BaseApiController { @@ -27,36 +26,35 @@ class IndexController extends BaseApiController public function index() { - $arr=StoreBranchProduct::where('store_id',5)->select(); - foreach ($arr as $item){ - StoreProductLogic::updateGoodsclass($item['cate_id'],5); - + $arr = StoreBranchProduct::where('store_id', 5)->select(); + foreach ($arr as $item) { + StoreProductLogic::updateGoodsclass($item['cate_id'], 5); } try { - $wechat = new PayService(1); - $time = time(); - $order = [ - 'out_trade_no' => 'PF1717558027664507', - 'out_refund_no' => 'BO'.$time, - 'amount' => [ - 'refund' => 1, - 'total' => 1, - 'currency' => 'CNY', - ], - // '_action' => 'jsapi', // jsapi 退款,默认 - // '_action' => 'app', // app 退款 - // '_action' => 'combine', // 合单退款 - // '_action' => 'h5', // h5 退款 - // '_action' => 'miniapp', // 小程序退款 - // '_action' => 'native', // native 退款 + $wechat = new PayService(1); + $time = time(); + $order = [ + 'out_trade_no' => 'PF1717558027664507', + 'out_refund_no' => 'BO' . $time, + 'amount' => [ + 'refund' => 1, + 'total' => 1, + 'currency' => 'CNY', + ], + // '_action' => 'jsapi', // jsapi 退款,默认 + // '_action' => 'app', // app 退款 + // '_action' => 'combine', // 合单退款 + // '_action' => 'h5', // h5 退款 + // '_action' => 'miniapp', // 小程序退款 + // '_action' => 'native', // native 退款 - ]; + ]; - $res = $wechat->wechat->refund($order); - Cache::set('kk',json_decode($res,true)); + $res = $wechat->wechat->refund($order); + Cache::set('kk', json_decode($res, true)); } catch (Exception $e) { - \support\Log::info($e->extra['message']?? $e->getMessage()); - throw new \Exception($e->extra['message']?? $e->getMessage()); + \support\Log::info($e->extra['message'] ?? $e->getMessage()); + throw new \Exception($e->extra['message'] ?? $e->getMessage()); } d(1); @@ -67,15 +65,15 @@ class IndexController extends BaseApiController - try{ - $a=new WechatTemplate(); - $a->NewQuotationNotification(['openid'=>'ocqhF6UfFQXE-SbzbP5YVQJlQAh0','data1'=>'阿萨','data2'=>date('Y-m-d H:i:s'),'data3'=>'占山','data3'=>18982406440]); - }catch (Exception $e){ + try { + $a = new WechatTemplate(); + $a->NewQuotationNotification(['openid' => 'ocqhF6UfFQXE-SbzbP5YVQJlQAh0', 'data1' => '阿萨', 'data2' => date('Y-m-d H:i:s'), 'data3' => '占山', 'data3' => 18982406440]); + } catch (Exception $e) { d($e); } -d(22); + d(22); $auth_code = $this->request->get('code'); $pay = (new PayService()); $order = [ @@ -85,7 +83,7 @@ d(22); 'auth_code' => (string)$auth_code ], 'amount' => [ - 'total' =>1, + 'total' => 1, ], 'scene_info' => [ "store_info" => [ @@ -93,14 +91,13 @@ d(22); ] ], ]; - - try{ - $a= $pay->wechat->pos($order); - }catch (\Exception $th) { - d($th); + try { + $a = $pay->wechat->pos($order); + } catch (\Exception $th) { + d($th); } -d($a); + d($a); $params = ['store_id' => 2, 'pay_type' => 17]; $a = StoreOrderLogic::createOrder([1], 0, null, $params); d($a); @@ -143,7 +140,7 @@ d($a); */ public function city() { - $province_code = $this->request->get('code'); + $province_code = $this->request->get('province_code'); $list = Db::name('geo_city')->where('province_code', $province_code)->select()?->toArray(); return $this->success('ok', $list); } @@ -152,7 +149,7 @@ d($a); */ public function area() { - $city_code = $this->request->get('code'); + $city_code = $this->request->get('city_code'); $list = Db::name('geo_area')->where('city_code', $city_code)->select()?->toArray(); return $this->success('ok', $list); } @@ -165,4 +162,22 @@ d($a); $list = Db::name('geo_street')->where('area_code', $area_code)->select()?->toArray(); return $this->success('ok', $list); } + + /** + * @notes 获取村列表 + */ + public function village() + { + $area_code = $this->request->get('street_code'); + $list = Db::name('geo_village')->where('street_code', $area_code)->select()?->toArray(); + return $this->success('ok', $list); + } + /** + * @notes 获取队列表 + */ + public function brigade() + { + $list = Db::name('geo_brigade')->select()?->toArray(); + return $this->success('ok', $list); + } } diff --git a/app/api/controller/LoginController.php b/app/api/controller/LoginController.php index d58b2ab1f..8143a4182 100644 --- a/app/api/controller/LoginController.php +++ b/app/api/controller/LoginController.php @@ -6,8 +6,7 @@ use app\api\logic\LoginLogic; use app\common\model\system_store\SystemStore; use app\api\validate\{LoginAccountValidate, WechatLoginValidate}; use app\common\model\user\UserAuth; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class LoginController extends BaseApiController { diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php index bcff5cf6d..6603df95e 100644 --- a/app/api/controller/PayController.php +++ b/app/api/controller/PayController.php @@ -9,8 +9,7 @@ use app\common\model\store_order\StoreOrder; use app\common\service\pay\PayService; use support\Cache; use support\Log; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + /** * 支付 diff --git a/app/api/controller/UploadController.php b/app/api/controller/UploadController.php index 6ca026202..dc2993465 100644 --- a/app/api/controller/UploadController.php +++ b/app/api/controller/UploadController.php @@ -4,8 +4,7 @@ use app\common\service\UploadService; use Exception; - use hg\apidoc\annotation as ApiDoc; - #[ApiDoc\NotParse()] + class UploadController extends BaseApiController { diff --git a/app/api/controller/cate/CateController.php b/app/api/controller/cate/CateController.php index 17e573afe..5f6e4bb87 100644 --- a/app/api/controller/cate/CateController.php +++ b/app/api/controller/cate/CateController.php @@ -5,8 +5,7 @@ namespace app\api\controller\cate; use app\api\controller\BaseApiController; use app\api\lists\cate\CateLists; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + /** * 商品分类控制器 diff --git a/app/api/controller/order/CartController.php b/app/api/controller/order/CartController.php index 06ad4b0d1..7c74e03fc 100644 --- a/app/api/controller/order/CartController.php +++ b/app/api/controller/order/CartController.php @@ -8,9 +8,8 @@ use app\api\controller\BaseApiController; use app\api\lists\order\CartList; use app\common\model\order\Cart; use app\common\model\store_branch_product\StoreBranchProduct; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class CartController extends BaseApiController { public function list() diff --git a/app/api/controller/order/OrderController.php b/app/api/controller/order/OrderController.php index 70ec3e5a5..c8a6a62c3 100644 --- a/app/api/controller/order/OrderController.php +++ b/app/api/controller/order/OrderController.php @@ -16,9 +16,7 @@ use app\common\model\system_store\SystemStoreStaff; use app\common\model\user\User; use app\common\model\user\UserAddress; use Webman\RedisQueue\Redis; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('订单')] class OrderController extends BaseApiController { public $notNeedLogin = ['refund_reason']; @@ -32,15 +30,15 @@ class OrderController extends BaseApiController return $this->dataLists(new OrderList()); } - #[ - ApiDoc\Title('核销码查数据'), - ApiDoc\url('/api/order/order/write_code'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "code", type: "string", require: false, desc: "核销码"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('核销码查数据'), + // ApiDoc\url('/api/order/order/write_code'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "code", type: "string", require: false, desc: "核销码"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function write_code() { $code = $this->request->post('code'); @@ -54,18 +52,18 @@ class OrderController extends BaseApiController return $this->success('ok', $res); } - #[ - ApiDoc\Title('核销订单列表'), - ApiDoc\url('/api/order/order/write_list'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "status", type: "int", require: true, desc: "1:待核销;2:已核销"), - ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"), - ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"), - ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('核销订单列表'), + // ApiDoc\url('/api/order/order/write_list'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "status", type: "int", require: true, desc: "1:待核销;2:已核销"), + // ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"), + // ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"), + // ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function write_list() { $status = (int)$this->request->post('status', 1); @@ -83,15 +81,15 @@ class OrderController extends BaseApiController return $this->success('ok', $res); } - #[ - ApiDoc\Title('核销数量'), - ApiDoc\url('/api/order/order/write_count'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('核销数量'), + // ApiDoc\url('/api/order/order/write_count'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "name", type: "string", require: false, desc: "搜商品或者订单id"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function write_count() { $info = $this->userInfo; @@ -100,41 +98,41 @@ class OrderController extends BaseApiController return $this->success('ok', $res); } - #[ - ApiDoc\Title('订单校验'), - ApiDoc\url('/api/order/order/checkOrder'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "cart_id", type: "int", require: true, desc: "购物车id"), - ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"), - ApiDoc\Param(name: "store_id", type: "int", require: true, desc: "店铺id"), - ApiDoc\Param(name: "verify_code", type: "int", require: true, desc: "校验码"), - ApiDoc\Param(name: "shipping_type", type: "int", require: true, desc: "配送方式"), - ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'order', 'desc' => '订单信息', 'type' => 'array', 'children' => [ - ['name' => 'create_time', 'desc' => '订单创建时间', 'type' => 'int'], - ['name' => 'order_id', 'desc' => '订单id', 'type' => 'int'], - ['name' => 'total_price', 'desc' => '订单总金额', 'type' => 'float'], - ['name' => 'pay_price', 'desc' => '实际支付金额', 'type' => 'float'], - ['name' => 'total_num', 'desc' => '订单总数量', 'type' => 'int'], - ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'int'], - ['name' => 'cart_id', 'desc' => '购物车id', 'type' => 'string'], - ['name' => 'store_id', 'desc' => '店铺id', 'type' => 'int'], - ['name' => 'shipping_type', 'desc' => '配送方式', 'type' => 'int'], - ]], - ['name' => 'cart_list', 'desc' => '购物车商品列表', 'type' => 'array', 'children' => [ - ['name' => 'goods', 'desc' => '商品id', 'type' => 'int'], - ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'int'], - ['name' => 'total', 'desc' => '商品总价', 'type' => 'float'], - ['name' => 'price', 'desc' => '商品单价', 'type' => 'float'], - ['name' => 'product_id', 'desc' => '商品id', 'type' => 'int'], - ['name' => 'old_cart_id', 'desc' => '原购物车id', 'type' => 'string'], - ['name' => 'verify_code', 'desc' => '校验码', 'type' => 'string'], - ]], - ]), - ] + // #[ + // ApiDoc\Title('订单校验'), + // ApiDoc\url('/api/order/order/checkOrder'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "cart_id", type: "int", require: true, desc: "购物车id"), + // ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"), + // ApiDoc\Param(name: "store_id", type: "int", require: true, desc: "店铺id"), + // ApiDoc\Param(name: "verify_code", type: "int", require: true, desc: "校验码"), + // ApiDoc\Param(name: "shipping_type", type: "int", require: true, desc: "配送方式"), + // ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'order', 'desc' => '订单信息', 'type' => 'array', 'children' => [ + // ['name' => 'create_time', 'desc' => '订单创建时间', 'type' => 'int'], + // ['name' => 'order_id', 'desc' => '订单id', 'type' => 'int'], + // ['name' => 'total_price', 'desc' => '订单总金额', 'type' => 'float'], + // ['name' => 'pay_price', 'desc' => '实际支付金额', 'type' => 'float'], + // ['name' => 'total_num', 'desc' => '订单总数量', 'type' => 'int'], + // ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'int'], + // ['name' => 'cart_id', 'desc' => '购物车id', 'type' => 'string'], + // ['name' => 'store_id', 'desc' => '店铺id', 'type' => 'int'], + // ['name' => 'shipping_type', 'desc' => '配送方式', 'type' => 'int'], + // ]], + // ['name' => 'cart_list', 'desc' => '购物车商品列表', 'type' => 'array', 'children' => [ + // ['name' => 'goods', 'desc' => '商品id', 'type' => 'int'], + // ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'int'], + // ['name' => 'total', 'desc' => '商品总价', 'type' => 'float'], + // ['name' => 'price', 'desc' => '商品单价', 'type' => 'float'], + // ['name' => 'product_id', 'desc' => '商品id', 'type' => 'int'], + // ['name' => 'old_cart_id', 'desc' => '原购物车id', 'type' => 'string'], + // ['name' => 'verify_code', 'desc' => '校验码', 'type' => 'string'], + // ]], + // ]), + // ] public function checkOrder() { $cartId = (array)$this->request->post('cart_id', []); @@ -154,19 +152,19 @@ class OrderController extends BaseApiController return $this->data($res); } - #[ - ApiDoc\Title('创建订单'), - ApiDoc\url('/api/order/order/createOrder'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "cart_id", type: "int", require: true, desc: "id"), - ApiDoc\Param(name: "store_id", type: "int", require: true, desc: "店铺id"), - ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"), - ApiDoc\Param(name: "auth_code", type: "string", require: true, desc: "付款码"), - ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('创建订单'), + // ApiDoc\url('/api/order/order/createOrder'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "cart_id", type: "int", require: true, desc: "id"), + // ApiDoc\Param(name: "store_id", type: "int", require: true, desc: "店铺id"), + // ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"), + // ApiDoc\Param(name: "auth_code", type: "string", require: true, desc: "付款码"), + // ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function createOrder() { $cartId = (array)$this->request->post('cart_id', []); @@ -263,18 +261,18 @@ class OrderController extends BaseApiController return $this->success('ok', ['no_pay' => $no_pay, 'waiting' => $waiting, 'receiving' => $receiving, 'all' => $all, 'applyRefund' => $applyRefund, 'refund' => $refund]); } - #[ - ApiDoc\Title('订单支付'), - ApiDoc\url('/api/order/order/pay'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"), - ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"), - ApiDoc\Param(name: "auth_code", type: "string", require: true, desc: "付款码"), - ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('订单支付'), + // ApiDoc\url('/api/order/order/pay'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"), + // ApiDoc\Param(name: "address_id", type: "int", require: true, desc: "地址id"), + // ApiDoc\Param(name: "auth_code", type: "string", require: true, desc: "付款码"), + // ApiDoc\Param(name: "pay_type", type: "int", require: true, desc: "支付类型"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function pay() { $order_id = (int)$this->request->post('order_id'); @@ -352,14 +350,14 @@ class OrderController extends BaseApiController } - #[ - ApiDoc\Title('订单详情'), - ApiDoc\url('/api/order/order/detail'), - ApiDoc\Method('GET'), - ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('订单详情'), + // ApiDoc\url('/api/order/order/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function detail() { $order_id = (int)$this->request->get('order_id'); @@ -447,15 +445,15 @@ class OrderController extends BaseApiController } } - #[ - ApiDoc\Title('核销'), - ApiDoc\url('/api/order/order/writeoff_order'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "verify_code", type: "string", require: true, desc: "验证码"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('核销'), + // ApiDoc\url('/api/order/order/writeoff_order'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "verify_code", type: "string", require: true, desc: "验证码"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function writeoff_order() { $params = (new OrderValidate())->post()->goCheck('check'); @@ -487,19 +485,19 @@ class OrderController extends BaseApiController } - #[ - ApiDoc\Title('订单退款申请'), - ApiDoc\url('/api/order/order/apply_refund'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "refund_message", type: "string", require: true, desc: "退款原因"), - ApiDoc\Param(name: "refund_num", type: "int", require: true, desc: "退款数量"), - ApiDoc\Param(name: "id", type: "int", require: true, desc: "订单id"), - ApiDoc\Param(name: "old_cart_id", type: "int", require: true, desc: "购物车id"), - ApiDoc\Param(name: "refund_type", type: "int", require: true, desc: "退款申请类型"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('订单退款申请'), + // ApiDoc\url('/api/order/order/apply_refund'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "refund_message", type: "string", require: true, desc: "退款原因"), + // ApiDoc\Param(name: "refund_num", type: "int", require: true, desc: "退款数量"), + // ApiDoc\Param(name: "id", type: "int", require: true, desc: "订单id"), + // ApiDoc\Param(name: "old_cart_id", type: "int", require: true, desc: "购物车id"), + // ApiDoc\Param(name: "refund_type", type: "int", require: true, desc: "退款申请类型"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function apply_refund() { $params = (new OrderValidate())->post()->goCheck('add'); @@ -509,14 +507,14 @@ class OrderController extends BaseApiController return $this->success('申请成功'); } - #[ - ApiDoc\Title('订单退款原因'), - ApiDoc\url('/api/order/order/refund_reason'), - ApiDoc\Method('GET'), - ApiDoc\Param(), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('订单退款原因'), + // ApiDoc\url('/api/order/order/refund_reason'), + // ApiDoc\Method('GET'), + // ApiDoc\Param(), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function refund_reason() { $data = DictData::where('type_value', 'reason')->where('status', YesNoEnum::YES) @@ -525,14 +523,14 @@ class OrderController extends BaseApiController } - #[ - ApiDoc\Title('取消售后'), - ApiDoc\url('/api/order/order/cancel_sale'), - ApiDoc\Method('GET'), - ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('取消售后'), + // ApiDoc\url('/api/order/order/cancel_sale'), + // ApiDoc\Method('GET'), + // ApiDoc\Param(name: "order_id", type: "int", require: true, desc: "订单id"), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function cancel_sale() { $order_id = (int)$this->request->get('order_id'); diff --git a/app/api/controller/product/ProductController.php b/app/api/controller/product/ProductController.php index d1d54fa36..c10aeaceb 100644 --- a/app/api/controller/product/ProductController.php +++ b/app/api/controller/product/ProductController.php @@ -3,8 +3,7 @@ namespace app\api\controller\product; use app\api\controller\BaseApiController; use app\api\lists\product\ProductLists; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class ProductController extends BaseApiController{ public $notNeedLogin = ['lists']; diff --git a/app/api/controller/shop/IndexController.php b/app/api/controller/shop/IndexController.php index 9f797da5e..b1cf77793 100644 --- a/app/api/controller/shop/IndexController.php +++ b/app/api/controller/shop/IndexController.php @@ -9,8 +9,7 @@ use app\common\model\dict\DictData; use app\common\model\merchant\Merchant; use app\common\model\supplier\Supplier; use think\facade\Db; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class IndexController extends BaseApiController{ public $notNeedLogin = ['apply','get_token','merchat_type','record','apply_detail']; diff --git a/app/api/controller/store/ProductRecordController.php b/app/api/controller/store/ProductRecordController.php index f9d1f6e46..660de6eed 100644 --- a/app/api/controller/store/ProductRecordController.php +++ b/app/api/controller/store/ProductRecordController.php @@ -3,8 +3,6 @@ namespace app\api\controller\store; use app\api\controller\BaseApiController; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('收银机商品统计')] class ProductRecordController extends BaseApiController { diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 6b4dd010d..ef5b21d04 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -7,8 +7,7 @@ use app\api\controller\BaseApiController; use app\api\logic\store\StoreLogic; use app\common\service\pay\PayService; use Webman\Config; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class StoreController extends BaseApiController { diff --git a/app/api/controller/store/TransactionRecordController.php b/app/api/controller/store/TransactionRecordController.php index c0b2bb023..37dd6b288 100644 --- a/app/api/controller/store/TransactionRecordController.php +++ b/app/api/controller/store/TransactionRecordController.php @@ -3,8 +3,7 @@ namespace app\api\controller\store; use app\api\controller\BaseApiController; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('收银机盈收统计')] + class TransactionRecordController extends BaseApiController { diff --git a/app/api/controller/user/AddressController.php b/app/api/controller/user/AddressController.php index 931446ade..781f6f9e3 100644 --- a/app/api/controller/user/AddressController.php +++ b/app/api/controller/user/AddressController.php @@ -6,8 +6,7 @@ use app\api\controller\BaseApiController; use app\api\lists\user\UserAddressList; use app\api\logic\user\AddressLogic; use app\api\validate\UserAddressValidate; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class AddressController extends BaseApiController { diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index 67c7efbd1..b21be4f69 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -7,10 +7,7 @@ use app\api\logic\user\UserLogic; use app\api\validate\UserValidate; use app\common\enum\PayEnum; use app\common\logic\PaymentLogic; -use hg\apidoc\annotation as ApiDoc; -use taoser\Validate; -#[ApiDoc\title('用户')] /** * 用户控制器 @@ -19,15 +16,15 @@ use taoser\Validate; */ class UserController extends BaseApiController { - #[ - ApiDoc\Title('获取小程序手机号'), - ApiDoc\url('/api/user/user/getMobileByMnp'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "code", type: "string", require: true, desc: "换取手机的code"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('获取小程序手机号'), + // ApiDoc\url('/api/user/user/getMobileByMnp'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "code", type: "string", require: true, desc: "换取手机的code"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function getMobileByMnp() { $params = (new UserValidate())->post()->goCheck('getMobileByMnp'); @@ -41,45 +38,45 @@ class UserController extends BaseApiController } - #[ - ApiDoc\Title('用户个人信息'), - ApiDoc\url('/api/user/user/info'), - ApiDoc\Method('POST'), - ApiDoc\Param(), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('用户个人信息'), + // ApiDoc\url('/api/user/user/info'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function info() { return $this->success('success', UserLogic::info($this->userId)); } - #[ - ApiDoc\Title('充值金额'), - ApiDoc\url('/api/user/user/rechange_amount'), - ApiDoc\Method('Get'), - ApiDoc\Param(), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('充值金额'), + // ApiDoc\url('/api/user/user/rechange_amount'), + // ApiDoc\Method('Get'), + // ApiDoc\Param(), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function rechange_amount() { $res = UserLogic::rechange_level(); return $this->success('ok',$res); } - #[ - ApiDoc\Title('小程序充值'), - ApiDoc\url('/api/user/user/recharge'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "price", type: "string", require: true, desc: "金额"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('小程序充值'), + // ApiDoc\url('/api/user/user/recharge'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "price", type: "string", require: true, desc: "金额"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function recharge() { $params = (new UserValidate())->post()->goCheck('rechargeMoney'); @@ -95,16 +92,16 @@ class UserController extends BaseApiController } - #[ - ApiDoc\Title('会员账户详情'), - ApiDoc\url('/api/user/user/capital_flow'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"), - ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('会员账户详情'), + // ApiDoc\url('/api/user/user/capital_flow'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "page_no", type: "int", require: true, desc: "默认1页数"), + // ApiDoc\Param(name: "page_size", type: "int", require: false, desc: "条数默认15"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function capital_flow() { $page_no = (int)$this->request->post('page_no',1); @@ -122,15 +119,15 @@ class UserController extends BaseApiController return $this->success('ok',$res); } - #[ - ApiDoc\Title('会员账户统计'), - ApiDoc\url('/api/user/user/capital_count'), - ApiDoc\Method('POST'), - ApiDoc\Param(), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('会员账户统计'), + // ApiDoc\url('/api/user/user/capital_count'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function capital_count() { $res = UserLogic::capital_count($this->userId); diff --git a/app/api/controller/user/UserFeedbackController.php b/app/api/controller/user/UserFeedbackController.php index 3ad0f9030..46cedd303 100644 --- a/app/api/controller/user/UserFeedbackController.php +++ b/app/api/controller/user/UserFeedbackController.php @@ -6,8 +6,7 @@ use app\api\logic\user\UserFeedbackLogic; use app\admin\validate\user\UserFeedbackValidate; use app\api\controller\BaseApiController; - use hg\apidoc\annotation as ApiDoc; - #[ApiDoc\NotParse()] + class UserFeedbackController extends BaseApiController { diff --git a/app/api/controller/user/UserVisitController.php b/app/api/controller/user/UserVisitController.php index 5570e2efe..d777c094a 100644 --- a/app/api/controller/user/UserVisitController.php +++ b/app/api/controller/user/UserVisitController.php @@ -5,25 +5,23 @@ namespace app\api\controller\user; use app\api\controller\BaseApiController; use app\api\logic\user\UserVisitLogic; use app\api\validate\VisitValidate; -use hg\apidoc\annotation as ApiDoc; use Illuminate\Support\Facades\Request; use support\Response; -#[ApiDoc\title('用户访问')] class UserVisitController extends BaseApiController { public $notNeedLogin = ['productLog']; - #[ - ApiDoc\Title('添加访问商品记录'), - ApiDoc\url('/api/user/UserVisit/productLog'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "product_id", type: "int", require: true, desc: "product_id商品id"), - ApiDoc\Param(name: "cate_id", type: "int", require: true, desc: "分类id"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('添加访问商品记录'), + // ApiDoc\url('/api/user/UserVisit/productLog'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "product_id", type: "int", require: true, desc: "product_id商品id"), + // ApiDoc\Param(name: "cate_id", type: "int", require: true, desc: "分类id"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function productLog(): Response { $params = (new VisitValidate())->post()->goCheck('add'); @@ -37,16 +35,16 @@ class UserVisitController extends BaseApiController } - #[ - ApiDoc\Title('用户访问页面记录'), - ApiDoc\url('/api/user/UserVisit/htmlLog'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "url", type: "string", require: true, desc: "路径"), - ApiDoc\Param(name: "stay_time", type: "int", require: true, desc: "停留时间"), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('用户访问页面记录'), + // ApiDoc\url('/api/user/UserVisit/htmlLog'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "url", type: "string", require: true, desc: "路径"), + // ApiDoc\Param(name: "stay_time", type: "int", require: true, desc: "停留时间"), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function htmlLog() { $ip = $this->request->getRealIp(); diff --git a/app/common/controller/BaseLikeController.php b/app/common/controller/BaseLikeController.php index 79cf2b9f9..8b020b6e3 100644 --- a/app/common/controller/BaseLikeController.php +++ b/app/common/controller/BaseLikeController.php @@ -7,9 +7,8 @@ namespace app\common\controller; use app\BaseController; use app\common\lists\BaseDataLists; use app\common\service\JsonService; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class BaseLikeController extends BaseController { public $notNeedLogin = []; @@ -74,10 +73,10 @@ class BaseLikeController extends BaseController return JsonService::fail($msg, $data, $code, $show); } - #[ApiDoc\NotParse()] - #[ - ApiDoc\Title('是否免登录验证'), - ] + + // #[ + // ApiDoc\Title('是否免登录验证'), + // ] public function isNotNeedLogin() : bool { $notNeedLogin = $this->notNeedLogin; diff --git a/app/common/controller/Definitions.php b/app/common/controller/Definitions.php index 8e1e81085..11d053590 100644 --- a/app/common/controller/Definitions.php +++ b/app/common/controller/Definitions.php @@ -2,22 +2,21 @@ namespace app\common\controller; -use hg\apidoc\annotation as ApiDoc; class Definitions { - #[ - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ] + // #[ + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ] public function token() { } - #[ - ApiDoc\Query("page_no", type: "int", require: false, default: 1, desc: "页码"), - ApiDoc\Query("page_size", type: "int", require: false, default: 25, desc: "每页条数"), - ] + // #[ + // ApiDoc\Query("page_no", type: "int", require: false, default: 1, desc: "页码"), + // ApiDoc\Query("page_size", type: "int", require: false, default: 25, desc: "每页条数"), + // ] public function page() { diff --git a/app/common/lists/user/UserShipLists.php b/app/common/lists/user/UserShipLists.php new file mode 100644 index 000000000..c33e1f700 --- /dev/null +++ b/app/common/lists/user/UserShipLists.php @@ -0,0 +1,60 @@ +searchWhere) + ->limit($this->limitOffset, $this->limitLength) + ->field($field) + ->order('sort desc') + ->select()->toArray(); + return $lists; + } + + + /** + * @notes 获取数量 + * @return int + * @author 乔峰 + * @date 2022/9/22 15:51 + */ + public function count(): int + { + return UserShip::where($this->searchWhere)->count(); + } +} \ No newline at end of file diff --git a/app/store/controller/BaseAdminController.php b/app/store/controller/BaseAdminController.php index 4ccd24c80..b35b0d401 100644 --- a/app/store/controller/BaseAdminController.php +++ b/app/store/controller/BaseAdminController.php @@ -5,9 +5,7 @@ namespace app\store\controller; use app\common\controller\BaseLikeController; -use app\common\lists\BaseDataLists; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class BaseAdminController extends BaseLikeController { diff --git a/app/store/controller/ConfigController.php b/app/store/controller/ConfigController.php index c13dec726..a8220b243 100644 --- a/app/store/controller/ConfigController.php +++ b/app/store/controller/ConfigController.php @@ -19,7 +19,6 @@ use app\admin\logic\system_store\SystemStoreLogic; use app\common\controller\Definitions; use app\common\service\ConfigService; use app\common\service\FileService; -use hg\apidoc\annotation as ApiDoc; use think\facade\Db; /** @@ -27,27 +26,26 @@ use think\facade\Db; * Class ConfigController * @package app\admin\controller */ -#[ApiDoc\title('站点配置')] class ConfigController extends BaseAdminController { public $notNeedLogin = ['getConfig', 'dict']; - #[ - ApiDoc\Title('站点配置'), - ApiDoc\url('/store/config/getConfig'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'oss_domain', 'desc' => 'oss域名', 'type' => 'string'], - ['name' => 'web_name', 'desc' => '站点名称', 'type' => 'string'], - ['name' => 'web_favicon', 'desc' => '站点图标', 'type' => 'string'], - ['name' => 'web_logo', 'desc' => '站点logo', 'type' => 'string'], - ['name' => 'login_image', 'desc' => '登录页背景图', 'type' => 'string'], - ['name' => 'copyright_config', 'desc' => '版权信息', 'type' => 'array'], - ]), - ] + // #[ + // ApiDoc\Title('站点配置'), + // ApiDoc\url('/store/config/getConfig'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'oss_domain', 'desc' => 'oss域名', 'type' => 'string'], + // ['name' => 'web_name', 'desc' => '站点名称', 'type' => 'string'], + // ['name' => 'web_favicon', 'desc' => '站点图标', 'type' => 'string'], + // ['name' => 'web_logo', 'desc' => '站点logo', 'type' => 'string'], + // ['name' => 'login_image', 'desc' => '登录页背景图', 'type' => 'string'], + // ['name' => 'copyright_config', 'desc' => '版权信息', 'type' => 'array'], + // ]), + // ] public function getConfig() { // $data = ConfigLogic::getConfig(); @@ -70,15 +68,15 @@ class ConfigController extends BaseAdminController return $this->data($data); } - #[ - ApiDoc\Title('门店配置'), - ApiDoc\url('/store/config/store'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('门店配置'), + // ApiDoc\url('/store/config/store'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function store() { $params['id'] = $this->request->adminInfo['store_id']; @@ -86,15 +84,15 @@ class ConfigController extends BaseAdminController return $this->data($result); } - #[ - ApiDoc\Title('保存门店配置'), - ApiDoc\url('/store/config/saveStore'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('保存门店配置'), + // ApiDoc\url('/store/config/saveStore'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function saveStore() { $params = $this->request->post(); @@ -103,31 +101,31 @@ class ConfigController extends BaseAdminController return $this->success('操作成功', [], 1, 1); } - #[ - ApiDoc\Title('省列表'), - ApiDoc\url('/store/config/province'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('省列表'), + // ApiDoc\url('/store/config/province'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function province() { $list = Db::name('geo_province')->select()->toArray(); return $this->success('ok', $list); } - #[ - ApiDoc\Title('市列表'), - ApiDoc\url('/store/config/city'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'code', type: 'int', require: true, desc: '省份代码'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('市列表'), + // ApiDoc\url('/store/config/city'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'code', type: 'int', require: true, desc: '省份代码'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function city() { $province_code = $this->request->get('code'); @@ -135,16 +133,16 @@ class ConfigController extends BaseAdminController return $this->success('ok', $list); } - #[ - ApiDoc\Title('区列表'), - ApiDoc\url('/store/config/area'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'code', type: 'int', require: true, desc: '城市代码'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('区列表'), + // ApiDoc\url('/store/config/area'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'code', type: 'int', require: true, desc: '城市代码'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function area() { $city_code = $this->request->get('code'); diff --git a/app/store/controller/DeliveryController.php b/app/store/controller/DeliveryController.php index 0811d69f0..d0a747e67 100644 --- a/app/store/controller/DeliveryController.php +++ b/app/store/controller/DeliveryController.php @@ -5,41 +5,39 @@ namespace app\store\controller; use app\common\controller\Definitions; use app\common\lists\DeliveryServiceLists; use app\common\logic\DeliveryServiceLogic; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('配送员管理')] class DeliveryController extends BaseAdminController { - #[ - ApiDoc\Title('列表'), - ApiDoc\url('/store/delivery/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '名称/手机号'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('列表'), + // ApiDoc\url('/store/delivery/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '名称/手机号'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function lists() { return $this->dataLists(new DeliveryServiceLists()); } - #[ - ApiDoc\Title('添加'), - ApiDoc\url('/store/delivery/add'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'), - ApiDoc\Param(name: 'nickname', type: 'string', require: true, desc: '店员名称'), - ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'), - ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('添加'), + // ApiDoc\url('/store/delivery/add'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'), + // ApiDoc\Param(name: 'nickname', type: 'string', require: true, desc: '店员名称'), + // ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'), + // ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function add(DeliveryServiceLogic $logic) { $params = $this->request->post(); @@ -47,20 +45,20 @@ class DeliveryController extends BaseAdminController return $this->success('操作成功', [], 1, 1); } - #[ - ApiDoc\Title('编辑'), - ApiDoc\url('/store/delivery/edit'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'), - ApiDoc\Param(name: 'nickname', type: 'string', require: true, desc: '店员名称'), - ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'), - ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('编辑'), + // ApiDoc\url('/store/delivery/edit'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'), + // ApiDoc\Param(name: 'nickname', type: 'string', require: true, desc: '店员名称'), + // ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'), + // ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function edit(DeliveryServiceLogic $logic) { $id = $this->request->post('id'); @@ -69,16 +67,16 @@ class DeliveryController extends BaseAdminController return $this->success('操作成功', [], 1, 1); } - #[ - ApiDoc\Title('删除'), - ApiDoc\url('/store/delivery/delete'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('删除'), + // ApiDoc\url('/store/delivery/delete'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function delete(DeliveryServiceLogic $logic) { $id = $this->request->post('id'); @@ -86,27 +84,27 @@ class DeliveryController extends BaseAdminController return $this->success('操作成功', [], 1, 1); } - #[ - ApiDoc\Title('详情'), - ApiDoc\url('/store/delivery/detail'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'account', 'desc' => '账号', 'type' => 'string'], - ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'], - ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'], - ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'], - ['name' => 'verify_status', 'desc' => '核销开关,1开启,0关闭', 'type' => 'int'], - ['name' => 'order_status', 'desc' => '订单状态,1开启,0关闭', 'type' => 'int'], - ['name' => 'is_admin', 'desc' => '是否管理员,1是,0不是', 'type' => 'int'], - ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'], - ['name' => 'status', 'desc' => '状态,1启用,0禁用', 'type' => 'int'], - ]), - ] + // #[ + // ApiDoc\Title('详情'), + // ApiDoc\url('/store/delivery/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'account', 'desc' => '账号', 'type' => 'string'], + // ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'], + // ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'], + // ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'], + // ['name' => 'verify_status', 'desc' => '核销开关,1开启,0关闭', 'type' => 'int'], + // ['name' => 'order_status', 'desc' => '订单状态,1开启,0关闭', 'type' => 'int'], + // ['name' => 'is_admin', 'desc' => '是否管理员,1是,0不是', 'type' => 'int'], + // ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'], + // ['name' => 'status', 'desc' => '状态,1启用,0禁用', 'type' => 'int'], + // ]), + // ] public function detail(DeliveryServiceLogic $logic) { $id = $this->request->get('id'); @@ -114,16 +112,16 @@ class DeliveryController extends BaseAdminController return $this->data($data); } - #[ - ApiDoc\Title('开启/关闭'), - ApiDoc\url('/store/delivery/status'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('开启/关闭'), + // ApiDoc\url('/store/delivery/status'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function status(DeliveryServiceLogic $logic) { $id = $this->request->post('id'); diff --git a/app/store/controller/DownloadController.php b/app/store/controller/DownloadController.php index faf1a11ed..93ce7f38b 100644 --- a/app/store/controller/DownloadController.php +++ b/app/store/controller/DownloadController.php @@ -7,8 +7,7 @@ namespace app\store\controller; use app\common\cache\ExportCache; use app\common\service\JsonService; use support\Cache; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class DownloadController extends BaseAdminController { diff --git a/app/store/controller/FileController.php b/app/store/controller/FileController.php index d1a50d9a4..e531cd65b 100644 --- a/app/store/controller/FileController.php +++ b/app/store/controller/FileController.php @@ -7,33 +7,32 @@ use app\admin\lists\file\FileLists; use app\admin\logic\FileLogic; use app\admin\validate\FileValidate; use app\common\controller\Definitions; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('文件管理')] +// #[ApiDoc\title('文件管理')] class FileController extends BaseAdminController { - #[ - ApiDoc\Title('列表'), - ApiDoc\url('/store/file/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('列表'), + // ApiDoc\url('/store/file/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function lists() { return $this->dataLists(new FileLists()); } - #[ - ApiDoc\Title('移动'), - ApiDoc\url('/store/file/move'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('移动'), + // ApiDoc\url('/store/file/move'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function move() { $params = (new FileValidate())->post()->goCheck('move'); @@ -41,13 +40,13 @@ class FileController extends BaseAdminController return $this->success('移动成功', [], 1, 1); } - #[ - ApiDoc\Title('重命名'), - ApiDoc\url('/store/file/rename'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('重命名'), + // ApiDoc\url('/store/file/rename'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function rename() { $params = (new FileValidate())->post()->goCheck('rename'); @@ -55,13 +54,13 @@ class FileController extends BaseAdminController return $this->success('重命名成功', [], 1, 1); } - #[ - ApiDoc\Title('删除'), - ApiDoc\url('/store/file/delete'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('删除'), + // ApiDoc\url('/store/file/delete'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function delete() { $params = (new FileValidate())->post()->goCheck('delete'); @@ -69,25 +68,25 @@ class FileController extends BaseAdminController return $this->success('删除成功', [], 1, 1); } - #[ - ApiDoc\Title('分类列表'), - ApiDoc\url('/store/file/listCate'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('分类列表'), + // ApiDoc\url('/store/file/listCate'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function listCate() { return $this->dataLists(new FileCateLists()); } - #[ - ApiDoc\Title('添加文件分类'), - ApiDoc\url('/store/file/addCate'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('添加文件分类'), + // ApiDoc\url('/store/file/addCate'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function addCate() { $params = (new FileValidate())->post()->goCheck('addCate'); @@ -95,13 +94,13 @@ class FileController extends BaseAdminController return $this->success('添加成功', [], 1, 1); } - #[ - ApiDoc\Title('编辑文件分类'), - ApiDoc\url('/store/file/editCate'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('编辑文件分类'), + // ApiDoc\url('/store/file/editCate'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function editCate() { $params = (new FileValidate())->post()->goCheck('editCate'); @@ -109,13 +108,13 @@ class FileController extends BaseAdminController return $this->success('编辑成功', [], 1, 1); } - #[ - ApiDoc\Title('删除文件分类'), - ApiDoc\url('/store/file/delCate'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('删除文件分类'), + // ApiDoc\url('/store/file/delCate'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function delCate() { $params = (new FileValidate())->post()->goCheck('id'); diff --git a/app/store/controller/LoginController.php b/app/store/controller/LoginController.php index 151e52bbe..b35adac66 100644 --- a/app/store/controller/LoginController.php +++ b/app/store/controller/LoginController.php @@ -17,34 +17,33 @@ namespace app\store\controller; use app\store\logic\LoginLogic; use app\store\validate\LoginValidate; use think\facade\Cache; -use hg\apidoc\annotation as ApiDoc; /** * 管理员登录控制器 * Class LoginController * @package app\store\controller */ -#[ApiDoc\title('登入登出')] +// #[ApiDoc\title('登入登出')] class LoginController extends BaseAdminController { public $notNeedLogin = ['account']; - #[ - ApiDoc\Title('账号登录'), - ApiDoc\url('/store/login/account'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "account", type: "string", require: true, desc: "账号"), - ApiDoc\Param(name: "password", type: "string", require: true, desc: "密码"), - ApiDoc\Param(name: "terminal", type: "integer", require: true, default: 1, desc: "终端类型:1-PC,2-H5"), - ApiDoc\NotHeaders(), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'name', 'desc' => '用户名', 'type' => 'string'], - ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'], - ['name' => 'token', 'desc' => 'token', 'type' => 'string'], - ['name' => 'role_name', 'desc' => '角色名称', 'type' => 'integer'], - ]), - ] + // #[ + // ApiDoc\Title('账号登录'), + // ApiDoc\url('/store/login/account'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "account", type: "string", require: true, desc: "账号"), + // ApiDoc\Param(name: "password", type: "string", require: true, desc: "密码"), + // ApiDoc\Param(name: "terminal", type: "integer", require: true, default: 1, desc: "终端类型:1-PC,2-H5"), + // ApiDoc\NotHeaders(), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'name', 'desc' => '用户名', 'type' => 'string'], + // ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'], + // ['name' => 'token', 'desc' => 'token', 'type' => 'string'], + // ['name' => 'role_name', 'desc' => '角色名称', 'type' => 'integer'], + // ]), + // ] public function account() { $params = (new LoginValidate())->post()->goCheck(); @@ -52,14 +51,14 @@ class LoginController extends BaseAdminController return $this->data((new LoginLogic())->login($params)); } - #[ - ApiDoc\Title('退出登录'), - ApiDoc\url('/store/login/logout'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('退出登录'), + // ApiDoc\url('/store/login/logout'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function logout() { //退出登录情况特殊,只有成功的情况,也不需要token验证 diff --git a/app/store/controller/StaffController.php b/app/store/controller/StaffController.php index 60e604c45..8dc4d3a0b 100644 --- a/app/store/controller/StaffController.php +++ b/app/store/controller/StaffController.php @@ -5,53 +5,52 @@ namespace app\store\controller; use app\common\controller\Definitions; use app\common\lists\StoreStaffLists; use app\common\logic\SystemStoreStaffLogic; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('店员管理')] +// #[ApiDoc\title('店员管理')] class StaffController extends BaseAdminController { - #[ - ApiDoc\Title('列表'), - ApiDoc\url('/store/staff/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '店员名称/手机号/账号'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'id', 'type' => 'int'], - ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'], - ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'], - ['name' => 'account', 'desc' => '账号', 'type' => 'string'], - ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'], - ['name' => 'is_admin', 'desc' => '是否是管理员,1是,0不是', 'type' => 'int'], - ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'], - ]), - ] + // #[ + // ApiDoc\Title('列表'), + // ApiDoc\url('/store/staff/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '店员名称/手机号/账号'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'id', 'type' => 'int'], + // ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'], + // ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'], + // ['name' => 'account', 'desc' => '账号', 'type' => 'string'], + // ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'], + // ['name' => 'is_admin', 'desc' => '是否是管理员,1是,0不是', 'type' => 'int'], + // ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'], + // ]), + // ] public function lists() { return $this->dataLists(new StoreStaffLists()); } - #[ - ApiDoc\Title('添加'), - ApiDoc\url('/store/staff/add'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'account', type: 'string', require: true, desc: '账号'), - ApiDoc\Param(name: 'pwd', type: 'string', require: true, desc: '密码'), - ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'), - ApiDoc\Param(name: 'staff_name', type: 'string', require: true, desc: '店员名称'), - ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'), - ApiDoc\Param(name: 'verify_status', type: 'string', require: true, desc: '核销开关,1开启,0关闭'), - ApiDoc\Param(name: 'order_status', type: 'string', require: true, desc: '订单状态,1开启,0关闭'), - ApiDoc\Param(name: 'is_manager', type: 'string', require: true, desc: '是否是店长,1是,0不是'), - ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('添加'), + // ApiDoc\url('/store/staff/add'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'account', type: 'string', require: true, desc: '账号'), + // ApiDoc\Param(name: 'pwd', type: 'string', require: true, desc: '密码'), + // ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'), + // ApiDoc\Param(name: 'staff_name', type: 'string', require: true, desc: '店员名称'), + // ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'), + // ApiDoc\Param(name: 'verify_status', type: 'string', require: true, desc: '核销开关,1开启,0关闭'), + // ApiDoc\Param(name: 'order_status', type: 'string', require: true, desc: '订单状态,1开启,0关闭'), + // ApiDoc\Param(name: 'is_manager', type: 'string', require: true, desc: '是否是店长,1是,0不是'), + // ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function add(SystemStoreStaffLogic $staffLogic) { $params = $this->request->post(); @@ -59,24 +58,24 @@ class StaffController extends BaseAdminController return $this->success('操作成功', [], 1, 1); } - #[ - ApiDoc\Title('编辑'), - ApiDoc\url('/store/staff/edit'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\Param(name: 'account', type: 'string', require: true, desc: '账号'), - ApiDoc\Param(name: 'pwd', type: 'string', require: true, desc: '密码'), - ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'), - ApiDoc\Param(name: 'staff_name', type: 'string', require: true, desc: '店员名称'), - ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'), - ApiDoc\Param(name: 'verify_status', type: 'string', require: true, desc: '核销开关,1开启,0关闭'), - ApiDoc\Param(name: 'order_status', type: 'string', require: true, desc: '订单状态,1开启,0关闭'), - ApiDoc\Param(name: 'is_manager', type: 'string', require: true, desc: '是否是店长,1是,0不是'), - ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('编辑'), + // ApiDoc\url('/store/staff/edit'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\Param(name: 'account', type: 'string', require: true, desc: '账号'), + // ApiDoc\Param(name: 'pwd', type: 'string', require: true, desc: '密码'), + // ApiDoc\Param(name: 'avatar', type: 'string', require: true, desc: '头像'), + // ApiDoc\Param(name: 'staff_name', type: 'string', require: true, desc: '店员名称'), + // ApiDoc\Param(name: 'phone', type: 'string', require: true, desc: '手机号'), + // ApiDoc\Param(name: 'verify_status', type: 'string', require: true, desc: '核销开关,1开启,0关闭'), + // ApiDoc\Param(name: 'order_status', type: 'string', require: true, desc: '订单状态,1开启,0关闭'), + // ApiDoc\Param(name: 'is_manager', type: 'string', require: true, desc: '是否是店长,1是,0不是'), + // ApiDoc\Param(name: 'status', type: 'string', require: true, desc: '状态,1启用,0禁用'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function edit(SystemStoreStaffLogic $staffLogic) { $id = $this->request->post('id'); @@ -85,15 +84,15 @@ class StaffController extends BaseAdminController return $this->success('操作成功', [], 1, 1); } - #[ - ApiDoc\Title('删除'), - ApiDoc\url('/store/staff/delete'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('删除'), + // ApiDoc\url('/store/staff/delete'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function delete(SystemStoreStaffLogic $staffLogic) { $id = $this->request->post('id'); @@ -101,26 +100,26 @@ class StaffController extends BaseAdminController return $this->success('操作成功', [], 1, 1); } - #[ - ApiDoc\Title('详情'), - ApiDoc\url('/store/staff/detail'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'account', 'desc' => '账号', 'type' => 'string'], - ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'], - ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'], - ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'], - ['name' => 'verify_status', 'desc' => '核销开关,1开启,0关闭', 'type' => 'int'], - ['name' => 'order_status', 'desc' => '订单状态,1开启,0关闭', 'type' => 'int'], - ['name' => 'is_admin', 'desc' => '是否管理员,1是,0不是', 'type' => 'int'], - ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'], - ['name' => 'status', 'desc' => '状态,1启用,0禁用', 'type' => 'int'], - ]), - ] + // #[ + // ApiDoc\Title('详情'), + // ApiDoc\url('/store/staff/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'account', 'desc' => '账号', 'type' => 'string'], + // ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'], + // ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'], + // ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'], + // ['name' => 'verify_status', 'desc' => '核销开关,1开启,0关闭', 'type' => 'int'], + // ['name' => 'order_status', 'desc' => '订单状态,1开启,0关闭', 'type' => 'int'], + // ['name' => 'is_admin', 'desc' => '是否管理员,1是,0不是', 'type' => 'int'], + // ['name' => 'is_manager', 'desc' => '是否是店长,1是,0不是', 'type' => 'int'], + // ['name' => 'status', 'desc' => '状态,1启用,0禁用', 'type' => 'int'], + // ]), + // ] public function detail(SystemStoreStaffLogic $staffLogic) { $id = $this->request->get('id'); @@ -128,15 +127,15 @@ class StaffController extends BaseAdminController return $this->data($data); } - #[ - ApiDoc\Title('开启/关闭'), - ApiDoc\url('/store/staff/status'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('开启/关闭'), + // ApiDoc\url('/store/staff/status'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function status(SystemStoreStaffLogic $logic) { $id = $this->request->post('id'); diff --git a/app/store/controller/UploadController.php b/app/store/controller/UploadController.php index 2cfc92110..cd00fde5a 100644 --- a/app/store/controller/UploadController.php +++ b/app/store/controller/UploadController.php @@ -6,9 +6,7 @@ namespace app\store\controller; use app\common\service\UploadService; use Exception; -use Tinywan\Storage\Storage; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class UploadController extends BaseAdminController { diff --git a/app/store/controller/WorkbenchController.php b/app/store/controller/WorkbenchController.php index 6788b71ca..3ca20e3cb 100644 --- a/app/store/controller/WorkbenchController.php +++ b/app/store/controller/WorkbenchController.php @@ -5,23 +5,22 @@ namespace app\store\controller; use app\common\controller\Definitions; use app\store\lists\store_order\StoreOrderLists; use app\store\logic\WorkbenchLogic; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\Title('工作台')] +// #[ApiDoc\Title('工作台')] class WorkbenchController extends BaseAdminController { - #[ - ApiDoc\Title('交易统计'), - ApiDoc\url('/store/workbench/index'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('交易统计'), + // ApiDoc\url('/store/workbench/index'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function index() { $params = $this->request->get(); @@ -30,17 +29,17 @@ class WorkbenchController extends BaseAdminController return $this->data($result); } - #[ - ApiDoc\Title('商品统计(暂时不用)'), - ApiDoc\url('/store/workbench/product'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('商品统计(暂时不用)'), + // ApiDoc\url('/store/workbench/product'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function product() { $params = $this->request->get(); @@ -49,17 +48,17 @@ class WorkbenchController extends BaseAdminController return $this->data($result); } - #[ - ApiDoc\Title('配送统计'), - ApiDoc\url('/store/workbench/delivery'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('配送统计'), + // ApiDoc\url('/store/workbench/delivery'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function delivery() { $params = $this->request->get(); @@ -68,18 +67,18 @@ class WorkbenchController extends BaseAdminController return $this->data($result); } - #[ - ApiDoc\Title('配送订单统计'), - ApiDoc\url('/store/workbench/deliveryOrder'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('配送订单统计'), + // ApiDoc\url('/store/workbench/deliveryOrder'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function deliveryOrder() { $params = $this->request->get(); @@ -88,17 +87,17 @@ class WorkbenchController extends BaseAdminController return $this->data($result); } - #[ - ApiDoc\Title('商品统计-概况'), - ApiDoc\url('/store/workbench/get_basic'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('商品统计-概况'), + // ApiDoc\url('/store/workbench/get_basic'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function get_basic(\app\admin\controller\WorkbenchController $workbench) { $params = $this->request->get(); @@ -106,17 +105,17 @@ class WorkbenchController extends BaseAdminController return $workbench->get_basic(); } - #[ - ApiDoc\Title('商品统计-图表'), - ApiDoc\url('/store/workbench/get_trend'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('商品统计-图表'), + // ApiDoc\url('/store/workbench/get_trend'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function get_trend(\app\admin\controller\WorkbenchController $workbench) { $params = $this->request->get(); @@ -124,17 +123,17 @@ class WorkbenchController extends BaseAdminController return $workbench->get_trend(); } - #[ - ApiDoc\Title('商品统计-排行'), - ApiDoc\url('/store/workbench/get_product_ranking'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('商品统计-排行'), + // ApiDoc\url('/store/workbench/get_product_ranking'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: true, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: true, desc: '结束时间'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function get_product_ranking(\app\admin\controller\WorkbenchController $workbench) { $params = $this->request->get(); @@ -143,16 +142,16 @@ class WorkbenchController extends BaseAdminController } - #[ - ApiDoc\Title('收银台数据统计'), - ApiDoc\url('/store/workbench/business_statistics'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('收银台数据统计'), + // ApiDoc\url('/store/workbench/business_statistics'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function business_statistics() { $params = $this->request->get(); diff --git a/app/store/controller/auth/AdminController.php b/app/store/controller/auth/AdminController.php index 50c75f336..0ec1f6cbf 100644 --- a/app/store/controller/auth/AdminController.php +++ b/app/store/controller/auth/AdminController.php @@ -19,38 +19,37 @@ use app\store\lists\auth\AdminLists; use app\store\validate\auth\AdminValidate; use app\store\logic\auth\AdminLogic; use app\store\validate\auth\editSelfValidate; -use hg\apidoc\annotation as ApiDoc; /** * 管理员控制器 * Class AdminController * @package app\store\controller\auth */ -#[ApiDoc\title('管理员信息')] +// #[ApiDoc\title('管理员信息')] class AdminController extends BaseAdminController { - #[ - ApiDoc\Title("查看管理员列表"), - ApiDoc\url('/store/auth/admin/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title("查看管理员列表"), + // ApiDoc\url('/store/auth/admin/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function lists() { return $this->dataLists(new AdminLists()); } - #[ - ApiDoc\Title("添加管理员"), - ApiDoc\url('/store/auth/admin/add'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title("添加管理员"), + // ApiDoc\url('/store/auth/admin/add'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function add() { $params = (new AdminValidate())->post()->goCheck('add'); @@ -61,14 +60,14 @@ class AdminController extends BaseAdminController return $this->fail(AdminLogic::getError()); } - #[ - ApiDoc\Title("编辑管理员"), - ApiDoc\url('/store/auth/admin/edit'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title("编辑管理员"), + // ApiDoc\url('/store/auth/admin/edit'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function edit() { $params = (new AdminValidate())->post()->goCheck('edit'); @@ -79,14 +78,14 @@ class AdminController extends BaseAdminController return $this->fail(AdminLogic::getError()); } - #[ - ApiDoc\Title("删除管理员"), - ApiDoc\url('/store/auth/admin/delete'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title("删除管理员"), + // ApiDoc\url('/store/auth/admin/delete'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function delete() { $params = (new AdminValidate())->post()->goCheck('delete'); @@ -97,14 +96,14 @@ class AdminController extends BaseAdminController return $this->fail(AdminLogic::getError()); } - #[ - ApiDoc\Title("查看管理员详情"), - ApiDoc\url('/store/auth/admin/detail'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title("查看管理员详情"), + // ApiDoc\url('/store/auth/admin/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function detail() { $params = (new AdminValidate())->goCheck('detail'); @@ -112,28 +111,28 @@ class AdminController extends BaseAdminController return $this->data($result); } - #[ - ApiDoc\Title("获取当前管理员信息"), - ApiDoc\url('/store/auth/admin/mySelf'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title("获取当前管理员信息"), + // ApiDoc\url('/store/auth/admin/mySelf'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function mySelf() { $result = AdminLogic::detail(['id' => $this->adminId], 'auth'); return $this->data($result); } - #[ - ApiDoc\Title("编辑超级管理员信息"), - ApiDoc\url('/store/auth/admin/editSelf'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title("编辑超级管理员信息"), + // ApiDoc\url('/store/auth/admin/editSelf'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(name: "token", type: "string", require: true, desc: "token"), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function editSelf() { $params = (new editSelfValidate())->post()->goCheck('', ['admin_id' => $this->adminId]); diff --git a/app/store/controller/auth/MenuController.php b/app/store/controller/auth/MenuController.php index 0dd8ff82b..caa58acf6 100644 --- a/app/store/controller/auth/MenuController.php +++ b/app/store/controller/auth/MenuController.php @@ -19,7 +19,6 @@ use app\store\controller\BaseAdminController; use app\store\lists\auth\MenuLists; use app\store\logic\auth\MenuLogic; use app\store\validate\auth\MenuValidate; -use hg\apidoc\annotation as ApiDoc; /** @@ -27,7 +26,7 @@ use hg\apidoc\annotation as ApiDoc; * Class MenuController * @package app\store\controller\setting\system */ -#[ApiDoc\NotParse()] + class MenuController extends BaseAdminController { diff --git a/app/store/controller/auth/RoleController.php b/app/store/controller/auth/RoleController.php index 8cd0ee800..02557bb03 100644 --- a/app/store/controller/auth/RoleController.php +++ b/app/store/controller/auth/RoleController.php @@ -20,14 +20,12 @@ use app\store\{ validate\auth\RoleValidate, controller\BaseAdminController }; -use hg\apidoc\annotation as ApiDoc; - /** * 角色控制器 * Class RoleController * @package app\store\controller\auth */ -#[ApiDoc\NotParse()] + class RoleController extends BaseAdminController { diff --git a/app/store/controller/cart/CartController.php b/app/store/controller/cart/CartController.php index 6f3e640d8..e190a385b 100644 --- a/app/store/controller/cart/CartController.php +++ b/app/store/controller/cart/CartController.php @@ -8,9 +8,8 @@ use app\common\model\store_branch_product\StoreBranchProduct; use app\store\lists\cart\CartList; use app\common\model\order\Cart; use app\store\controller\BaseAdminController; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + class CartController extends BaseAdminController { public function list() diff --git a/app/store/controller/cate/CateController.php b/app/store/controller/cate/CateController.php index 870d369b9..d44b62da3 100644 --- a/app/store/controller/cate/CateController.php +++ b/app/store/controller/cate/CateController.php @@ -5,8 +5,7 @@ namespace app\store\controller\cate; use app\store\controller\BaseAdminController; use app\api\lists\cate\CateLists; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\NotParse()] + /** * 商品分类控制器 diff --git a/app/store/controller/finance/FinanceController.php b/app/store/controller/finance/FinanceController.php index 2ed913b22..fb0e2f2ef 100644 --- a/app/store/controller/finance/FinanceController.php +++ b/app/store/controller/finance/FinanceController.php @@ -6,54 +6,53 @@ use app\admin\lists\store_finance_flow\StoreFinanceFlowLists; use app\common\controller\Definitions; use app\common\logic\StoreFinanceFlowLogic; use app\store\controller\BaseAdminController; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('财务')] +// #[ApiDoc\title('财务')] class FinanceController extends BaseAdminController { - #[ - ApiDoc\Title('财务流水'), - ApiDoc\url('/store/finance/finance/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '订单编号'), - ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), - ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'financial_record_sn', 'desc' => '流水号', 'type' => 'string'], - ['name' => 'order_sn', 'desc' => '订单号', 'type' => 'string'], - ['name' => 'number', 'desc' => '金额', 'type' => 'float'], - ['name' => 'create_time', 'desc' => '创建时间', 'type' => 'string'], - ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'], - ['name' => 'staff_name', 'desc' => '店员', 'type' => 'string'], - ['name' => 'store_name', 'desc' => '店铺名称', 'type' => 'string'], - ['name' => 'pay_type_name', 'desc' => '支付方式', 'type' => 'string'], - ['name' => 'financial_type_name', 'desc' => '流水类型', 'type' => 'string'], - ['name' => 'remark', 'desc' => '备注', 'type' => 'string'], - ]), - ] + // #[ + // ApiDoc\Title('财务流水'), + // ApiDoc\url('/store/finance/finance/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '订单编号'), + // ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'financial_record_sn', 'desc' => '流水号', 'type' => 'string'], + // ['name' => 'order_sn', 'desc' => '订单号', 'type' => 'string'], + // ['name' => 'number', 'desc' => '金额', 'type' => 'float'], + // ['name' => 'create_time', 'desc' => '创建时间', 'type' => 'string'], + // ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'], + // ['name' => 'staff_name', 'desc' => '店员', 'type' => 'string'], + // ['name' => 'store_name', 'desc' => '店铺名称', 'type' => 'string'], + // ['name' => 'pay_type_name', 'desc' => '支付方式', 'type' => 'string'], + // ['name' => 'financial_type_name', 'desc' => '流水类型', 'type' => 'string'], + // ['name' => 'remark', 'desc' => '备注', 'type' => 'string'], + // ]), + // ] public function lists() { return $this->dataLists(new StoreFinanceFlowLists()); } - #[ - ApiDoc\Title('备注'), - ApiDoc\url('/store/finance/finance/remark'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\Param(name: 'remark', type: 'string', require: true, desc: '备注'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('备注'), + // ApiDoc\url('/store/finance/finance/remark'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\Param(name: 'remark', type: 'string', require: true, desc: '备注'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function remark(StoreFinanceFlowLogic $logic) { $id = $this->request->post('id'); diff --git a/app/store/controller/finance/StoreBillController.php b/app/store/controller/finance/StoreBillController.php index 426f7cddd..50c7fb34c 100644 --- a/app/store/controller/finance/StoreBillController.php +++ b/app/store/controller/finance/StoreBillController.php @@ -6,46 +6,45 @@ use app\admin\lists\store_finance_flow\StoreFinanceFlowLists; use app\common\controller\Definitions; use app\common\lists\StoreBillLists; use app\store\controller\BaseAdminController; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('账单记录')] +// #[ApiDoc\title('账单记录')] class StoreBillController extends BaseAdminController { - #[ - ApiDoc\Title('列表'), - ApiDoc\url('/store/finance/storeBill/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'type', type: 'int', require: false, desc: '类型:1日账单,2周账单,3月账单'), - ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'), - ApiDoc\Query(name: 'export', type: 'int', require: false, desc: '是否导出:2是'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('列表'), + // ApiDoc\url('/store/finance/storeBill/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'type', type: 'int', require: false, desc: '类型:1日账单,2周账单,3月账单'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'), + // ApiDoc\Query(name: 'export', type: 'int', require: false, desc: '是否导出:2是'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function lists() { return $this->dataLists(new StoreBillLists()); } - #[ - ApiDoc\Title('详情'), - ApiDoc\url('/store/finance/storeBill/detail'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\Query(name: 'date_type', type: 'int', require: false, desc: '日期类型:1日账单,2周账单,3月账单'), - ApiDoc\Query(name: 'date', type: 'string', require: false, desc: '日期,日账单:2021-01-01,周账单:2024-W23,月账单:2021-01'), - ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), - ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '流水号/用户昵称'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('详情'), + // ApiDoc\url('/store/finance/storeBill/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\Query(name: 'date_type', type: 'int', require: false, desc: '日期类型:1日账单,2周账单,3月账单'), + // ApiDoc\Query(name: 'date', type: 'string', require: false, desc: '日期,日账单:2021-01-01,周账单:2024-W23,月账单:2021-01'), + // ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), + // ApiDoc\Query(name: 'keyword', type: 'string', require: false, desc: '流水号/用户昵称'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function detail() { return $this->dataLists(new StoreFinanceFlowLists()); diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 0dda0ad55..f8043f220 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -14,7 +14,6 @@ use app\store\controller\BaseAdminController; use app\common\logic\store_order\StoreOrderLogic; use app\common\model\store_order\StoreOrder; use app\store\validate\store_order\StoreOrderValidate; -use hg\apidoc\annotation as ApiDoc; use support\Log; use Webman\RedisQueue\Redis; @@ -23,59 +22,59 @@ use Webman\RedisQueue\Redis; * Class StoreOrderController * @package app\store\controller\store_order */ -#[ApiDoc\title('订单')] +// #[ApiDoc\title('订单')] class StoreOrderController extends BaseAdminController { - #[ - ApiDoc\Title('订单列表'), - ApiDoc\url('/store/store_order/storeOrder/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'order_id', type: 'string', require: false, desc: '订单编号'), - ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), - ApiDoc\Query(name: 'delivery_phone', type: 'int', require: false, desc: '配送员手机号'), - ApiDoc\Query(name: 'shipping_type', type: 'int', require: false, desc: '订单配送方式:1配送订单,2核销订单,3收银台订单'), - ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'), - ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'), - ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:-1待支付,0待发货,1待收货,2已完成'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'order_id', 'desc' => '订单编号', 'type' => 'string'], - ['name' => 'pay_price', 'desc' => '支付金额', 'type' => 'string'], - ['name' => 'pay_time', 'desc' => '支付时间', 'type' => 'float'], - ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'float'], - ['name' => 'status_name', 'desc' => '状态', 'type' => 'int'], - ['name' => 'staff_name', 'desc' => '店员', 'type' => 'int'], - ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'], - ['name' => 'avatar', 'desc' => '用户头像', 'type' => 'string'], - ['name' => 'product', 'desc' => '商品信息', 'type' => 'array', 'children' => [ - ['name' => 'cart_info', 'desc' => '商品信息', 'type' => 'array', 'children' => [ - ['name' => 'name', 'desc' => '商品名称', 'type' => 'int'], - ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'string'], - ['name' => 'price', 'desc' => '单价', 'type' => 'string'], - ]], - ]], - ]), - ] + // #[ + // ApiDoc\Title('订单列表'), + // ApiDoc\url('/store/store_order/storeOrder/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'order_id', type: 'string', require: false, desc: '订单编号'), + // ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), + // ApiDoc\Query(name: 'delivery_phone', type: 'int', require: false, desc: '配送员手机号'), + // ApiDoc\Query(name: 'shipping_type', type: 'int', require: false, desc: '订单配送方式:1配送订单,2核销订单,3收银台订单'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'), + // ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'), + // ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:-1待支付,0待发货,1待收货,2已完成'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'order_id', 'desc' => '订单编号', 'type' => 'string'], + // ['name' => 'pay_price', 'desc' => '支付金额', 'type' => 'string'], + // ['name' => 'pay_time', 'desc' => '支付时间', 'type' => 'float'], + // ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'float'], + // ['name' => 'status_name', 'desc' => '状态', 'type' => 'int'], + // ['name' => 'staff_name', 'desc' => '店员', 'type' => 'int'], + // ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'], + // ['name' => 'avatar', 'desc' => '用户头像', 'type' => 'string'], + // ['name' => 'product', 'desc' => '商品信息', 'type' => 'array', 'children' => [ + // ['name' => 'cart_info', 'desc' => '商品信息', 'type' => 'array', 'children' => [ + // ['name' => 'name', 'desc' => '商品名称', 'type' => 'int'], + // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], + // ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'string'], + // ['name' => 'price', 'desc' => '单价', 'type' => 'string'], + // ]], + // ]], + // ]), + // ] public function lists() { return $this->dataLists(new StoreOrderLists()); } - #[ - ApiDoc\Title('订单统计'), - ApiDoc\url('/store/store_order/storeOrder/title'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('订单统计'), + // ApiDoc\url('/store/store_order/storeOrder/title'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function title(SystemStoreStaffLogic $staffLogic, StoreOrderLogic $orderLogic) { return $this->data([ @@ -90,17 +89,17 @@ class StoreOrderController extends BaseAdminController ]); } - #[ - ApiDoc\Title('订单详情'), - ApiDoc\url('/store/store_order/storeOrder/detail'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(name: 'id', type: 'int', require: false, desc: '订单id'), - ApiDoc\Query(name: 'verify_code', type: 'string', require: false, desc: '核销码'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('订单详情'), + // ApiDoc\url('/store/store_order/storeOrder/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(name: 'id', type: 'int', require: false, desc: '订单id'), + // ApiDoc\Query(name: 'verify_code', type: 'string', require: false, desc: '核销码'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function detail(StoreOrderLogic $orderLogic) { $params = (new StoreOrderValidate())->goCheck('detail'); @@ -253,17 +252,17 @@ class StoreOrderController extends BaseAdminController } - #[ - ApiDoc\Title('订单已核销列表'), - ApiDoc\url('/store/store_order/storeOrder/writeoff_list'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(name: 'page_no', type: 'int', require: false, desc: '页数 默认1'), - ApiDoc\Query(name: 'page_size', type: 'int', require: false, desc: '每页条数 默认15'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('订单已核销列表'), + // ApiDoc\url('/store/store_order/storeOrder/writeoff_list'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(name: 'page_no', type: 'int', require: false, desc: '页数 默认1'), + // ApiDoc\Query(name: 'page_size', type: 'int', require: false, desc: '每页条数 默认15'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function writeoff_list(StoreOrderLogic $orderLogic) { $page_no = (int)$this->request->post('page_no', 1); diff --git a/app/store/controller/store_order/StoreRefundOrderController.php b/app/store/controller/store_order/StoreRefundOrderController.php index 14ffbb3ec..5857b772c 100644 --- a/app/store/controller/store_order/StoreRefundOrderController.php +++ b/app/store/controller/store_order/StoreRefundOrderController.php @@ -7,66 +7,65 @@ use app\common\lists\order\StoreRefundOrderLists; use app\store\controller\BaseAdminController; use app\common\logic\store_order\StoreOrderLogic; use app\store\validate\store_order\StoreOrderValidate; -use hg\apidoc\annotation as ApiDoc; /** * 订单列表控制器 * Class StoreOrderController * @package app\store\controller\store_order */ -#[ApiDoc\title('退款订单')] +// #[ApiDoc\title('退款订单')] class StoreRefundOrderController extends BaseAdminController { - #[ - ApiDoc\Title('订单列表'), - ApiDoc\url('/store/store_order/storeRefundOrder/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Query(name: 'order_id', type: 'string', require: false, desc: '订单编号'), - ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间', mock: "@datetime('yyyy-MM-dd')"), - ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间', mock: "@datetime('yyyy-MM-dd')"), - ApiDoc\Query(name: 'refund_type', type: 'int', require: false, desc: '状态:1仅退款,2退款退货,3拒绝退款,4商品待退货,5退货待收货,6已退款', mock: "@integer(1, 6)"), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'order_id', 'desc' => '订单编号', 'type' => 'string'], - ['name' => 'pay_price', 'desc' => '支付金额', 'type' => 'string'], - ['name' => 'pay_time', 'desc' => '支付时间', 'type' => 'float'], - ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'float'], - ['name' => 'status_name', 'desc' => '状态', 'type' => 'int'], - ['name' => 'refund_status_name', 'desc' => '退款状态', 'type' => 'string'], - ['name' => 'refund_type_name', 'desc' => '退款类型', 'type' => 'string'], - ['name' => 'refund_reason_time', 'desc' => '退款时间', 'type' => 'int'], - ['name' => 'staff_name', 'desc' => '店员', 'type' => 'int'], - ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'], - ['name' => 'avatar', 'desc' => '用户头像', 'type' => 'string'], - ['name' => 'product', 'desc' => '商品信息', 'type' => 'array', 'children' => [ - ['name' => 'cart_info', 'desc' => '商品信息', 'type' => 'array', 'children' => [ - ['name' => 'name', 'desc' => '商品名称', 'type' => 'int'], - ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'string'], - ['name' => 'price', 'desc' => '单价', 'type' => 'string'], - ]], - ]], - ]), - ] + // #[ + // ApiDoc\Title('订单列表'), + // ApiDoc\url('/store/store_order/storeRefundOrder/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Query(name: 'order_id', type: 'string', require: false, desc: '订单编号'), + // ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间', mock: "@datetime('yyyy-MM-dd')"), + // ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间', mock: "@datetime('yyyy-MM-dd')"), + // ApiDoc\Query(name: 'refund_type', type: 'int', require: false, desc: '状态:1仅退款,2退款退货,3拒绝退款,4商品待退货,5退货待收货,6已退款', mock: "@integer(1, 6)"), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'order_id', 'desc' => '订单编号', 'type' => 'string'], + // ['name' => 'pay_price', 'desc' => '支付金额', 'type' => 'string'], + // ['name' => 'pay_time', 'desc' => '支付时间', 'type' => 'float'], + // ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'float'], + // ['name' => 'status_name', 'desc' => '状态', 'type' => 'int'], + // ['name' => 'refund_status_name', 'desc' => '退款状态', 'type' => 'string'], + // ['name' => 'refund_type_name', 'desc' => '退款类型', 'type' => 'string'], + // ['name' => 'refund_reason_time', 'desc' => '退款时间', 'type' => 'int'], + // ['name' => 'staff_name', 'desc' => '店员', 'type' => 'int'], + // ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'], + // ['name' => 'avatar', 'desc' => '用户头像', 'type' => 'string'], + // ['name' => 'product', 'desc' => '商品信息', 'type' => 'array', 'children' => [ + // ['name' => 'cart_info', 'desc' => '商品信息', 'type' => 'array', 'children' => [ + // ['name' => 'name', 'desc' => '商品名称', 'type' => 'int'], + // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], + // ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'string'], + // ['name' => 'price', 'desc' => '单价', 'type' => 'string'], + // ]], + // ]], + // ]), + // ] public function lists() { return $this->dataLists(new StoreRefundOrderLists()); } - #[ - ApiDoc\Title('编辑订单'), - ApiDoc\url('/store/store_order/storeRefundOrder/edit'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('编辑订单'), + // ApiDoc\url('/store/store_order/storeRefundOrder/edit'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function edit() { $params = (new StoreOrderValidate())->post()->goCheck('edit'); @@ -77,16 +76,16 @@ class StoreRefundOrderController extends BaseAdminController return $this->fail(StoreOrderLogic::getError()); } - #[ - ApiDoc\Title('订单详情'), - ApiDoc\url('/store/store_order/storeRefundOrder/detail'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Author('中国队长'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(name: 'id', type: 'int', require: true, desc: '订单id'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('订单详情'), + // ApiDoc\url('/store/store_order/storeRefundOrder/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Author('中国队长'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(name: 'id', type: 'int', require: true, desc: '订单id'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function detail(StoreOrderLogic $orderLogic) { $params = (new StoreOrderValidate())->goCheck('detail'); diff --git a/app/store/controller/store_product/StoreProductController.php b/app/store/controller/store_product/StoreProductController.php index c1aa3e16e..780430b60 100644 --- a/app/store/controller/store_product/StoreProductController.php +++ b/app/store/controller/store_product/StoreProductController.php @@ -9,7 +9,6 @@ use app\store\controller\BaseAdminController; use app\store\logic\store_branch_product\StoreBranchProductLogic; use app\store\logic\store_product\StoreProductLogic; use app\store\validate\store_product\StoreProductValidate; -use hg\apidoc\annotation as ApiDoc; /** @@ -17,57 +16,57 @@ use hg\apidoc\annotation as ApiDoc; * Class StoreProductController * @package app\store\controller\store_product */ -#[ApiDoc\title('商品列表')] +// #[ApiDoc\title('商品列表')] class StoreProductController extends BaseAdminController { - #[ - ApiDoc\Title('商品列表'), - ApiDoc\url('/store/store_product/storeProduct/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Query(name: 'cate_id', type: 'int', require: false, desc: '分类id'), - ApiDoc\Query(name: 'store_name', type: 'string', require: false, desc: '商品名称'), - ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:1上架,2下架,3售罄,4库存告警'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'product_id', 'desc' => '商品ID', 'type' => 'int'], - ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], - ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], - ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], - ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], - ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], - ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], - ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], - ['name' => 'status', 'desc' => '状态:1上架,0下架', 'type' => 'string'], - ]), - ] + // #[ + // ApiDoc\Title('商品列表'), + // ApiDoc\url('/store/store_product/storeProduct/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Query(name: 'cate_id', type: 'int', require: false, desc: '分类id'), + // ApiDoc\Query(name: 'store_name', type: 'string', require: false, desc: '商品名称'), + // ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:1上架,2下架,3售罄,4库存告警'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'product_id', 'desc' => '商品ID', 'type' => 'int'], + // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], + // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], + // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], + // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], + // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], + // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], + // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], + // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], + // ['name' => 'status', 'desc' => '状态:1上架,0下架', 'type' => 'string'], + // ]), + // ] public function lists() { return $this->dataLists(new StoreBranchProductLists()); } - #[ - ApiDoc\Title('添加商品'), - ApiDoc\url('/store/store_product/storeProduct/add'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], - ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], - ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], - ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], - ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], - ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], - ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], - ]), - ] + // #[ + // ApiDoc\Title('添加商品'), + // ApiDoc\url('/store/store_product/storeProduct/add'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], + // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], + // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], + // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], + // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], + // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], + // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], + // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], + // ]), + // ] public function add() { $params = (new StoreProductValidate())->post()->goCheck('add'); @@ -78,25 +77,25 @@ class StoreProductController extends BaseAdminController return $this->fail(StoreProductLogic::getError()); } - #[ - ApiDoc\Title('编辑商品'), - ApiDoc\url('/store/store_product/storeProduct/edit'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], - ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], - ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], - ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], - ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], - ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], - ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], - ]), - ] + // #[ + // ApiDoc\Title('编辑商品'), + // ApiDoc\url('/store/store_product/storeProduct/edit'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], + // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], + // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], + // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], + // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], + // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], + // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], + // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], + // ]), + // ] public function edit() { $params = (new StoreProductValidate())->post()->goCheck('edit'); @@ -107,25 +106,25 @@ class StoreProductController extends BaseAdminController return $this->fail(StoreProductLogic::getError()); } - #[ - ApiDoc\Title('删除商品'), - ApiDoc\url('/store/store_product/storeProduct/delete'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], - ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], - ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], - ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], - ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], - ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], - ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], - ]), - ] + // #[ + // ApiDoc\Title('删除商品'), + // ApiDoc\url('/store/store_product/storeProduct/delete'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], + // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], + // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], + // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], + // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], + // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], + // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], + // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], + // ]), + // ] public function delete() { $params = (new StoreProductValidate())->post()->goCheck('delete'); @@ -133,25 +132,25 @@ class StoreProductController extends BaseAdminController return $this->success('删除成功', [], 1, 1); } - #[ - ApiDoc\Title('商品详情'), - ApiDoc\url('/store/store_product/storeProduct/detail'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], - ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], - ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], - ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], - ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], - ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], - ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], - ]), - ] + // #[ + // ApiDoc\Title('商品详情'), + // ApiDoc\url('/store/store_product/storeProduct/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Query(name: "id", type: "int", require: true, desc: "id"), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], + // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], + // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], + // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], + // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], + // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], + // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], + // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], + // ]), + // ] public function detail() { $params = (new StoreProductValidate())->goCheck('detail'); @@ -159,15 +158,15 @@ class StoreProductController extends BaseAdminController return $this->data($result); } - #[ - ApiDoc\Title('商品上下架'), - ApiDoc\url('/store/store_product/storeProduct/status'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('商品上下架'), + // ApiDoc\url('/store/store_product/storeProduct/status'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Param(name: "id", type: "int", require: true, desc: "id"), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function status() { $params = (new StoreProductValidate())->post()->goCheck('detail'); @@ -175,19 +174,19 @@ class StoreProductController extends BaseAdminController return $this->success('操作成功', [], 1, 1); } - #[ - ApiDoc\Title('商品库存增减'), - ApiDoc\url('/store/store_product/storeProduct/stock'), - ApiDoc\Method('POST'), - ApiDoc\Param(name: "attrs", type: "array", require: true, desc: "id", children: [ - ['name' => 'unique', 'desc' => '唯一值', 'type' => 'string'], - ['name' => 'type', 'desc' => '类型:1增加,2减少', 'type' => 'int'], - ['name' => 'number', 'desc' => '数量', 'type' => 'int'], - ]), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('商品库存增减'), + // ApiDoc\url('/store/store_product/storeProduct/stock'), + // ApiDoc\Method('POST'), + // ApiDoc\Param(name: "attrs", type: "array", require: true, desc: "id", children: [ + // ['name' => 'unique', 'desc' => '唯一值', 'type' => 'string'], + // ['name' => 'type', 'desc' => '类型:1增加,2减少', 'type' => 'int'], + // ['name' => 'number', 'desc' => '数量', 'type' => 'int'], + // ]), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function stock() { $params = (new StoreProductValidate())->post()->goCheck('stock'); diff --git a/app/store/controller/store_product/StoreStorageController.php b/app/store/controller/store_product/StoreStorageController.php index 0fc5a2509..77ade604c 100644 --- a/app/store/controller/store_product/StoreStorageController.php +++ b/app/store/controller/store_product/StoreStorageController.php @@ -7,38 +7,37 @@ use app\store\controller\BaseAdminController; use app\admin\lists\system_store_storage\SystemStoreStorageLists; use app\admin\logic\system_store_storage\SystemStoreStorageLogic; use app\admin\validate\system_store_storage\SystemStoreStorageValidate; -use hg\apidoc\annotation as ApiDoc; -#[ApiDoc\title('入库管理')] +// #[ApiDoc\title('入库管理')] class StoreStorageController extends BaseAdminController { - #[ - ApiDoc\Title('入库记录'), - ApiDoc\url('/store/store_product/storeStorage/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Query(name: 'store_id', type: 'int', require: false, desc: '门店id'), - ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), - ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:0-待确认,1-已确认'), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('入库记录'), + // ApiDoc\url('/store/store_product/storeStorage/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Query(name: 'store_id', type: 'int', require: false, desc: '门店id'), + // ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), + // ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:0-待确认,1-已确认'), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function lists() { return $this->dataLists(new SystemStoreStorageLists()); } - #[ - ApiDoc\Title('确认入库'), - ApiDoc\url('/store/store_product/storeStorage/confirm'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), - ApiDoc\ResponseSuccess("data", type: "array"), - ] + // #[ + // ApiDoc\Title('确认入库'), + // ApiDoc\url('/store/store_product/storeStorage/confirm'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Param(name: 'id', type: 'int', require: true, desc: 'id'), + // ApiDoc\ResponseSuccess("data", type: "array"), + // ] public function confirm() { $params = (new SystemStoreStorageValidate())->post()->goCheck('edit'); diff --git a/app/store/controller/store_product_attr_value/StoreProductAttrValueController.php b/app/store/controller/store_product_attr_value/StoreProductAttrValueController.php index ae7c08238..9b99546ac 100644 --- a/app/store/controller/store_product_attr_value/StoreProductAttrValueController.php +++ b/app/store/controller/store_product_attr_value/StoreProductAttrValueController.php @@ -8,7 +8,6 @@ use app\store\controller\BaseAdminController; use app\store\lists\store_product_attr_value\StoreProductAttrValueLists; use app\store\logic\store_product_attr_value\StoreProductAttrValueLogic; use app\store\validate\store_product_attr_value\StoreProductAttrValueValidate; -use hg\apidoc\annotation as ApiDoc; /** @@ -16,47 +15,47 @@ use hg\apidoc\annotation as ApiDoc; * Class StoreProductAttrValueController * @package app\store\controller\store_product_attr_value */ -#[ApiDoc\title('商品属性值')] +// #[ApiDoc\title('商品属性值')] class StoreProductAttrValueController extends BaseAdminController { - #[ - ApiDoc\Title('商品属性值列表'), - ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ApiDoc\Query(ref: [Definitions::class, "page"]), - ApiDoc\Query(name: 'product_id', type: 'int', require: true, desc: '商品ID'), - ApiDoc\Query(name: 'store_id', type: 'int', require: true, desc: '门店ID'), - ApiDoc\ResponseSuccess("data", type: "array", children: [ - ['name' => 'count', 'desc' => '总数', 'type' => 'int'], - ['name' => 'page_no', 'desc' => '页码', 'type' => 'int'], - ['name' => 'page_size', 'desc' => '每页数量', 'type' => 'int'], - ['name' => 'extend', 'desc' => '扩展数据', 'type' => 'array'], - ['name' => 'lists', 'desc' => '列表数据', 'type' => 'array', 'children' => [ - ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - ['name' => 'product_id', 'desc' => '商品ID', 'type' => 'int'], - ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], - ['name' => 'unique', 'desc' => '唯一值', 'type' => 'string'], - ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], - ['name' => 'bar_code', 'desc' => '条码', 'type' => 'string'], - ['name' => 'image', 'desc' => '规格图片', 'type' => 'string'], - ]], - ]), - ] + // #[ + // ApiDoc\Title('商品属性值列表'), + // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ApiDoc\Query(ref: [Definitions::class, "page"]), + // ApiDoc\Query(name: 'product_id', type: 'int', require: true, desc: '商品ID'), + // ApiDoc\Query(name: 'store_id', type: 'int', require: true, desc: '门店ID'), + // ApiDoc\ResponseSuccess("data", type: "array", children: [ + // ['name' => 'count', 'desc' => '总数', 'type' => 'int'], + // ['name' => 'page_no', 'desc' => '页码', 'type' => 'int'], + // ['name' => 'page_size', 'desc' => '每页数量', 'type' => 'int'], + // ['name' => 'extend', 'desc' => '扩展数据', 'type' => 'array'], + // ['name' => 'lists', 'desc' => '列表数据', 'type' => 'array', 'children' => [ + // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], + // ['name' => 'product_id', 'desc' => '商品ID', 'type' => 'int'], + // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], + // ['name' => 'unique', 'desc' => '唯一值', 'type' => 'string'], + // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], + // ['name' => 'bar_code', 'desc' => '条码', 'type' => 'string'], + // ['name' => 'image', 'desc' => '规格图片', 'type' => 'string'], + // ]], + // ]), + // ] public function lists() { return $this->dataLists(new StoreProductAttrValueLists()); } - #[ - ApiDoc\Title('添加商品属性值'), - ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/add'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ] + // #[ + // ApiDoc\Title('添加商品属性值'), + // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/add'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ] public function add() { $params = (new StoreProductAttrValueValidate())->post()->goCheck('add'); @@ -67,13 +66,13 @@ class StoreProductAttrValueController extends BaseAdminController return $this->fail(StoreProductAttrValueLogic::getError()); } - #[ - ApiDoc\Title('编辑商品属性值'), - ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/edit'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ] + // #[ + // ApiDoc\Title('编辑商品属性值'), + // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/edit'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ] public function edit() { $params = (new StoreProductAttrValueValidate())->post()->goCheck('edit'); @@ -84,13 +83,13 @@ class StoreProductAttrValueController extends BaseAdminController return $this->fail(StoreProductAttrValueLogic::getError()); } - #[ - ApiDoc\Title('删除商品属性值'), - ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/delete'), - ApiDoc\Method('POST'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ] + // #[ + // ApiDoc\Title('删除商品属性值'), + // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/delete'), + // ApiDoc\Method('POST'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ] public function delete() { $params = (new StoreProductAttrValueValidate())->post()->goCheck('delete'); @@ -98,14 +97,14 @@ class StoreProductAttrValueController extends BaseAdminController return $this->success('删除成功', [], 1, 1); } - #[ - ApiDoc\Title('获取商品属性值详情'), - ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/detail'), - ApiDoc\Method('GET'), - ApiDoc\Author('中国队长'), - ApiDoc\NotHeaders(), - ApiDoc\Header(ref: [Definitions::class, "token"]), - ] + // #[ + // ApiDoc\Title('获取商品属性值详情'), + // ApiDoc\url('/store/store_product_attr_value/storeProductAttrValue/detail'), + // ApiDoc\Method('GET'), + // ApiDoc\Author('中国队长'), + // ApiDoc\NotHeaders(), + // ApiDoc\Header(ref: [Definitions::class, "token"]), + // ] public function detail() { $params = (new StoreProductAttrValueValidate())->goCheck('detail'); diff --git a/app/store/controller/system_store_storage/SystemStoreStorageController.php b/app/store/controller/system_store_storage/SystemStoreStorageController.php index 11389cf74..b910e9a4e 100644 --- a/app/store/controller/system_store_storage/SystemStoreStorageController.php +++ b/app/store/controller/system_store_storage/SystemStoreStorageController.php @@ -9,7 +9,6 @@ use app\admin\logic\system_store_storage\SystemStoreStorageLogic; use app\admin\validate\system_store_storage\SystemStoreStorageValidate; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\system_store_storage\SystemStoreStorage; -use hg\apidoc\annotation as ApiDoc; /** @@ -17,16 +16,16 @@ use hg\apidoc\annotation as ApiDoc; * Class SystemStoreStorageController * @package app\admin\controller\system_store_storage */ -#[ApiDoc\title('门店入库记录')] +// #[ApiDoc\title('门店入库记录')] class SystemStoreStorageController extends BaseAdminController { - #[ - ApiDoc\Title('列表'), - ApiDoc\url('/store/system_store_storage/systemstorestorage/lists'), - ApiDoc\Method('GET'), - ApiDoc\NotHeaders(), - ] + // #[ + // ApiDoc\Title('列表'), + // ApiDoc\url('/store/system_store_storage/systemstorestorage/lists'), + // ApiDoc\Method('GET'), + // ApiDoc\NotHeaders(), + // ] public function lists() { return $this->dataLists(new SystemStoreStorageLists()); diff --git a/app/store/controller/user/UserController.php b/app/store/controller/user/UserController.php new file mode 100644 index 000000000..547f4f366 --- /dev/null +++ b/app/store/controller/user/UserController.php @@ -0,0 +1,41 @@ +dataLists(new UserLists()); + } + + + public function add() + { + $params = (new UserValidate())->post()->goCheck('storeAdd'); + d($params); + $result = UserLogic::StoreAdd($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(UserLogic::getError()); + } + + + public function detail() + { + $params = (new UserValidate())->goCheck('detail'); + $detail = UserLogic::detail($params['id']); + return $this->success('', $detail); + } + +} \ No newline at end of file diff --git a/app/store/controller/user/UserShipController.php b/app/store/controller/user/UserShipController.php new file mode 100644 index 000000000..e6bd8cdca --- /dev/null +++ b/app/store/controller/user/UserShipController.php @@ -0,0 +1,18 @@ +dataLists(new UserShipLists()); + } +} \ No newline at end of file diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php new file mode 100644 index 000000000..379d078f8 --- /dev/null +++ b/app/store/lists/user/UserLists.php @@ -0,0 +1,60 @@ + ['mobile'], + ]; + } + + /** + * @notes 获取用户列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author 乔峰 + * @date 2022/9/22 15:50 + */ + public function lists(): array + { + + $field = "id,nickname,real_name,sex,avatar,account,mobile,user_money,create_time"; + $lists = User::where($this->searchWhere) + ->limit($this->limitOffset, $this->limitLength) + ->field($field) + ->order('id desc') + ->select()->each(function($data){ + $data['sex_text'] = $data->sex_text; + $data['mobile'] = substr_replace($data['mobile'], '****', 3, 4); + })->toArray(); + return $lists; + } + + + /** + * @notes 获取数量 + * @return int + * @author 乔峰 + * @date 2022/9/22 15:51 + */ + public function count(): int + { + return User::where($this->searchWhere)->count(); + } +} \ No newline at end of file diff --git a/composer.json b/composer.json index 7ed7add65..6906f2cef 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,6 @@ "ext-bcmath": "*", "jpush/jpush": "^3.6", "workerman/crontab": "^1.0", - "hg/apidoc": "^5.2", "intervention/image": "^3.6", "picqer/php-barcode-generator": "^2.4" }, diff --git a/composer.lock b/composer.lock index 2b148506f..6d7daedd7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8c97deb23217033cd0ab2cb6e5b5d195", + "content-hash": "974978f64812f55d8825aabadc43739f", "packages": [ { "name": "aliyuncs/oss-sdk-php", @@ -1240,75 +1240,6 @@ ], "time": "2023-12-03T19:50:20+00:00" }, - { - "name": "hg/apidoc", - "version": "v5.2.3", - "source": { - "type": "git", - "url": "https://github.com/HGthecode/apidoc-php.git", - "reference": "328aa4fe177ed7393f680724bf3eeb485052c2fe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/HGthecode/apidoc-php/zipball/328aa4fe177ed7393f680724bf3eeb485052c2fe", - "reference": "328aa4fe177ed7393f680724bf3eeb485052c2fe", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1 || ^2", - "php": "^7.1 || ^8.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "hg\\apidoc\\providers\\LaravelService" - ] - }, - "think": { - "services": [ - "hg\\apidoc\\providers\\ThinkPHPService" - ], - "config": { - "apidoc": "src/config.php" - } - }, - "hyperf": { - "config": "hg\\apidoc\\ConfigProvider" - } - }, - "autoload": { - "psr-4": { - "hg\\apidoc\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "hg-code", - "email": "376401263@qq.com" - } - ], - "description": "根据注解生成API文档,兼容Laravel、ThinkPHP、Hyperf、Webman等框架;在线调试、Markdown文档、多应用/多版本、Mock数据、授权访问、接口生成器、代码生成器等众多实用功能", - "keywords": [ - "apidoc", - "api文档", - "markdown", - "php接口文档", - "接口文档", - "注解", - "注释生成", - "自动生成api" - ], - "support": { - "issues": "https://github.com/HGthecode/apidoc-php/issues", - "source": "https://github.com/HGthecode/apidoc-php/tree/v5.2.3" - }, - "time": "2024-03-22T02:25:31+00:00" - }, { "name": "hyperf/context", "version": "v3.1.15", diff --git a/config/plugin/hg/apidoc/app.php b/config/plugin/hg/apidoc/app.php deleted file mode 100644 index 6af1865fc..000000000 --- a/config/plugin/hg/apidoc/app.php +++ /dev/null @@ -1,105 +0,0 @@ - true, - 'apidoc' => [ - // (选配)文档标题,显示在左上角与首页 - 'title' => '接口文档', - // (选配)文档描述,显示在首页 - 'desc' => '', - // (必须)设置文档的应用/版本 - 'apps' => [ - [ - // (必须)标题 - 'title' => 'store接口', - // (必须)控制器目录地址 - 'path' => 'app\store\controller', - // (必须)唯一的key - 'key' => 'storeApi', - ], - [ - // (必须)标题 - 'title' => 'api接口', - // (必须)控制器目录地址 - 'path' => 'app\api\controller', - // (必须)唯一的key - 'key' => 'apiApi', - ] - ], - // (必须)指定通用注释定义的文件地址 - 'definitions' => "app\common\controller\Definitions", - // (必须)自动生成url规则,当接口不添加@Apidoc\Url ("xxx")注解时,使用以下规则自动生成 - 'auto_url' => [ - // 字母规则,lcfirst=首字母小写;ucfirst=首字母大写; - 'letter_rule' => "lcfirst", - // url前缀 - 'prefix' => "", - ], - // (选配)是否自动注册路由 - 'auto_register_routes' => true, - // (必须)缓存配置 - 'cache' => [ - // 是否开启缓存 - 'enable' => false, - ], - // (必须)权限认证配置 - 'auth' => [ - // 是否启用密码验证 - 'enable' => true, - // 全局访问密码 - 'password' => "qwe123", - // 密码加密盐 - 'secret_key' => "qwe123", - // 授权访问后的有效期 - 'expire' => 86400 * 7 - ], - // 全局参数 - 'params' => [ - // (选配)全局的请求Header - 'header' => [ - // name=字段名,type=字段类型,require=是否必须,default=默认值,desc=字段描述 - ['name' => 'Authorization', 'type' => 'string', 'require' => true, 'desc' => '身份令牌Token'], - ], - // (选配)全局的请求Query - 'query' => [ - // 同上 header - ], - // (选配)全局的请求Body - 'body' => [ - // 同上 header - ], - ], - // 全局响应体 - 'responses' => [ - // 成功响应体 - 'success' => [ - ['name' => 'code', 'desc' => '业务代码', 'type' => 'int', 'require' => 1], - ['name' => 'message', 'desc' => '业务信息', 'type' => 'string', 'require' => 1], - //参数同上 headers;main=true来指定接口Returned参数挂载节点 - ['name' => 'data', 'desc' => '业务数据', 'main' => true, 'type' => 'object', 'require' => 1], - ], - // 异常响应体 - 'error' => [ - ['name' => 'code', 'desc' => '业务代码', 'type' => 'int', 'require' => 1, 'md' => '/docs/HttpError.md'], - ['name' => 'message', 'desc' => '业务信息', 'type' => 'string', 'require' => 1], - ] - ], - //(选配)默认作者 - 'default_author' => '', - //(选配)默认请求类型 - 'default_method' => 'GET', - //(选配)Apidoc允许跨域访问 - 'allowCrossDomain' => false, - /** - * (选配)解析时忽略带@注解的关键词,当注解中存在带@字符并且非Apidoc注解,如 @key test,此时Apidoc页面报类似以下错误时: - * [Semantical Error] The annotation "@key" in method xxx() was never imported. Did you maybe forget to add a "use" statement for this annotation? - */ - 'ignored_annitation' => [], - - // (选配)数据库配置 - 'database' => [], - // (选配)Markdown文档 - 'docs' => [], - // (选配)接口生成器配置 注意:是一个二维数组 - 'generator' => [] - ] -]; diff --git a/config/plugin/hg/apidoc/route.php b/config/plugin/hg/apidoc/route.php deleted file mode 100644 index 1b03a1f35..000000000 --- a/config/plugin/hg/apidoc/route.php +++ /dev/null @@ -1,3 +0,0 @@ - array($vendorDir . '/topthink/think-container/src', $vendorDir . '/topthink/think-helper/src', $vendorDir . '/topthink/think-orm/src'), 'taoser\\' => array($vendorDir . '/taoser/webman-validate/src'), 'support\\' => array($vendorDir . '/workerman/webman-framework/src/support'), - 'hg\\apidoc\\' => array($vendorDir . '/hg/apidoc/src'), 'app\\View\\Components\\' => array($baseDir . '/app/view/components'), 'app\\' => array($baseDir . '/app'), 'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index b4a008779..e2aa1e0ff 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -57,10 +57,6 @@ class ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc array ( 'support\\' => 8, ), - 'h' => - array ( - 'hg\\apidoc\\' => 10, - ), 'a' => array ( 'app\\View\\Components\\' => 20, @@ -247,10 +243,6 @@ class ComposerStaticInitcefecbcff919f3c1c8084830bbb72adc array ( 0 => __DIR__ . '/..' . '/workerman/webman-framework/src/support', ), - 'hg\\apidoc\\' => - array ( - 0 => __DIR__ . '/..' . '/hg/apidoc/src', - ), 'app\\View\\Components\\' => array ( 0 => __DIR__ . '/../..' . '/app/view/components', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 7c04a8972..fc3ca9341 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1282,78 +1282,6 @@ ], "install-path": "../guzzlehttp/uri-template" }, - { - "name": "hg/apidoc", - "version": "v5.2.3", - "version_normalized": "5.2.3.0", - "source": { - "type": "git", - "url": "https://github.com/HGthecode/apidoc-php.git", - "reference": "328aa4fe177ed7393f680724bf3eeb485052c2fe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/HGthecode/apidoc-php/zipball/328aa4fe177ed7393f680724bf3eeb485052c2fe", - "reference": "328aa4fe177ed7393f680724bf3eeb485052c2fe", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1 || ^2", - "php": "^7.1 || ^8.0" - }, - "time": "2024-03-22T02:25:31+00:00", - "type": "library", - "extra": { - "laravel": { - "providers": [ - "hg\\apidoc\\providers\\LaravelService" - ] - }, - "think": { - "services": [ - "hg\\apidoc\\providers\\ThinkPHPService" - ], - "config": { - "apidoc": "src/config.php" - } - }, - "hyperf": { - "config": "hg\\apidoc\\ConfigProvider" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "hg\\apidoc\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "hg-code", - "email": "376401263@qq.com" - } - ], - "description": "根据注解生成API文档,兼容Laravel、ThinkPHP、Hyperf、Webman等框架;在线调试、Markdown文档、多应用/多版本、Mock数据、授权访问、接口生成器、代码生成器等众多实用功能", - "keywords": [ - "apidoc", - "api文档", - "markdown", - "php接口文档", - "接口文档", - "注解", - "注释生成", - "自动生成api" - ], - "support": { - "issues": "https://github.com/HGthecode/apidoc-php/issues", - "source": "https://github.com/HGthecode/apidoc-php/tree/v5.2.3" - }, - "install-path": "../hg/apidoc" - }, { "name": "hyperf/context", "version": "v3.1.15", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 43e1d6ee2..83a57723f 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'workerman/webman', - 'pretty_version' => 'dev-main', - 'version' => 'dev-main', - 'reference' => '4b5122f1ac239cde50650106617717ac4ed3db2b', + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => null, 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -154,15 +154,6 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'hg/apidoc' => array( - 'pretty_version' => 'v5.2.3', - 'version' => '5.2.3.0', - 'reference' => '328aa4fe177ed7393f680724bf3eeb485052c2fe', - 'type' => 'library', - 'install_path' => __DIR__ . '/../hg/apidoc', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'hyperf/context' => array( 'pretty_version' => 'v3.1.15', 'version' => '3.1.15.0', @@ -1038,9 +1029,9 @@ 'dev_requirement' => false, ), 'workerman/webman' => array( - 'pretty_version' => 'dev-main', - 'version' => 'dev-main', - 'reference' => '4b5122f1ac239cde50650106617717ac4ed3db2b', + 'pretty_version' => '1.0.0+no-version-set', + 'version' => '1.0.0.0', + 'reference' => null, 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/hg/apidoc/.gitignore b/vendor/hg/apidoc/.gitignore deleted file mode 100644 index 485dee64b..000000000 --- a/vendor/hg/apidoc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea diff --git a/vendor/hg/apidoc/LICENSE b/vendor/hg/apidoc/LICENSE deleted file mode 100644 index 367a697be..000000000 --- a/vendor/hg/apidoc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 HG - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/vendor/hg/apidoc/README.md b/vendor/hg/apidoc/README.md deleted file mode 100644 index 0f8ace596..000000000 --- a/vendor/hg/apidoc/README.md +++ /dev/null @@ -1,88 +0,0 @@ -
:calling: 一款满足你的多种发送需求的短信发送组件
+ + + + + + +## 特点 + +1. 支持目前市面多家服务商 +1. 一套写法兼容所有平台 +1. 简单配置即可灵活增减服务商 +1. 内置多种服务商轮询策略、支持自定义轮询策略 +1. 统一的返回值格式,便于日志与监控 +1. 自动轮询选择可用的服务商 +1. 更多等你去发现与改进... + +## 平台支持 + +- [腾讯云 SMS](https://cloud.tencent.com/product/sms) +- [Ucloud](https://www.ucloud.cn) +- [七牛云](https://www.qiniu.com/) +- [SendCloud](http://www.sendcloud.net/) +- [阿里云](https://www.aliyun.com/) +- [云片](https://www.yunpian.com) +- [Submail](https://www.mysubmail.com) +- [螺丝帽](https://luosimao.com/) +- [容联云通讯](http://www.yuntongxun.com) +- [互亿无线](http://www.ihuyi.com) +- [聚合数据](https://www.juhe.cn) +- [百度云](https://cloud.baidu.com/) +- [华信短信平台](http://www.ipyy.com/) +- [253云通讯(创蓝)](https://www.253.com/) +- [创蓝云智](https://www.chuanglan.com/) +- [融云](http://www.rongcloud.cn) +- [天毅无线](http://www.85hu.com/) +- [阿凡达数据](http://www.avatardata.cn/) +- [华为云](https://www.huaweicloud.com/product/msgsms.html) +- [网易云信](https://yunxin.163.com/sms) +- [云之讯](https://www.ucpaas.com/index.html) +- [凯信通](http://www.kingtto.cn/) +- [UE35.net](http://uesms.ue35.cn/) +- [短信宝](http://www.smsbao.com/) +- [Tiniyo](https://tiniyo.com/) +- [摩杜云](https://www.moduyun.com/) +- [融合云(助通)](https://www.ztinfo.cn/products/sms) +- [蜘蛛云](https://zzyun.com/) +- [融合云信](https://maap.wo.cn/) +- [天瑞云](http://cms.tinree.com/) +- [时代互联](https://www.now.cn/) +- [火山引擎](https://console.volcengine.com/sms/) + +## 环境需求 + +- PHP >= 5.6 + +## 安装 + +```shell +$ composer require "overtrue/easy-sms" +``` + +**For Laravel notification** + +如果你喜欢使用 [Laravel Notification](https://laravel.com/docs/5.8/notifications), 可以考虑直接使用朋友封装的拓展包: + +https://github.com/yl/easysms-notification-channel + +## 使用 + +```php +use Overtrue\EasySms\EasySms; + +$config = [ + // HTTP 请求的超时时间(秒) + 'timeout' => 5.0, + + // 默认发送配置 + 'default' => [ + // 网关调用策略,默认:顺序调用 + 'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class, + + // 默认可用的发送网关 + 'gateways' => [ + 'yunpian', 'aliyun', + ], + ], + // 可用的网关配置 + 'gateways' => [ + 'errorlog' => [ + 'file' => '/tmp/easy-sms.log', + ], + 'yunpian' => [ + 'api_key' => '824f0ff2f71cab52936axxxxxxxxxx', + ], + 'aliyun' => [ + 'access_key_id' => '', + 'access_key_secret' => '', + 'sign_name' => '', + ], + //... + ], +]; + +$easySms = new EasySms($config); + +$easySms->send(13188888888, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], +]); +``` + +## 短信内容 + +由于使用多网关发送,所以一条短信要支持多平台发送,每家的发送方式不一样,但是我们抽象定义了以下公用属性: + +- `content` 文字内容,使用在像云片类似的以文字内容发送的平台 +- `template` 模板 ID,使用在以模板ID来发送短信的平台 +- `data` 模板变量,使用在以模板ID来发送短信的平台 + +所以,在使用过程中你可以根据所要使用的平台定义发送的内容。 + +```php +$easySms->send(13188888888, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], +]); +``` + +你也可以使用闭包来返回对应的值: + +```php +$easySms->send(13188888888, [ + 'content' => function($gateway){ + return '您的验证码为: 6379'; + }, + 'template' => function($gateway){ + return 'SMS_001'; + }, + 'data' => function($gateway){ + return [ + 'code' => 6379 + ]; + }, +]); +``` + +你可以根据 `$gateway` 参数类型来判断返回值,例如: + +```php +$easySms->send(13188888888, [ + 'content' => function($gateway){ + if ($gateway->getName() == 'yunpian') { + return '云片专用验证码:1235'; + } + return '您的验证码为: 6379'; + }, + 'template' => function($gateway){ + if ($gateway->getName() == 'aliyun') { + return 'TP2818'; + } + return 'SMS_001'; + }, + 'data' => function($gateway){ + return [ + 'code' => 6379 + ]; + }, +]); +``` + +## 发送网关 + +默认使用 `default` 中的设置来发送,如果某一条短信你想要覆盖默认的设置。在 `send` 方法中使用第三个参数即可: + +```php +$easySms->send(13188888888, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], + ], ['yunpian', 'juhe']); // 这里的网关配置将会覆盖全局默认值 +``` + +## 返回值 + +由于使用多网关发送,所以返回值为一个数组,结构如下: +```php +[ + 'yunpian' => [ + 'gateway' => 'yunpian', + 'status' => 'success', + 'result' => [...] // 平台返回值 + ], + 'juhe' => [ + 'gateway' => 'juhe', + 'status' => 'failure', + 'exception' => \Overtrue\EasySms\Exceptions\GatewayErrorException 对象 + ], + //... +] +``` + +如果所选网关列表均发送失败时,将会抛出 `Overtrue\EasySms\Exceptions\NoGatewayAvailableException` 异常,你可以使用 `$e->results` 获取发送结果。 + +你也可以使用 `$e` 提供的更多便捷方法: + +```php +$e->getResults(); // 返回所有 API 的结果,结构同上 +$e->getExceptions(); // 返回所有调用异常列表 +$e->getException($gateway); // 返回指定网关名称的异常对象 +$e->getLastException(); // 获取最后一个失败的异常对象 +``` + +## 自定义网关 + +本拓展已经支持用户自定义网关,你可以很方便的配置即可当成与其它拓展一样的使用: + +```php +$config = [ + ... + 'default' => [ + 'gateways' => [ + 'mygateway', // 配置你的网站到可用的网关列表 + ], + ], + 'gateways' => [ + 'mygateway' => [...], // 你网关所需要的参数,如果没有可以不配置 + ], +]; + +$easySms = new EasySms($config); + +// 注册 +$easySms->extend('mygateway', function($gatewayConfig){ + // $gatewayConfig 来自配置文件里的 `gateways.mygateway` + return new MyGateway($gatewayConfig); +}); + +$easySms->send(13188888888, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], +]); +``` + +## 国际短信 + +国际短信与国内短信的区别是号码前面需要加国际码,但是由于各平台对国际号码的写法不一致,所以在发送国际短信的时候有一点区别: + +```php +use Overtrue\EasySms\PhoneNumber; + +// 发送到国际码为 31 的国际号码 +$number = new PhoneNumber(13188888888, 31); + +$easySms->send($number, [ + 'content' => '您的验证码为: 6379', + 'template' => 'SMS_001', + 'data' => [ + 'code' => 6379 + ], +]); +``` + +## 定义短信 + +你可以根据发送场景的不同,定义不同的短信类,从而实现一处定义多处调用,你可以继承 `Overtrue\EasySms\Message` 来定义短信模型: + +```php +order = $order; + } + + // 定义直接使用内容发送平台的内容 + public function getContent(GatewayInterface $gateway = null) + { + return sprintf('您的订单:%s, 已经完成付款', $this->order->no); + } + + // 定义使用模板发送方式平台所需要的模板 ID + public function getTemplate(GatewayInterface $gateway = null) + { + return 'SMS_003'; + } + + // 模板参数 + public function getData(GatewayInterface $gateway = null) + { + return [ + 'order_no' => $this->order->no + ]; + } +} +``` + +> 更多自定义方式请参考:[`Overtrue\EasySms\Message`](Overtrue\EasySms\Message;) + +发送自定义短信: + +```php +$order = ...; +$message = new OrderPaidMessage($order); + +$easySms->send(13188888888, $message); +``` + +## 各平台配置说明 + +### [阿里云](https://www.aliyun.com/) + +短信内容使用 `template` + `data` + +```php + 'aliyun' => [ + 'access_key_id' => '', + 'access_key_secret' => '', + 'sign_name' => '', + ], +``` + +### [阿里云Rest](https://www.aliyun.com/) + +短信内容使用 `template` + `data` + +```php + 'aliyunrest' => [ + 'app_key' => '', + 'app_secret_key' => '', + 'sign_name' => '', + ], +``` + +### [阿里云国际](https://www.alibabacloud.com/help/zh/doc-detail/160524.html) + +短信内容使用 `template` + `data` + +```php + 'aliyunintl' => [ + 'access_key_id' => '', + 'access_key_secret' => '', + 'sign_name' => '', + ], +``` + +发送示例: + +```php +use Overtrue\EasySms\PhoneNumber; + +$easySms = new EasySms($config); +$phone_number = new PhoneNumber(18888888888, 86); + +$easySms->send($phone_number, [ + 'content' => '您好:先生/女士!您的验证码为${code},有效时间是5分钟,请及时验证。', + 'template' => 'SMS_00000001', // 模板ID + 'data' => [ + "code" => 521410, + ], +]); +``` + +### [云片](https://www.yunpian.com) + +短信内容使用 `content` + +```php + 'yunpian' => [ + 'api_key' => '', + 'signature' => '【默认签名】', // 内容中无签名时使用 + ], +``` + +### [Submail](https://www.mysubmail.com) + +短信内容使用 `data` + +```php + 'submail' => [ + 'app_id' => '', + 'app_key' => '', + 'project' => '', // 默认 project,可在发送时 data 中指定 + ], +``` + +### [螺丝帽](https://luosimao.com/) + +短信内容使用 `content` + +```php + 'luosimao' => [ + 'api_key' => '', + ], +``` + +### [容联云通讯](http://www.yuntongxun.com) + +短信内容使用 `template` + `data` + +```php + 'yuntongxun' => [ + 'app_id' => '', + 'account_sid' => '', + 'account_token' => '', + 'is_sub_account' => false, + ], +``` + +### [互亿无线](http://www.ihuyi.com) + +短信内容使用 `content` + +```php + 'huyi' => [ + 'api_id' => '', + 'api_key' => '', + 'signature' => '', + ], +``` + +### [聚合数据](https://www.juhe.cn) + +短信内容使用 `template` + `data` + +```php + 'juhe' => [ + 'app_key' => '', + ], +``` + +### [SendCloud](http://www.sendcloud.net/) + +短信内容使用 `template` + `data` + +```php + 'sendcloud' => [ + 'sms_user' => '', + 'sms_key' => '', + 'timestamp' => false, // 是否启用时间戳 + ], +``` +### [百度云](https://cloud.baidu.com/) + +短信内容使用 `template` + `data` + +```php + 'baidu' => [ + 'ak' => '', + 'sk' => '', + 'invoke_id' => '', + 'domain' => '', + ], +``` + +### [华信短信平台](http://www.ipyy.com/) + +短信内容使用 `content` + +```php + 'huaxin' => [ + 'user_id' => '', + 'password' => '', + 'account' => '', + 'ip' => '', + 'ext_no' => '', + ], +``` + +### [253云通讯(创蓝)](https://www.253.com/) + +短信内容使用 `content` + +```php + 'chuanglan' => [ + 'account' => '', + 'password' => '', + + // 国际短信时必填 + 'intel_account' => '', + 'intel_password' => '', + + // \Overtrue\EasySms\Gateways\ChuanglanGateway::CHANNEL_VALIDATE_CODE => 验证码通道(默认) + // \Overtrue\EasySms\Gateways\ChuanglanGateway::CHANNEL_PROMOTION_CODE => 会员营销通道 + 'channel' => \Overtrue\EasySms\Gateways\ChuanglanGateway::CHANNEL_VALIDATE_CODE, + + // 会员营销通道 特定参数。创蓝规定:api提交营销短信的时候,需要自己加短信的签名及退订信息 + 'sign' => '【通讯云】', + 'unsubscribe' => '回TD退订', + ], +``` + +### [创蓝云智](https://www.chuanglan.com/) + +普通短信发送内容使用 `content` + +```php + 'chuanglanv1' => [ + 'account' => '', + 'password' => '', + 'needstatus' => false, + 'channel' => \Overtrue\EasySms\Gateways\Chuanglanv1Gateway::CHANNEL_NORMAL_CODE, + ], +``` +发送示例: + +```php +$easySms->send(18888888888, [ + 'content' => xxxxxxx +]); +``` + +变量短信发送内容使用 `template` + `data` + +```php + 'chuanglanv1' => [ + 'account' => '', + 'password' => '', + 'needstatus' => false, + 'channel' => \Overtrue\EasySms\Gateways\Chuanglanv1Gateway::CHANNEL_VARIABLE_CODE, + ], +``` +发送示例: + +```php +$easySms->send(18888888888, [ + 'template' => xxxxxx, // 模板内容 + 'data' => 'phone":"15800000000,1234;15300000000,4321', +]); +``` + +### [融云](http://www.rongcloud.cn) + +短信分为两大类,验证类和通知类短信。 发送验证类短信使用 `template` + `data` + +```php + 'rongcloud' => [ + 'app_key' => '', + 'app_secret' => '', + ] +``` + +### [天毅无线](http://www.85hu.com/) + +短信内容使用 `content` + +```php + 'tianyiwuxian' => [ + 'username' => '', //用户名 + 'password' => '', //密码 + 'gwid' => '', //网关ID + ] +``` + +### [twilio](https://www.twilio.com) + +短信使用 `content` +发送对象需要 使用`+`添加区号 + +```php + 'twilio' => [ + 'account_sid' => '', // sid + 'from' => '', // 发送的号码 可以在控制台购买 + 'token' => '', // apitoken + ], +``` + +### [tiniyo](https://www.tiniyo.com) + +短信使用 `content` +发送对象需要 使用`+`添加区号 + +```php + 'tiniyo' => [ + 'account_sid' => '', // auth_id from https://tiniyo.com + 'from' => '', // 发送的号码 可以在控制台购买 + 'token' => '', // auth_secret from https://tiniyo.com + ], +``` + + +### [腾讯云 SMS](https://cloud.tencent.com/product/sms) + +短信内容使用 `template` + `data` + +```php + 'qcloud' => [ + 'sdk_app_id' => '', // 短信应用的 SDK APP ID + 'secret_id' => '', // SECRET ID + 'secret_key' => '', // SECRET KEY + 'sign_name' => '腾讯CoDesign', // 短信签名 + ], +``` + +发送示例: + +```php +$easySms->send(18888888888, [ + 'template' => 101234, // 模板ID + 'data' => [ + "a", 'b', 'c', 'd', //按占位顺序给值 + ], +]); +``` + +### [阿凡达数据](http://www.avatardata.cn/) + +短信内容使用 `template` + `data` + +```php + 'avatardata' => [ + 'app_key' => '', // APP KEY + ], +``` + +### [华为云 SMS](https://www.huaweicloud.com/product/msgsms.html) + +短信内容使用 `template` + `data` + +```php + 'huawei' => [ + 'endpoint' => '', // APP接入地址 + 'app_key' => '', // APP KEY + 'app_secret' => '', // APP SECRET + 'from' => [ + 'default' => '1069012345', // 默认使用签名通道号 + 'custom' => 'csms12345', // 其他签名通道号 可以在 data 中定义 from 来指定 + 'abc' => 'csms67890', // 其他签名通道号 + ... + ], + 'callback' => '' // 短信状态回调地址 + ], +``` + +使用默认签名通道 `default` + +```php +$easySms->send(13188888888, [ + 'template' => 'SMS_001', + 'data' => [ + 6379 + ], +]); +``` + +使用指定签名通道 + +```php +$easySms->send(13188888888, [ + 'template' => 'SMS_001', + 'data' => [ + 6379, + 'from' => 'custom' // 对应 config 中的 from 数组中 custom + ], +]); +``` + +### [网易云信](https://yunxin.163.com/sms) + +短信内容使用 `template` + `data` + +```php + 'yunxin' => [ + 'app_key' => '', + 'app_secret' => '', + 'code_length' => 4, // 随机验证码长度,范围 4~10,默认为 4 + 'need_up' => false, // 是否需要支持短信上行 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_001', // 不填则使用默认模板 + 'data' => [ + 'code' => 8946, // 如果设置了该参数,则 code_length 参数无效 + 'action' => 'sendCode', // 默认为 `sendCode`,校验短信验证码使用 `verifyCode` + ], +]); +``` +通知模板短信 + +```php +$easySms->send(18888888888, [ + 'template' => 'templateid', // 模板编号(由客户顾问配置之后告知开发者) + 'data' => [ + 'action' => 'sendTemplate', // 默认为 `sendCode`,校验短信验证码使用 `verifyCode` + 'params' => [1,2,3], //短信参数列表,用于依次填充模板 + ], +]); +``` + + +### [云之讯](https://www.ucpaas.com/index.html) + +短信内容使用 `template` + `data` + +```php + 'yunzhixun' => [ + 'sid' => '', + 'token' => '', + 'app_id' => '', + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_001', + 'data' => [ + 'params' => '8946,3', // 模板参数,多个参数使用 `,` 分割,模板无参数时可为空 + 'uid' => 'hexianghui', // 用户 ID,随状态报告返回,可为空 + 'mobiles' => '18888888888,188888888889', // 批量发送短信,手机号使用 `,` 分割,不使用批量发送请不要设置该参数 + ], +]); +``` + +### [凯信通](http://www.kingtto.cn/) + +短信内容使用 `content` + +```php + 'kingtto' => [ + 'userid' => '', + 'account' => '', + 'password' => '', + ], +``` + +```php +$easySms->send(18888888888, [ + 'content' => '您的验证码为: 6379', +]); +``` + +### [七牛云](https://www.qiniu.com/) + +短信内容使用 `template` + `data` + +```php + 'qiniu' => [ + 'secret_key' => '', + 'access_key' => '', + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => '1231234123412341234', + 'data' => [ + 'code' => 1234, + ], +]); +``` +### [Ucloud](https://www.ucloud.cn/) +短信使用 `template` + `data` + +```php + 'ucloud' => [ + 'private_key' => '', //私钥 + 'public_key' => '', //公钥 + 'sig_content' => '', // 短信签名, + 'project_id' => '', //项目ID,子账号才需要该参数 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => 'UTAXXXXX', //短信模板 + 'data' => [ + 'code' => 1234, //模板参数,模板没有参数不用则填写,有多个参数请用数组,[1111,1111] + 'mobiles' =>'', //同时发送多个手机短信,请用数组[xxx,xxx] + ], +]); + +``` + + +### [短信宝](http://www.smsbao.com/) +短信使用 `content` + +```php + 'smsbao' => [ + 'user' => '', //账号 + 'password' => '' //密码 + ], +``` + +```php +$easySms->send(18888888888, [ + 'content' => '您的验证码为: 6379', //短信模板 +]); + +``` + +### [摩杜云](https://www.moduyun.com/) +短信使用 `template` + `data` + +```php + 'moduyun' => [ + 'accesskey' => '', //必填 ACCESS KEY + 'secretkey' => '', //必填 SECRET KEY + 'signId' => '', //选填 短信签名,如果使用默认签名,该字段可缺省 + 'type' => 0, //选填 0:普通短信;1:营销短信 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => '5a95****b953', //短信模板 + 'data' => [ + 1234, //模板参数,对应模板的{1} + 30 //模板参数,对应模板的{2} + //... + ], +]); + +``` + +### [融合云(助通)](https://www.ztinfo.cn/products/sms) + +短信使用 `template` + `data` + +```php + 'rongheyun' => [ + 'username' => '', //必填 用户名 + 'password' => '', //必填 密码 + 'signature'=> '', //必填 已报备的签名 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => '31874', //短信模板 + 'data' => [ + 'valid_code' => '888888', //模板参数,对应模板的{valid_code} + //... + ], +]); + +``` + +### [蜘蛛云](https://zzyun.com/) + +短信使用 `template` + `data` + +```php + 'zzyun' => [ + 'user_id' => '', //必填 会员ID + 'secret' => '', //必填 接口密钥 + 'sign_name'=> '', //必填 短信签名 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_210317****', //短信模板 + 'data' => [ + 'code' => '888888', //模板参数,对应模板的{code} + //... + ], +]); + +``` + +### [融合云信](https://maap.wo.cn/) + +短信使用 `template` + `data` + +```php + 'maap' => [ + 'cpcode' => '', //必填 商户编码 + 'key' => '', //必填 接口密钥 + 'excode'=> '', //选填 扩展名 + ], +``` + +```php +$easySms->send(18888888888, [ + 'template' => '356120', //短信模板 + 'data' => [ + '123465' + ],//模板参数 +]); + +``` + +### [天瑞云](http://cms.tinree.com/) + +短信内容使用 `template` + `data` + +```php + 'tinree' => [ + 'accesskey' => '', // 平台分配给用户的accesskey + 'secret' => '', // 平台分配给用户的secret + 'sign' => '', // 平台上申请的接口短信签名或者签名ID + ], +``` + +发送示例: + +```php +$easySms->send(18888888888, [ + 'template' => '123456', // 模板ID + 'data' => [ + "a", 'b', 'c', //按模板变量占位顺序 + ], +]); +``` + +### [时代互联](https://www.now.cn/) + +短信使用 `content` + +```php + 'nowcn' => [ + 'key' => '', //用户ID + 'secret' => '', //开发密钥 + 'api_type' => '', // 短信通道, + ], +``` + +发送示例: +```php +$easySms->send(18888888888, [ + 'content' => '您的验证码为: 6379', +]); +``` + +### [火山引擎](https://console.volcengine.com/sms/) + +短信内容使用 `template` + `data` + +```php + 'volcengine' => [ + 'access_key_id' => '', // 平台分配给用户的access_key_id + 'access_key_secret' => '', // 平台分配给用户的access_key_secret + 'region_id' => 'cn-north-1', // 国内节点 cn-north-1,国外节点 ap-singapore-1,不填或填错,默认使用国内节点 + 'sign_name' => '', // 平台上申请的接口短信签名或者签名ID,可不填,发送短信时data中指定 + 'sms_account' => '', // 消息组帐号,火山短信页面右上角,短信应用括号中的字符串,可不填,发送短信时data中指定 + ], +``` + +发送示例1: + +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_123456', // 模板ID + 'data' => [ + "code" => 1234 // 模板变量 + ], +]); +``` + +发送示例2: +```php +$easySms->send(18888888888, [ + 'template' => 'SMS_123456', // 模板ID + 'data' => [ + "template_param" => ["code" => 1234], // 模板变量参数 + "sign_name" => "yoursignname", // 签名,覆盖配置文件中的sign_name + "sms_account" => "yoursmsaccount", // 消息组帐号,覆盖配置文件中的sms_account + "phone_numbers" => "18888888888,18888888889", // 手机号,批量发送,英文的逗号连接多个手机号,覆盖发送方法中的填入的手机号 + ], +]); +``` + +## :heart: 支持我 + +[](https://github.com/sponsors/overtrue) + +如果你喜欢我的项目并想支持它,[点击这里 :heart:](https://github.com/sponsors/overtrue) + +## Project supported by JetBrains + +Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects. + +[](https://www.jetbrains.com/?from=https://github.com/overtrue) + + +## PHP 扩展包开发 + +> 想知道如何从零开始构建 PHP 扩展包? +> +> 请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package) + +## License + +MIT diff --git a/vendor/overtrue/easy-sms/composer.json b/vendor/overtrue/easy-sms/composer.json new file mode 100644 index 000000000..716c51636 --- /dev/null +++ b/vendor/overtrue/easy-sms/composer.json @@ -0,0 +1,62 @@ +{ + "name": "overtrue/easy-sms", + "description": "The easiest way to send short message.", + "type": "library", + "require": { + "guzzlehttp/guzzle": "^6.2 || ^7.0", + "php": ">=5.6", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^7.5 || ^8.5.19 || ^9.5.8", + "mockery/mockery": "~1.3.3 || ^1.4.2", + "brainmaestro/composer-git-hooks": "^2.8", + "jetbrains/phpstorm-attributes": "^1.0" + }, + "autoload": { + "psr-4": { + "Overtrue\\EasySms\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Overtrue\\EasySms\\Tests\\": "tests" + } + }, + "license": "MIT", + "authors": [{ + "name": "overtrue", + "email": "i@overtrue.me" + }], + "extra": { + "hooks": { + "pre-commit": [ + "composer check-style", + "composer psalm", + "composer test" + ], + "pre-push": [ + "composer check-style" + ] + } + }, + "scripts": { + "post-update-cmd": [ + "cghooks remove", + "cghooks add --ignore-lock", + "cghooks update" + ], + "post-merge": "composer install", + "post-install-cmd": [ + "cghooks remove", + "cghooks add --ignore-lock", + "cghooks update" + ], + "phpstan": "phpstan analyse", + "check-style": "php-cs-fixer fix --using-cache=no --diff --config=.php-cs-fixer.dist.php --dry-run --allow-risky=yes --ansi", + "fix-style": "php-cs-fixer fix --using-cache=no --config=.php-cs-fixer.dist.php --allow-risky=yes --ansi", + "test": "phpunit --colors", + "psalm": "psalm --show-info=true --no-cache", + "psalm-fix": "psalm --no-cache --alter --issues=MissingReturnType,MissingParamType" + } +} diff --git a/vendor/overtrue/easy-sms/psalm.xml b/vendor/overtrue/easy-sms/psalm.xml new file mode 100644 index 000000000..f8edfd3ae --- /dev/null +++ b/vendor/overtrue/easy-sms/psalm.xml @@ -0,0 +1,15 @@ + ++ * An offset to check for. + *
+ * + * @return bool true on success or false on failure. + * + *+ * The return value will be casted to boolean if non-boolean was returned + * + * @since 5.0.0 + */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return array_key_exists($offset, $this->config); + } + + /** + * Offset to retrieve. + * + * @see http://php.net/manual/en/arrayaccess.offsetget.php + * + * @param mixed $offset
+ * The offset to retrieve. + *
+ * + * @return mixed Can return all value types + * + * @since 5.0.0 + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->get($offset); + } + + /** + * Offset to set. + * + * @see http://php.net/manual/en/arrayaccess.offsetset.php + * + * @param mixed $offset+ * The offset to assign the value to. + *
+ * @param mixed $value+ * The value to set. + *
+ * + * @since 5.0.0 + */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (isset($this->config[$offset])) { + $this->config[$offset] = $value; + } + } + + /** + * Offset to unset. + * + * @see http://php.net/manual/en/arrayaccess.offsetunset.php + * + * @param mixed $offset+ * The offset to unset. + *
+ * + * @since 5.0.0 + */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + if (isset($this->config[$offset])) { + unset($this->config[$offset]); + } + } +} diff --git a/vendor/overtrue/easy-sms/src/Traits/HasHttpRequest.php b/vendor/overtrue/easy-sms/src/Traits/HasHttpRequest.php new file mode 100644 index 000000000..d861dedfc --- /dev/null +++ b/vendor/overtrue/easy-sms/src/Traits/HasHttpRequest.php @@ -0,0 +1,136 @@ + + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace Overtrue\EasySms\Traits; + +use GuzzleHttp\Client; +use Psr\Http\Message\ResponseInterface; + +/** + * Trait HasHttpRequest. + */ +trait HasHttpRequest +{ + /** + * Make a get request. + * + * @param string $endpoint + * @param array $query + * @param array $headers + * + * @return ResponseInterface|array|string + */ + protected function get($endpoint, $query = [], $headers = []) + { + return $this->request('get', $endpoint, [ + 'headers' => $headers, + 'query' => $query, + ]); + } + + /** + * Make a post request. + * + * @param string $endpoint + * @param array $params + * @param array $headers + * + * @return ResponseInterface|array|string + */ + protected function post($endpoint, $params = [], $headers = []) + { + return $this->request('post', $endpoint, [ + 'headers' => $headers, + 'form_params' => $params, + ]); + } + + /** + * Make a post request with json params. + * + * @param $endpoint + * @param array $params + * @param array $headers + * + * @return ResponseInterface|array|string + */ + protected function postJson($endpoint, $params = [], $headers = []) + { + return $this->request('post', $endpoint, [ + 'headers' => $headers, + 'json' => $params, + ]); + } + + /** + * Make a http request. + * + * @param string $method + * @param string $endpoint + * @param array $options http://docs.guzzlephp.org/en/latest/request-options.html + * + * @return ResponseInterface|array|string + */ + protected function request($method, $endpoint, $options = []) + { + return $this->unwrapResponse($this->getHttpClient($this->getBaseOptions())->{$method}($endpoint, $options)); + } + + /** + * Return base Guzzle options. + * + * @return array + */ + protected function getBaseOptions() + { + $options = method_exists($this, 'getGuzzleOptions') ? $this->getGuzzleOptions() : []; + + return \array_merge($options, [ + 'base_uri' => method_exists($this, 'getBaseUri') ? $this->getBaseUri() : '', + 'timeout' => method_exists($this, 'getTimeout') ? $this->getTimeout() : 5.0, + ]); + } + + /** + * Return http client. + * + * @param array $options + * + * @return \GuzzleHttp\Client + * + * @codeCoverageIgnore + */ + protected function getHttpClient(array $options = []) + { + return new Client($options); + } + + /** + * Convert response contents to json. + * + * @param \Psr\Http\Message\ResponseInterface $response + * + * @return ResponseInterface|array|string + */ + protected function unwrapResponse(ResponseInterface $response) + { + $contentType = $response->getHeaderLine('Content-Type'); + $contents = $response->getBody()->getContents(); + + if (false !== stripos($contentType, 'json') || stripos($contentType, 'javascript')) { + return json_decode($contents, true); + } elseif (false !== stripos($contentType, 'xml')) { + return json_decode(json_encode(simplexml_load_string($contents)), true); + } + + return $contents; + } +} From 545e01e75a33a2036d350996845f8223e1bc5874 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 10:49:53 +0800 Subject: [PATCH 033/145] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E6=AC=BE=E6=94=AF=E4=BB=98=E6=96=B9=E5=BC=8F=E5=92=8C=E9=A2=84?= =?UTF-8?q?=E7=95=99=E7=94=A8=E6=88=B7=E5=88=86=E4=BA=AB=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/order/OrderController.php | 4 ++ app/api/logic/order/OrderLogic.php | 3 ++ app/common/enum/OrderEnum.php | 3 ++ app/common/enum/PayEnum.php | 3 +- app/common/logic/PayNotifyLogic.php | 37 ++++++++++++++++++- .../model/user_spread_log/UserSpreadLog.php | 22 +++++++++++ .../store_order/StoreOrderController.php | 4 ++ 7 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 app/common/model/user_spread_log/UserSpreadLog.php diff --git a/app/api/controller/order/OrderController.php b/app/api/controller/order/OrderController.php index c8a6a62c3..a436e98f1 100644 --- a/app/api/controller/order/OrderController.php +++ b/app/api/controller/order/OrderController.php @@ -188,6 +188,10 @@ class OrderController extends BaseApiController } if ($order != false) { switch ($pay_type) { + case PayEnum::PURCHASE_FUNDS: + //采购款支付 + PayNotifyLogic::handle('purchase_funds', $order['order_id']); + return $this->success('采购款支付成功'); case PayEnum::BALANCE_PAY: //余额支付 PayNotifyLogic::handle('balancePay', $order['order_id']); diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 895a42e05..1f422b03d 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -23,6 +23,7 @@ use app\common\model\system_store\SystemStoreStaff; use app\common\model\user\User; use app\common\model\user\UserAddress; use app\common\model\user\UserShip; +use app\common\model\user_spread_log\UserSpreadLog; use Picqer\Barcode\BarcodeGeneratorJPG; use Picqer\Barcode\BarcodeGeneratorPNG; use support\exception\BusinessException; @@ -160,6 +161,8 @@ class OrderLogic extends BaseLogic $_order = $orderInfo['order']; $_order['uid'] = request()->userId; $user = User::where('id', \request()->userId)->find(); + $_order['is_vip'] = $user['user_ship']; + $_order['spread_uid'] = UserSpreadLog::where('uid',request()->userId)->value('old_spread_uid')??0;//预留分享关系 $_order['real_name'] = $user['real_name']; $_order['mobile'] = $user['mobile']; $_order['pay_type'] = $orderInfo['order']['pay_type']; diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index 215162939..e8312c829 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -24,6 +24,7 @@ class OrderEnum * @SYSTEM_SET 系统设置 * @OWN_GET 平台收入 * @ORDER_MARGIN 商户保证金 + * @PURCHASE_FUNDS 采购款收银 */ const USER_ORDER_PAY = 1; const MERCHANT_ORDER_OBTAINS = 2; @@ -44,6 +45,8 @@ class OrderEnum const CASHIER_FACE_PAY = 17;//现金收银 + const PURCHASE_FUNDS = 18;//采购款收银 + /** * 收入支出类型 diff --git a/app/common/enum/PayEnum.php b/app/common/enum/PayEnum.php index 8065e8fac..99786c428 100644 --- a/app/common/enum/PayEnum.php +++ b/app/common/enum/PayEnum.php @@ -31,6 +31,7 @@ class PayEnum * @GOODS_FIRST_PAYMENT_LATER 先货后款 * @CORPORATE_TRANSFER 对公转账 * @CASH_PAY 现金支付 + * @PURCHASE_FUNDS 采购款收银 */ const BALANCE_PAY = 3; const WECHAT_PAY = 1; @@ -49,7 +50,7 @@ class PayEnum const GOODS_FIRST_PAYMENT_LATER = 15; const CORPORATE_TRANSFER = 16; const CASH_PAY = 17; - + const PURCHASE_FUNDS = 18;//采购款收银 //支付状态 const UNPAID = 0; //未支付 const ISPAID = 1; //已支付 diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 6bb5f81ec..82e4e1c33 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -32,7 +32,7 @@ class PayNotifyLogic extends BaseLogic { Db::startTrans(); try { - if ($action != 'cash_pay' && $action != 'balancePay') { + if ($action != 'cash_pay' && $action != 'balancePay'&& $action != 'purchase_funds') { $payNotifyLogLogic = new PayNotifyLogLogic(); if ($action == 'refund') { $payNotifyLogLogic->insert($action, $extra, PayNotifyLog::TYPE_REFUND); @@ -83,6 +83,41 @@ class PayNotifyLogic extends BaseLogic PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } + + /** + * 采购款支付 + * @param $orderSn + * @param $extra + * @return void + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public static function purchase_funds($orderSn, $extra = []) + { + $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); + $user = User::where('id', $order['uid'])->find(); + if ($user['purchase_funds'] < $order['pay_price']) { + throw new \Exception('采购款不足'); + } + $order->money = $order['pay_price']; + $order->paid = 1; + $order->pay_time = time(); + if (!$order->save()) { + throw new \Exception('订单保存出错'); + } + // 减去采购款 + $user->purchase_funds = bcsub($user['purchase_funds'], $order['pay_price'], 2); + $user->save(); + + $capitalFlowDao = new CapitalFlowLogic($user); + $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']); + self::afterPay($order); + Redis::send('push-platform-print', ['id' => $order['id']], 60); + PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); + + } + /** * @notes 微信通用回调 * @param $orderSn diff --git a/app/common/model/user_spread_log/UserSpreadLog.php b/app/common/model/user_spread_log/UserSpreadLog.php new file mode 100644 index 000000000..6ac54de19 --- /dev/null +++ b/app/common/model/user_spread_log/UserSpreadLog.php @@ -0,0 +1,22 @@ +success('采购款支付成功'); case PayEnum::CASH_PAY: //现金支付 From 48a66a5328d43504ef01cd9a221f9e42b9f6ebe8 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 11:00:20 +0800 Subject: [PATCH 034/145] =?UTF-8?q?feat(UserLists):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0ListsSear?= =?UTF-8?q?chInterface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/user/UserLists.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php index 1d4563950..35cc57608 100644 --- a/app/store/lists/user/UserLists.php +++ b/app/store/lists/user/UserLists.php @@ -7,8 +7,9 @@ namespace app\store\lists\user; use app\store\lists\BaseAdminDataLists; use app\common\model\user\User; use app\common\model\user\UserShip; +use app\common\lists\ListsSearchInterface; -class UserLists extends BaseAdminDataLists +class UserLists extends BaseAdminDataLists implements ListsSearchInterface { /** * @notes 搜索条件 @@ -19,7 +20,8 @@ class UserLists extends BaseAdminDataLists public function setSearch(): array { return [ - '=' => ['mobile'], + '=' => ['id'], + '%like%' => ['mobile'], ]; } From aa2c1463002812d0afea0c25a0cf17508e141ce6 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 11:07:02 +0800 Subject: [PATCH 035/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E6=AC=BE=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/order/OrderController.php | 7 ++++--- app/common/logic/PayNotifyLogic.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/api/controller/order/OrderController.php b/app/api/controller/order/OrderController.php index a436e98f1..0d6e336ff 100644 --- a/app/api/controller/order/OrderController.php +++ b/app/api/controller/order/OrderController.php @@ -183,10 +183,11 @@ class OrderController extends BaseApiController $user=User::where('id',$this->userId)->find(); $order = OrderLogic::createOrder($cartId, $addressId, $user, $params); - if($order['pay_price'] <= 0){ - $pay_type = 3; - } + if ($order != false) { + if($order['pay_price'] <= 0){ + $pay_type = 3; + } switch ($pay_type) { case PayEnum::PURCHASE_FUNDS: //采购款支付 diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 82e4e1c33..e8eefc5cf 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -111,7 +111,7 @@ class PayNotifyLogic extends BaseLogic $user->save(); $capitalFlowDao = new CapitalFlowLogic($user); - $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']); + $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']); self::afterPay($order); Redis::send('push-platform-print', ['id' => $order['id']], 60); PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); From 97a7a830c34b19da47eeefa675b3e33f0969cd6b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 11:13:52 +0800 Subject: [PATCH 036/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=9C=B0?= =?UTF-8?q?=E5=9D=80API=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/AddressLogic.php | 12 +++-- app/api/validate/UserAddressValidate.php | 2 +- .../controller/user/AddressController.php | 49 +++++++++++++++++++ 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 app/store/controller/user/AddressController.php diff --git a/app/api/logic/user/AddressLogic.php b/app/api/logic/user/AddressLogic.php index 068aa6f0d..097204ab5 100644 --- a/app/api/logic/user/AddressLogic.php +++ b/app/api/logic/user/AddressLogic.php @@ -67,8 +67,14 @@ class AddressLogic extends BaseLogic 'phone' => $params['phone'], 'detail' => $params['detail'], 'is_default' => $params['is_default'], + 'province' => $params['province'], + 'city' => $params['city'], + 'area' => $params['area'], + 'street' => $params['street'], + 'village' => $params['village'], + 'brigade' => $params['brigade'], ]; - UserAddress::where('uid', $params['uid'])->where('id', $params['address_id'])->update($data); + UserAddress::where('uid', $params['uid'])->where('id', $params['id'])->update($data); Db::commit(); return true; } catch (\Exception $e) { @@ -93,7 +99,7 @@ class AddressLogic extends BaseLogic /** - * @notes 获取购物车表详情 + * @notes 获取地址详情 * @param $params * @return array * @author likeadmin @@ -101,6 +107,6 @@ class AddressLogic extends BaseLogic */ public static function detail($params): array { - return UserAddress::field('id address_id,real_name,phone,detail,is_default')->where('id',$params['address_id'])->findOrEmpty()->toArray(); + return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where($params)->findOrEmpty()->toArray(); } } diff --git a/app/api/validate/UserAddressValidate.php b/app/api/validate/UserAddressValidate.php index 30a1360b6..2b0300e0f 100644 --- a/app/api/validate/UserAddressValidate.php +++ b/app/api/validate/UserAddressValidate.php @@ -63,7 +63,7 @@ class UserAddressValidate extends BaseValidate */ public function sceneEdit() { - return $this->only(['real_name','phone','detail','address_id']); + return $this->only(['real_name','phone','detail','id']); } diff --git a/app/store/controller/user/AddressController.php b/app/store/controller/user/AddressController.php new file mode 100644 index 000000000..7406b81cc --- /dev/null +++ b/app/store/controller/user/AddressController.php @@ -0,0 +1,49 @@ +dataLists(new UserAddressList()); + } + /** + * @notes 编辑地址 + * @return \support\Response + * @author likeadmin + * @date 2024/4/24 10:37 + */ + public function edit() + { + $params = (new UserAddressValidate())->post()->goCheck('edit'); + if(AddressLogic::edit($params)){ + return $this->success('编辑成功'); + }else{ + return $this->fail(AddressLogic::getError()); + } + } + /** + * @notes 获取地址详情 + * @return \support\Response + * @author likeadmin + * @date 2024/4/24 10:37 + */ + public function detail() + { + $id = $this->request->get('id'); + $uid = $this->request->get('uid'); + if($id){ + $params = ['id' => $id]; + } + if($uid){ + $params = ['uid' => $uid]; + } + return $this->success('获取成功',AddressLogic::detail($params)); + } +} From 5e5cc45490957b6d8193189025e0f07fdd604a92 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 11:36:34 +0800 Subject: [PATCH 037/145] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9A=84=E5=88=9B=E5=BB=BA=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 1f422b03d..4e4177fe6 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -71,7 +71,7 @@ class OrderLogic extends BaseLogic /** 计算价格 */ foreach ($cart_select as $k => $v) { - $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,product_id')->find(); + $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,product_id')->withTrashed()->find(); if (!$find) { continue; } @@ -200,7 +200,7 @@ class OrderLogic extends BaseLogic $goods_list[$k]['uid'] = request()->userId; $goods_list[$k]['cart_id'] = implode(',', $cartId); $goods_list[$k]['delivery_id'] = $params['store_id']; //商家id - $StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->find(); + $StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->withTrashed()->find(); $updateData[] = [ 'id' => $v['branch_product_id'], 'stock' => $StoreBranchProduct['stock']-$v['cart_num'], From 1109eb92f1e2a4084ad4cbde11d5d4c39eae1ab3 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 11:42:54 +0800 Subject: [PATCH 038/145] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=A0=E9=99=A4=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/CartList.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index d68559b77..ca28189b1 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -63,7 +63,8 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists foreach ($list as $key => &$item) { $find = StoreBranchProduct::where(['product_id' => $item['product_id'],'store_id' => $item['store_id']]) - ->field('product_id,image,price,cost,store_name,unit') + ->field('product_id,image,price,cost,store_name,unit,delete_time') + ->withTrashed() ->find(); // if (isset($check) && $check['status'] == 1) { // $find['price'] = $find['cost']; From e2c471c030cb121d8381c5901245f55b5d2c090a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 13:44:32 +0800 Subject: [PATCH 039/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=BB=E8=BE=91=E5=A2=9E=E5=8A=A0=E5=85=85=E5=80=BC?= =?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/logic/user/UserLogic.php | 1 + app/common/logic/PayNotifyLogic.php | 100 +++++++----------- app/queue/redis/CodePaySend.php | 6 +- .../store_order/StoreOrderController.php | 53 +++++++++- .../controller/user/AddressController.php | 6 +- app/store/controller/user/UserController.php | 1 - 6 files changed, 99 insertions(+), 68 deletions(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index a88acd7fc..6ec63f14e 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -17,6 +17,7 @@ use app\common\enum\user\UserTerminalEnum; use app\common\logic\BaseLogic; use app\common\model\user\User; use app\common\model\user\UserAddress; +use app\common\model\user\UserRecharge; use think\facade\Db; use app\common\service\FileService; use Webman\Config; diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index e8eefc5cf..617e9ea43 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -28,11 +28,11 @@ use Webman\RedisQueue\Redis; class PayNotifyLogic extends BaseLogic { - public static function handle($action, $orderSn, $extra = []) + public static function handle($action, $orderSn, $extra = [], $type = 'wechat') { Db::startTrans(); try { - if ($action != 'cash_pay' && $action != 'balancePay'&& $action != 'purchase_funds') { + if ($action != 'cash_pay' && $action != 'balancePay' && $action != 'purchase_funds') { $payNotifyLogLogic = new PayNotifyLogLogic(); if ($action == 'refund') { $payNotifyLogLogic->insert($action, $extra, PayNotifyLog::TYPE_REFUND); @@ -40,7 +40,7 @@ class PayNotifyLogic extends BaseLogic $payNotifyLogLogic->insert($action, $extra); } } - self::$action($orderSn, $extra); + self::$action($orderSn, $extra, $type); Db::commit(); return true; } catch (\Exception $e) { @@ -115,7 +115,6 @@ class PayNotifyLogic extends BaseLogic 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' => '您有一笔新的订单']); - } /** @@ -150,11 +149,6 @@ class PayNotifyLogic extends BaseLogic } self::afterPay($order, $extra['transaction_id']); - //活动期间消费 - $check = DictType::where('type', 'activities')->find(); - if (isset($check) && $check['status'] == 1 && in_array($order->pay_type, [9, 17]) == false && $user['user_ship'] == 0) { - self::dealChange($order['uid']); - } if ($order->pay_type == 9) { $extra['create_time'] = $order['create_time']; @@ -191,13 +185,17 @@ class PayNotifyLogic extends BaseLogic /** * 充值 */ - public static function recharge($orderSn, $extra = []) + public static function recharge($orderSn, $extra = [], $type = 'wechat') { $order = UserRecharge::where('order_id', $orderSn)->findOrEmpty(); if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) { return true; } - $price = bcdiv($extra['amount']['payer_total'], 100, 2); + 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(); @@ -212,13 +210,16 @@ class PayNotifyLogic extends BaseLogic return true; } bcscale(2); -// $user->now_money = bcadd($user->now_money, $price, 2);//v.1 + // $user->now_money = bcadd($user->now_money, $price, 2);//v.1 + //更新等级 + if ($price >= 1000) { + $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(); - //更新等级 - self::dealLevel($uid, $user->total_recharge_amount); + if (!empty($extra['payer']['openid'])) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 3], 5); } @@ -296,13 +297,13 @@ class PayNotifyLogic extends BaseLogic $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); //用户订单支付 - $count_frees=0; + $count_frees = 0; //商户应该获得的钱 每个商品的price-ot_price 利润 // if (isset($order->profit) && $order->profit > 0) { //平台手续费 $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); - $count_frees=bcadd($count_frees,$fees,2); + $count_frees = bcadd($count_frees, $fees, 2); $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0, $order['pay_type']); //平台手续费 $financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出 @@ -312,7 +313,7 @@ class PayNotifyLogic extends BaseLogic $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); + $count_frees = bcadd($count_frees, $store_profit, 2); if ($deposit > 0) { if ($deposit > $store_profit) { $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); @@ -328,78 +329,53 @@ class PayNotifyLogic extends BaseLogic if ($order['spread_uid'] > 0) { $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); - $count_frees=bcadd($count_frees,$fees,2); + $count_frees = bcadd($count_frees, $fees, 2); $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 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; + $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){ - $village_uid=User::where('id','in',$arr1)->where('user_ship',2)->value('id'); + 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) { + $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); } - $arr2=UserAddress::where(['village'=>$address['village'],'brigade'=>$address['brigade'],'is_default'=>1])->column('uid'); - if($arr2){ - $brigade_uid=User::where('id','in',$arr1)->where('user_ship',3)->value('id'); + $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); + if ($arr2) { + $brigade_uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); } } } //村长获得 - if($village_uid>0){ + if ($village_uid > 0) { $financeLogic->other_arr['vip_uid'] = $village_uid; } - $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); + $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 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){ + if ($brigade_uid > 0) { $financeLogic->other_arr['vip_uid'] = $brigade_uid; } - $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); + $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //其他获得 - $financeLogic->other_arr['vip_uid']=0; - $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); + $financeLogic->other_arr['vip_uid'] = 0; + $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); } //供应链订单获得 - $financeLogic->in($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); + $financeLogic->in($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); // } $financeLogic->save(); // } } - //等级处理 - public static function dealLevel($uid, $total_money) - { - $userShip = UserShip::where('limit', '<=', $total_money) - ->field('id,title,limit') - ->order('limit', 'desc') - ->find(); - $info = User::where('id', $uid)->findOrEmpty(); - if ($info && $userShip) { - if ($info->user_ship != $userShip['id']) { - $info->user_ship = $userShip['id']; - $info->save(); - } - } - return true; - } - - //处理活动期间直接改用户的等级 - public static function dealChange($uid) - { - User::where('id', $uid)->update(['user_ship' => UserShipEnum::LEVEL_ONE]); - return true; - } - - /** * 回调日志 * @param $order diff --git a/app/queue/redis/CodePaySend.php b/app/queue/redis/CodePaySend.php index c3b33c55b..d944b9eec 100644 --- a/app/queue/redis/CodePaySend.php +++ b/app/queue/redis/CodePaySend.php @@ -30,7 +30,11 @@ class CodePaySend implements Consumer ]; $res = $pay->wechat->query($order); if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') { - PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res); + if(isset($data['pay_type']) && $data['pay_type']=='recharge'){ + PayNotifyLogic::handle('recharge', $res['out_trade_no'], $res); + }else{ + PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res); + } }else{ throw new BusinessException('订单支付中', 200); } diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 02af03752..47147921c 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -13,6 +13,7 @@ use app\common\logic\SystemStoreStaffLogic; use app\store\controller\BaseAdminController; use app\common\logic\store_order\StoreOrderLogic; use app\common\model\store_order\StoreOrder; +use app\common\model\user_recharge\UserRecharge; use app\store\validate\store_order\StoreOrderValidate; use support\Log; use Webman\RedisQueue\Redis; @@ -290,6 +291,56 @@ class StoreOrderController extends BaseAdminController return $this->success('ok',$data); } - + /** + * vip充值 + */ + public function rechange_amount() + { + $pay_type = $this->request->post('pay_type'); + $auth_code = $this->request->post('auth_code'); //微信支付条码 + if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { + return $this->fail('支付条码不能为空'); + } + $params = $this->request->post(); + $data=[ + 'store_id'=>$this->adminInfo['store_id'], + 'uid'=>$params['uid'], + 'staff_id'=>$this->adminId, + 'order_id'=>getNewOrderId('CZ'), + 'price'=>$params['price'], + ]; + $order = UserRecharge::create($data); + switch ($pay_type) { + case PayEnum::WECHAT_PAY_BARCODE: + //微信条码支付 + $result = PaymentLogic::codepay($auth_code, $order); + if (PaymentLogic::hasError()) { + return $this->fail(PaymentLogic::getError(), $params); + } + if (isset($result['trade_state_desc']) && $result['trade_state_desc'] == '支付成功') { + PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result); + } else { + Redis::send('send-code-pay', ['order_id' => $order['order_id'],'pay_type'=>'recharge']); + return $this->success('用户支付中'); + } + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); + case PayEnum::ALIPAY_BARCODE: + //支付宝条码支付 + $result = PaymentLogic::ali_auth_code($auth_code, $order); + if (PaymentLogic::hasError()) { + return $this->fail(PaymentLogic::getError(), $params); + } + if ($result['msg'] !== 'Success') { + return $this->success('用户支付中'); + } + PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result,'ali'); + + $result['create_time'] = $order['create_time']; + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no']]); + default: + return $this->fail('支付方式错误'); + } + return $this->fail('支付失败'); + } } diff --git a/app/store/controller/user/AddressController.php b/app/store/controller/user/AddressController.php index 7406b81cc..b3a74cf8b 100644 --- a/app/store/controller/user/AddressController.php +++ b/app/store/controller/user/AddressController.php @@ -1,14 +1,14 @@ dataLists(new UserAddressList()); diff --git a/app/store/controller/user/UserController.php b/app/store/controller/user/UserController.php index 4a6083856..35b8737e5 100644 --- a/app/store/controller/user/UserController.php +++ b/app/store/controller/user/UserController.php @@ -30,7 +30,6 @@ class UserController extends BaseAdminController } - public function detail() { $params = (new UserValidate())->goCheck('detail'); From 94d89f86dc81cf3e46d641fafe3d637037f05c7a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 14:15:05 +0800 Subject: [PATCH 040/145] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=20UserAddres?= =?UTF-8?q?sValidate=20=E7=B1=BB=E4=B8=AD=E7=9A=84=20detail=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/validate/UserAddressValidate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/validate/UserAddressValidate.php b/app/api/validate/UserAddressValidate.php index 2b0300e0f..b7911da0e 100644 --- a/app/api/validate/UserAddressValidate.php +++ b/app/api/validate/UserAddressValidate.php @@ -63,7 +63,7 @@ class UserAddressValidate extends BaseValidate */ public function sceneEdit() { - return $this->only(['real_name','phone','detail','id']); + return $this->only(['real_name','phone','id']); } From bc867d736250c1655d5c0ebf48072d20e5e86578 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 14:30:23 +0800 Subject: [PATCH 041/145] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E4=B8=B4=E6=97=B6=E5=A4=84=E7=90=86?= 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 8143a4182..2e1ba315c 100644 --- a/app/api/controller/LoginController.php +++ b/app/api/controller/LoginController.php @@ -18,7 +18,7 @@ class LoginController extends BaseApiController public function account() { $params=$this->request->post(); - $params = (new LoginAccountValidate())->post()->goCheck(); +// $params = (new LoginAccountValidate())->post()->goCheck(); $result = LoginLogic::login($params); if (false === $result) { return $this->fail(LoginLogic::getError()); From b756c07191e6898f17c87d79881b2db9d44db01b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 15:07:59 +0800 Subject: [PATCH 042/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BD=99=E9=A2=9D=E5=AD=97=E6=AE=B5=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=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 | 2 -- app/admin/validate/user/UserValidate.php | 4 +--- app/common/logic/PayNotifyLogic.php | 18 +++++++++--------- app/common/logic/StoreFinanceFlowLogic.php | 2 +- .../logic/store_order/StoreOrderLogic.php | 5 +++-- .../store_order/StoreOrderController.php | 1 + app/store/lists/user/UserLists.php | 2 +- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index 6ec63f14e..167aa3c9f 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -54,7 +54,6 @@ class UserLogic extends BaseLogic 'mobile' => $params['mobile'], 'sex' => $params['sex'], 'is_disable' => $params['is_disable'], - 'user_money' => $params['user_money'] ]); Db::commit(); @@ -127,7 +126,6 @@ class UserLogic extends BaseLogic 'mobile' => $params['mobile'] ?? '', 'sex' => $params['sex'] ?? 0, 'is_disable' => $params['is_disable'] ?? 0, - 'user_money' => $params['user_money'] ?? 0 ]); Db::commit(); diff --git a/app/admin/validate/user/UserValidate.php b/app/admin/validate/user/UserValidate.php index 8729791c5..ef36fbb7f 100644 --- a/app/admin/validate/user/UserValidate.php +++ b/app/admin/validate/user/UserValidate.php @@ -27,7 +27,6 @@ class UserValidate extends BaseValidate 'mobile' => 'require|mobile', 'is_disable' => 'in:0,1', 'sex' => 'in:1,2', - 'user_money' => 'float', 'province' => 'require', 'city' => 'require', 'area' => 'require', @@ -51,7 +50,6 @@ class UserValidate extends BaseValidate 'mobile' => '用户电话', 'is_disable' => '是否禁用', 'sex' => '用户性别', - 'user_money' => '用户余额', 'province' => '省', 'city' => '市', 'area' => '区', @@ -86,7 +84,7 @@ class UserValidate extends BaseValidate */ public function sceneEdit() { - return $this->only(['id','avatar','real_name','nickname','account','password','mobile','is_disable','sex','user_money'])->remove('password','require'); + return $this->only(['id','avatar','real_name','nickname','account','password','mobile','is_disable','sex'])->remove('password','require'); } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 617e9ea43..8d595beba 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -304,7 +304,7 @@ class PayNotifyLogic extends BaseLogic //平台手续费 $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); $count_frees = bcadd($count_frees, $fees, 2); - $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0, $order['pay_type']); //平台手续费 + $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']); //商户平台手续费支出 //冻结金额的 @@ -320,17 +320,17 @@ class PayNotifyLogic extends BaseLogic } else { $money = bcsub($store_profit, $deposit, 2); $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //平台手续费 + $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']); //平台手续费 } } else { - $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //平台手续费 + $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['is_vip'] >=1) { if ($order['spread_uid'] > 0) { $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); $count_frees = bcadd($count_frees, $fees, 2); - $financeLogic->in($transaction_id, $fees, OrderEnum::VIP_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); //vip订单获得 + $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); @@ -355,21 +355,21 @@ class PayNotifyLogic extends BaseLogic if ($village_uid > 0) { $financeLogic->other_arr['vip_uid'] = $village_uid; } - $financeLogic->in($transaction_id, $fees, OrderEnum::VILLAGE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); + $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) { $financeLogic->other_arr['vip_uid'] = $brigade_uid; } - $financeLogic->in($transaction_id, $fees, OrderEnum::BRIGADE_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); + $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']); //其他获得 $financeLogic->other_arr['vip_uid'] = 0; - $financeLogic->in($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); + $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']); } //供应链订单获得 - $financeLogic->in($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, $order['pay_type']); + $financeLogic->in($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); $financeLogic->out($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); // } $financeLogic->save(); diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php index c2ad88d52..ac7d66070 100644 --- a/app/common/logic/StoreFinanceFlowLogic.php +++ b/app/common/logic/StoreFinanceFlowLogic.php @@ -59,7 +59,7 @@ class StoreFinanceFlowLogic extends BaseLogic 'financial_pm' => $pm, 'number' => $number, 'pay_type' => $pay_type, - 'status' => $status, + 'status' => 0, 'store_id' => $storeId !== '' ? $storeId : $this->order['store_id'], 'staff_id' => $staffId !== '' ? $staffId : $this->order['staff_id'], 'financial_record_sn' => $this->financeSn . ($this->index++), diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index db652b03e..c80890eb7 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -115,8 +115,10 @@ class StoreOrderLogic extends BaseLogic 'default_delivery'=>1, 'original_price'=>self::$total_price, 'deduction_price' => self::$activity_price - ]; + if($user['user_ship']!=4){ + $order['is_vip']=1; + } } catch (\Exception $e) { self::setError($e->getMessage()); return false; @@ -140,7 +142,6 @@ class StoreOrderLogic extends BaseLogic return false; } $_order = $orderInfo['order']; - $_order['deduction_price'] = 0; $_order['pay_type'] = $orderInfo['order']['pay_type']; $_order['verify_code'] = $verify_code; if (isset($params['reservation_time'])) { diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 47147921c..3ba2bc34e 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -310,6 +310,7 @@ class StoreOrderController extends BaseAdminController 'price'=>$params['price'], ]; $order = UserRecharge::create($data); + $order['pay_price']=$order['price']; switch ($pay_type) { case PayEnum::WECHAT_PAY_BARCODE: //微信条码支付 diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php index 35cc57608..7f7bc24fe 100644 --- a/app/store/lists/user/UserLists.php +++ b/app/store/lists/user/UserLists.php @@ -37,7 +37,7 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface public function lists(): array { - $field = "id,nickname,real_name,sex,avatar,account,mobile,user_money,user_ship,create_time"; + $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time"; $lists = User::where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->field($field) From 8e82e40379885f1b4aff2a17e3d99b40ae9c086d Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 15:35:03 +0800 Subject: [PATCH 043/145] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=AA=8C=E8=AF=81=E7=A0=81=E9=80=BB=E8=BE=91=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/store_order/StoreOrderLogic.php | 24 +++++++++++++ app/common/service/SmsService.php | 7 +++- app/functions.php | 14 ++++++++ app/store/controller/cart/CartController.php | 2 +- .../store_order/StoreOrderController.php | 34 +++++++++++++++++++ .../store_order/StoreOrderValidate.php | 5 +++ 6 files changed, 84 insertions(+), 2 deletions(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index c80890eb7..255298eec 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -12,7 +12,9 @@ use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_order\StoreOrder; use app\common\model\store_order_cart_info\StoreOrderCartInfo; use app\common\model\store_product_unit\StoreProductUnit; +use app\common\model\user\User; use app\common\service\pay\PayService; +use app\common\service\SmsService; use Exception; use support\Cache; use think\facade\Db; @@ -308,4 +310,26 @@ class StoreOrderLogic extends BaseLogic } + + public function dealSendSms($param) + { + $code = generateRandomCode(); + $phone = User::where('id',$param['uid'])->value('mobile'); + if(empty($phone)){ + throw new \Exception('用户未设置手机号'); + } + $template = getenv('SMS_TEMPLATE'); + + $check =(new SmsService())->client($phone,$template,$code); + if($check){ + $remark = $param['uid'].'_smsPay'; + Cache::set($remark,$code,5*60); + return true; + }else{ + return false; + } + + } + + } diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index 43566a1cc..d1270b1a9 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -50,13 +50,18 @@ class SmsService try{ $easySms = new EasySms($this->config); - $easySms->send($phone, [ + $res = $easySms->send($phone, [ 'content' => '您的验证码为: '.$code, 'template' => $template, 'data' => [ 'code' => $code ], ]); + if($res && $res['aliyun']['status'] == 'success'){ + return true; + }else{ + return false; + } }catch(NoGatewayAvailableException $e){ throw new BusinessException($e->getMessage()); } diff --git a/app/functions.php b/app/functions.php index 2328a71b2..0aacbdc0e 100644 --- a/app/functions.php +++ b/app/functions.php @@ -405,6 +405,20 @@ if (!function_exists('haversineDistance')) { } } +/** + * 随机验证码 + */ +if (!function_exists('generateRandomCode')) { + function generateRandomCode($length = 4) { + $code = ''; + for ($i = 0; $i < $length; $i++) { + $code .= random_int(0, 9); + } + return $code; + } +} + + if (!function_exists('reset_index')) { /** * 重置数组索引 diff --git a/app/store/controller/cart/CartController.php b/app/store/controller/cart/CartController.php index e190a385b..1e3ae32f1 100644 --- a/app/store/controller/cart/CartController.php +++ b/app/store/controller/cart/CartController.php @@ -24,7 +24,7 @@ class CartController extends BaseAdminController { $params = (new CartValidate())->post()->goCheck('StoreAdd'); $adminInfo = $this->adminInfo; - $params['uid'] = 0; + $params['uid'] = $this->request->post('uid')??0; $params['staff_id'] = $adminInfo['admin_id']; $params['store_id'] = $adminInfo['store_id']; $result = Cart::where(['uid' => 0,'staff_id'=>$adminInfo['admin_id'], 'store_id' => $adminInfo['store_id'], 'product_id' => $params['product_id'], 'is_fail' => 0, 'is_pay' => 0])->find(); diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 3ba2bc34e..2305ab45c 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -4,6 +4,7 @@ namespace app\store\controller\store_order; use app\api\logic\order\OrderLogic; use app\api\validate\OrderValidate; +use app\common\model\order\Cart; use app\store\lists\store_order\StoreOrderLists; use app\common\controller\Definitions; use app\common\enum\PayEnum; @@ -15,6 +16,7 @@ use app\common\logic\store_order\StoreOrderLogic; use app\common\model\store_order\StoreOrder; use app\common\model\user_recharge\UserRecharge; use app\store\validate\store_order\StoreOrderValidate; +use support\Cache; use support\Log; use Webman\RedisQueue\Redis; @@ -124,11 +126,26 @@ class StoreOrderController extends BaseAdminController return $this->data($res); } + + public function checkSms() + { + $params = (new StoreOrderValidate())->post()->goCheck('check'); + $res = (new StoreOrderLogic())->dealSendSms($params); + if($res){ + return $this->success('发送成功',[],1,1); + }else{ + return $this->fail('发送失败'); + } + + } + + public function createOrder() { $cartId = (array)$this->request->post('cart_id', []); $pay_type = (int)$this->request->post('pay_type'); $addressId = (int)$this->request->post('address_id'); + $sms_code = $this->request->post('sms_code',''); $auth_code = $this->request->post('auth_code'); //微信支付条码 $params = $this->request->post(); if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { @@ -137,6 +154,23 @@ class StoreOrderController extends BaseAdminController if (count($cartId) > 100) { return $this->fail('购物车商品不能超过100个'); } + + if($pay_type == PayEnum::PURCHASE_FUNDS && $sms_code){ + if(empty($cartId)){ + return $this->fail('缺失购物车数据'); + } + $uid = Cart::where('id',$cartId[0])->value('uid'); + $remark = $uid.'_smsPay'; + $code = Cache::get($remark); + if(empty($code)){ + return $this->fail('验证码过期请重新发送'); + } + if ($code !== $sms_code) { + return $this->fail('验证码错误'); + } + + } + $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 $order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params); if ($order != false) { diff --git a/app/store/validate/store_order/StoreOrderValidate.php b/app/store/validate/store_order/StoreOrderValidate.php index f7b4eeb81..3ded2a71d 100644 --- a/app/store/validate/store_order/StoreOrderValidate.php +++ b/app/store/validate/store_order/StoreOrderValidate.php @@ -81,4 +81,9 @@ class StoreOrderValidate extends BaseValidate return $this->only(['id','verify_code']); } + public function sceneCheck() + { + return $this->only(['uid']); + } + } From 341cbe7457fd3e1177d0eb2ac7e738700bb8606c Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 15:54:32 +0800 Subject: [PATCH 044/145] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=95=86=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E8=AE=A2=E5=8D=95=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/store_order/StoreOrderLogic.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 255298eec..9df2d5a1e 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -118,9 +118,12 @@ class StoreOrderLogic extends BaseLogic 'original_price'=>self::$total_price, 'deduction_price' => self::$activity_price ]; - if($user['user_ship']!=4){ - $order['is_vip']=1; + if($user){ + if($user['user_ship']!=4){ + $order['is_vip']=1; + } } + } catch (\Exception $e) { self::setError($e->getMessage()); return false; From 8c1608207ebf0959c651014a7797287ab72ec9f1 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 16:06:28 +0800 Subject: [PATCH 045/145] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8F=91=E9=80=81?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81=E6=A3=80=E9=AA=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E9=87=87=E8=B4=AD=E6=AC=BE=E5=A4=9F=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=90=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/store_order/StoreOrderController.php | 11 +++++++++++ app/store/validate/store_order/StoreOrderValidate.php | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 2305ab45c..01399ff7a 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -5,6 +5,7 @@ namespace app\store\controller\store_order; use app\api\logic\order\OrderLogic; use app\api\validate\OrderValidate; use app\common\model\order\Cart; +use app\common\model\user\User; use app\store\lists\store_order\StoreOrderLists; use app\common\controller\Definitions; use app\common\enum\PayEnum; @@ -130,6 +131,16 @@ class StoreOrderController extends BaseAdminController public function checkSms() { $params = (new StoreOrderValidate())->post()->goCheck('check'); + + $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 + $user= User::where('id',$params['uid'])->find(); + if(empty($user)){ + return $this->fail('无该用户请检查'); + } + $order = StoreOrderLogic::cartIdByOrderInfo($params['cartId'], null, $user, $params); + if($order['order']['pay_price'] > $user['purchase_funds']){ + return $this->fail('当前用户采购款不足支付'); + } $res = (new StoreOrderLogic())->dealSendSms($params); if($res){ return $this->success('发送成功',[],1,1); diff --git a/app/store/validate/store_order/StoreOrderValidate.php b/app/store/validate/store_order/StoreOrderValidate.php index 3ded2a71d..928c46581 100644 --- a/app/store/validate/store_order/StoreOrderValidate.php +++ b/app/store/validate/store_order/StoreOrderValidate.php @@ -21,6 +21,8 @@ class StoreOrderValidate extends BaseValidate protected $rule = [ 'id' => 'requireWithout:verify_code', 'verify_code' => 'requireWithout:id', + 'uid' => 'require|number', + 'cart_id' => 'require|array', ]; @@ -83,7 +85,7 @@ class StoreOrderValidate extends BaseValidate public function sceneCheck() { - return $this->only(['uid']); + return $this->only(['uid','cart_id']); } } From bfbd01fcc1adea437f065b5296d6a92ce28ad488 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 16:07:50 +0800 Subject: [PATCH 046/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BD=99=E9=A2=9D=E5=92=8C=E8=B4=AD=E4=B9=B0=E8=B5=84?= =?UTF-8?q?=E9=87=91=E5=AD=97=E6=AE=B5=EF=BC=8C=E4=BC=98=E5=8C=96=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=EF=BC=8C=E9=99=90?= =?UTF-8?q?=E5=88=B6=E5=85=85=E5=80=BC=E4=BC=9A=E5=91=98=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/user/UserLogic.php | 4 +++- app/common/logic/PayNotifyLogic.php | 2 +- app/store/controller/user/UserController.php | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index 167aa3c9f..49ef54b36 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -15,6 +15,7 @@ namespace app\admin\logic\user; use app\common\enum\user\UserTerminalEnum; use app\common\logic\BaseLogic; +use app\common\model\store_finance_flow\StoreFinanceFlow; use app\common\model\user\User; use app\common\model\user\UserAddress; use app\common\model\user\UserRecharge; @@ -148,7 +149,7 @@ class UserLogic extends BaseLogic { $field = [ 'id', 'account', 'nickname', 'avatar', 'real_name', - 'sex', 'mobile', 'create_time', 'login_time', 'channel' + 'sex', 'mobile', 'create_time', 'login_time', 'channel','now_money','purchase_funds' ]; $user = User::where(['id' => $userId])->field($field) @@ -156,6 +157,7 @@ class UserLogic extends BaseLogic $user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']); $user->sex = $user->getData('sex'); + $user['number']=StoreFinanceFlow::where('other_uid',$userId)->where(['status'=>0,'financial_pm'=>1,'type'=>1])->sum('number'); return $user->toArray(); } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 8d595beba..f542f508d 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -212,7 +212,7 @@ class PayNotifyLogic extends BaseLogic bcscale(2); // $user->now_money = bcadd($user->now_money, $price, 2);//v.1 //更新等级 - if ($price >= 1000) { + if ($price >= 0.01) { $user->user_ship = 1; //v.1 } $user->purchase_funds = bcadd($user->purchase_funds, $price, 2); diff --git a/app/store/controller/user/UserController.php b/app/store/controller/user/UserController.php index 35b8737e5..3ad486640 100644 --- a/app/store/controller/user/UserController.php +++ b/app/store/controller/user/UserController.php @@ -8,7 +8,7 @@ use app\store\controller\BaseAdminController; use app\store\lists\user\UserLists; use app\admin\logic\user\UserLogic; use app\admin\validate\user\UserValidate; - +use app\common\model\user\User; class UserController extends BaseAdminController { @@ -22,7 +22,7 @@ class UserController extends BaseAdminController public function add() { $params = (new UserValidate())->post()->goCheck('storeAdd'); - $result = UserLogic::StoreAdd($params); + UserLogic::StoreAdd($params); if (UserLogic::hasError() ) { return $this->fail(UserLogic::getError()); } @@ -37,4 +37,14 @@ class UserController extends BaseAdminController return $this->success('', $detail); } + public function user_ship(){ + $user_ship=$this->request->post('user_ship',0); + $id=$this->request->post('id',0); + if($user_ship==1){ + return $this->fail('充值会员不能前端设置'); + } + User::where('id',$id)->update(['user_ship'=>$user_ship]); + return $this->success('设置成功'); + } + } \ No newline at end of file From 39173539d426131ecb95e7df80c19598c17f19c3 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 16:38:53 +0800 Subject: [PATCH 047/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/store/SystemStoreLists.php | 2 +- app/store/controller/store_order/StoreOrderController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/lists/store/SystemStoreLists.php b/app/api/lists/store/SystemStoreLists.php index 2688c24cc..52bef3231 100644 --- a/app/api/lists/store/SystemStoreLists.php +++ b/app/api/lists/store/SystemStoreLists.php @@ -49,7 +49,7 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac $latitude = $this->request->get('latitude',''); $longitude = $this->request->get('longitude',''); if(empty($longitude) || empty($latitude)){ - throw new MyBusinessException('缺失经纬度'); + throw new Exception('缺失经纬度'); } $where[]=['is_show','=',YesNoEnum::YES]; $data = SystemStore::where($this->searchWhere)->where($where) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 01399ff7a..d223fff94 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -137,7 +137,7 @@ class StoreOrderController extends BaseAdminController if(empty($user)){ return $this->fail('无该用户请检查'); } - $order = StoreOrderLogic::cartIdByOrderInfo($params['cartId'], null, $user, $params); + $order = StoreOrderLogic::cartIdByOrderInfo($params['cart_id'], null, $user, $params); if($order['order']['pay_price'] > $user['purchase_funds']){ return $this->fail('当前用户采购款不足支付'); } From d4c53ac69dec1af2b0f8c8a08492f6775c669ce0 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 16:41:04 +0800 Subject: [PATCH 048/145] =?UTF-8?q?feat(order):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AD=89=E7=BA=A7=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BB=A5=E8=B0=83=E6=95=B4=E8=AE=A2=E5=8D=95=E6=80=BB?= =?UTF-8?q?=E4=BB=B7=E5=92=8C=E6=8A=B5=E6=89=A3=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 34 ++++++++------ .../store_order/StoreOrderController.php | 45 ------------------- 2 files changed, 20 insertions(+), 59 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 4e4177fe6..086308e48 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -81,10 +81,13 @@ class OrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 - $onePrice = bcsub($find['price'], $find['cost'], 2); - + if ($user && $user['user_ship'] == 4) { + $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); + $cart_select[$k]['deduction_price'] =$deduction_price_count; + self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + } //利润 - $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 + // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 $cart_select[$k]['cost'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //成本 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额 $cart_select[$k]['product_id'] = $find['product_id']; @@ -107,9 +110,9 @@ class OrderLogic extends BaseLogic self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2); self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2); self::$cost = bcadd(self::$cost, $cart_select[$k]['cost'], 2); - self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); + // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - $pay_price =self::$pay_price;// bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 $vipPrice = 0; //成本价 收益 $order = [ @@ -117,7 +120,7 @@ class OrderLogic extends BaseLogic 'order_id' => $params['order_id'] ?? getNewOrderId('PF'), 'total_price' => self::$total_price, //总价 'cost' => self::$cost, //成本价1- - 'profit' => self::$profit, //利润 + 'profit' =>0, //利润 'pay_price' => $pay_price, //后期可能有降价抵扣 'vip_price' => $vipPrice, 'total_num' => count($cart_select), //总数 @@ -128,14 +131,19 @@ class OrderLogic extends BaseLogic 'shipping_type' => $params['shipping_type'] ?? 2, //配送方式 1=快递 ,2=门店自提 'activity' => '减免', 'activity_price' => self::$activity_price, - 'activities' =>0, - 'deduction_price' => self::$activity_price + 'activities' => self::$activity_price>0?1:0, + 'deduction_price' => self::$activity_price, + 'is_vip' => 0, ]; $order['default_delivery'] = 0; if ($params['store_id']) { $order['default_delivery'] = SystemStore::where('id', $params['store_id'])->value('is_send'); } + if($user['user_ship']>=1 &&$user['user_ship']<=3){ + $order['is_vip'] = 1; + + } } catch (\Exception $e) { self::setError($e->getMessage()); return false; @@ -159,10 +167,8 @@ class OrderLogic extends BaseLogic return false; } $_order = $orderInfo['order']; - $_order['uid'] = request()->userId; - $user = User::where('id', \request()->userId)->find(); - $_order['is_vip'] = $user['user_ship']; - $_order['spread_uid'] = UserSpreadLog::where('uid',request()->userId)->value('old_spread_uid')??0;//预留分享关系 + $_order['uid'] = $user['id']; + $_order['spread_uid'] =$params['spread_uid'];// UserSpreadLog::where('uid',request()->userId)->value('old_spread_uid')??0;//预留分享关系 $_order['real_name'] = $user['real_name']; $_order['mobile'] = $user['mobile']; $_order['pay_type'] = $orderInfo['order']['pay_type']; @@ -173,7 +179,7 @@ class OrderLogic extends BaseLogic $_order['reservation'] = YesNoEnum::YES; } if ($addressId > 0) { - $address = UserAddress::where(['id' => $addressId, 'uid' => Request()->userId])->find(); + $address = UserAddress::where(['id' => $addressId, 'uid' => $user['id']])->find(); if ($address) { $_order['real_name'] = $address['real_name']; $_order['user_phone'] = $address['phone']; @@ -197,7 +203,7 @@ class OrderLogic extends BaseLogic $updateData = []; foreach ($goods_list as $k => $v) { $goods_list[$k]['oid'] = $order->id; - $goods_list[$k]['uid'] = request()->userId; + $goods_list[$k]['uid'] = $user['id']; $goods_list[$k]['cart_id'] = implode(',', $cartId); $goods_list[$k]['delivery_id'] = $params['store_id']; //商家id $StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->withTrashed()->find(); diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 01399ff7a..3ba2bc34e 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -4,8 +4,6 @@ namespace app\store\controller\store_order; use app\api\logic\order\OrderLogic; use app\api\validate\OrderValidate; -use app\common\model\order\Cart; -use app\common\model\user\User; use app\store\lists\store_order\StoreOrderLists; use app\common\controller\Definitions; use app\common\enum\PayEnum; @@ -17,7 +15,6 @@ use app\common\logic\store_order\StoreOrderLogic; use app\common\model\store_order\StoreOrder; use app\common\model\user_recharge\UserRecharge; use app\store\validate\store_order\StoreOrderValidate; -use support\Cache; use support\Log; use Webman\RedisQueue\Redis; @@ -127,36 +124,11 @@ class StoreOrderController extends BaseAdminController return $this->data($res); } - - public function checkSms() - { - $params = (new StoreOrderValidate())->post()->goCheck('check'); - - $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 - $user= User::where('id',$params['uid'])->find(); - if(empty($user)){ - return $this->fail('无该用户请检查'); - } - $order = StoreOrderLogic::cartIdByOrderInfo($params['cartId'], null, $user, $params); - if($order['order']['pay_price'] > $user['purchase_funds']){ - return $this->fail('当前用户采购款不足支付'); - } - $res = (new StoreOrderLogic())->dealSendSms($params); - if($res){ - return $this->success('发送成功',[],1,1); - }else{ - return $this->fail('发送失败'); - } - - } - - public function createOrder() { $cartId = (array)$this->request->post('cart_id', []); $pay_type = (int)$this->request->post('pay_type'); $addressId = (int)$this->request->post('address_id'); - $sms_code = $this->request->post('sms_code',''); $auth_code = $this->request->post('auth_code'); //微信支付条码 $params = $this->request->post(); if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { @@ -165,23 +137,6 @@ class StoreOrderController extends BaseAdminController if (count($cartId) > 100) { return $this->fail('购物车商品不能超过100个'); } - - if($pay_type == PayEnum::PURCHASE_FUNDS && $sms_code){ - if(empty($cartId)){ - return $this->fail('缺失购物车数据'); - } - $uid = Cart::where('id',$cartId[0])->value('uid'); - $remark = $uid.'_smsPay'; - $code = Cache::get($remark); - if(empty($code)){ - return $this->fail('验证码过期请重新发送'); - } - if ($code !== $sms_code) { - return $this->fail('验证码错误'); - } - - } - $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 $order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params); if ($order != false) { From 68624a0304c4475424ec425450557437d0403f29 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 16:47:50 +0800 Subject: [PATCH 049/145] =?UTF-8?q?feat(OrderLogic):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=86=E4=BA=AB=E5=85=B3=E7=B3=BB=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 086308e48..3d5189acd 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -168,7 +168,7 @@ class OrderLogic extends BaseLogic } $_order = $orderInfo['order']; $_order['uid'] = $user['id']; - $_order['spread_uid'] =$params['spread_uid'];// UserSpreadLog::where('uid',request()->userId)->value('old_spread_uid')??0;//预留分享关系 + $_order['spread_uid'] =$params['spread_uid']??0;// UserSpreadLog::where('uid',request()->userId)->value('old_spread_uid')??0;//预留分享关系 $_order['real_name'] = $user['real_name']; $_order['mobile'] = $user['mobile']; $_order['pay_type'] = $orderInfo['order']['pay_type']; From f8e232fc58ce3e06ceec560ce9e87277e1c9ca56 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 17:13:44 +0800 Subject: [PATCH 050/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=B4=A2?= =?UTF-8?q?=E5=8A=A1=E6=B5=81=E6=B0=B4=E5=88=86=E6=94=AF=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=B9=B6=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store_finance_flow/StoreFinanceFlowLists.php | 4 +++- app/common/enum/OrderEnum.php | 15 +++++++++++---- app/common/logic/PayNotifyLogic.php | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php index c3ef16898..0b63109db 100644 --- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php +++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php @@ -63,13 +63,15 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt } if ($item['financial_pm'] == 0) { $item['number'] = '-' . $item['number']; + $item['financial_type_name'] = '订单支出给'.OrderEnum::getFinancialType($item['financial_type']); + } else { + $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']).'获得'; $item['number'] = '+' . $item['number']; } $item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name'); $item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : ''; $item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']); - $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']); }) ->toArray(); } diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index e8312c829..41899dce7 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -145,11 +145,18 @@ class OrderEnum self::USER_ORDER_PAY => '用户订单支付', self::MERCHANT_ORDER_PAY => '商户订单支付', self::PLATFORM_ORDER_PAY => '平台订单支付', - self::MERCHANT_ORDER_OBTAINS => '商户订单获得', - self::ORDER_HANDLING_FEES => '订单手续费', - self::PLATFORM_ORDER_OBTAINS => '平台订单获得', - self::SUPPLIER_ORDER_OBTAINS => '供应商订单获得', + self::MERCHANT_ORDER_OBTAINS => '商户', + self::ORDER_HANDLING_FEES => '手续费', + self::PLATFORM_ORDER_OBTAINS => '平台', + self::SUPPLIER_ORDER_OBTAINS => '供应商', self::SYSTEM_SET => '平台设置', + self::VILLAGE_ORDER_OBTAINS => '村长', + self::BRIGADE_ORDER_OBTAINS=>'队长', + self::OTHER_ORDER_OBTAINS=>'其他', + + + + ]; diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f542f508d..f40bd4027 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -369,7 +369,7 @@ class PayNotifyLogic extends BaseLogic $financeLogic->out($transaction_id, $fees, OrderEnum::OTHER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); } //供应链订单获得 - $financeLogic->in($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); + $financeLogic->in($transaction_id, bcsub($order['pay_price'], $count_frees, 2), OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); $financeLogic->out($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); // } $financeLogic->save(); From dfc7266fb0355d619b50a15f26a9ed8ab99f98be Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 17:15:18 +0800 Subject: [PATCH 051/145] =?UTF-8?q?=E8=A1=A5=E9=BD=90=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= 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 5af66e356..eecfe3e13 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -4,6 +4,7 @@ namespace app\store\controller\store_order; use app\api\logic\order\OrderLogic; use app\api\validate\OrderValidate; +use app\common\model\user\User; use app\store\lists\store_order\StoreOrderLists; use app\common\controller\Definitions; use app\common\enum\PayEnum; From 4c8ce2bd649af2647786ee529738deeab5117e70 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 17:17:57 +0800 Subject: [PATCH 052/145] =?UTF-8?q?feat(OrderEnum):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BF=9D=E8=AF=81=E9=87=91=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php | 3 +-- app/common/enum/OrderEnum.php | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php index 0b63109db..42428513f 100644 --- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php +++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php @@ -63,8 +63,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt } if ($item['financial_pm'] == 0) { $item['number'] = '-' . $item['number']; - $item['financial_type_name'] = '订单支出给'.OrderEnum::getFinancialType($item['financial_type']); - + $item['financial_type_name'] = '订单支付:'.OrderEnum::getFinancialType($item['financial_type']); } else { $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']).'获得'; $item['number'] = '+' . $item['number']; diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index 41899dce7..e9521edab 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -152,6 +152,7 @@ class OrderEnum self::SYSTEM_SET => '平台设置', self::VILLAGE_ORDER_OBTAINS => '村长', self::BRIGADE_ORDER_OBTAINS=>'队长', + self::ORDER_MARGIN=>'保证金', self::OTHER_ORDER_OBTAINS=>'其他', From 6b75053f6fd2d53d79e2fac9bbe05b12139b48df Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 17:19:37 +0800 Subject: [PATCH 053/145] =?UTF-8?q?feat(OrderEnum):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E8=AE=A2=E5=8D=95=E8=8E=B7=E5=8F=96=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php | 2 +- app/common/enum/OrderEnum.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php index 42428513f..3dedf3c5a 100644 --- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php +++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php @@ -63,7 +63,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt } if ($item['financial_pm'] == 0) { $item['number'] = '-' . $item['number']; - $item['financial_type_name'] = '订单支付:'.OrderEnum::getFinancialType($item['financial_type']); + $item['financial_type_name'] = '订单支出:'.OrderEnum::getFinancialType($item['financial_type']); } else { $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']).'获得'; $item['number'] = '+' . $item['number']; diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index e9521edab..f22c9d32c 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -153,6 +153,7 @@ class OrderEnum self::VILLAGE_ORDER_OBTAINS => '村长', self::BRIGADE_ORDER_OBTAINS=>'队长', self::ORDER_MARGIN=>'保证金', + self::VIP_ORDER_OBTAINS=>'会员', self::OTHER_ORDER_OBTAINS=>'其他', From bf98d4837afd0381545386650961981cc22163e1 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 18:00:53 +0800 Subject: [PATCH 054/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=92=8C=E5=95=86=E5=93=81=E6=88=90=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 2 +- app/queue/redis/StoreStorageSend.php | 3 ++- .../store_order/StoreOrderController.php | 15 ++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f40bd4027..710970f6c 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -96,7 +96,7 @@ class PayNotifyLogic extends BaseLogic public static function purchase_funds($orderSn, $extra = []) { $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); - $user = User::where('id', $order['uid'])->find(); + $user = User::where('id', $extra['uid'])->find(); if ($user['purchase_funds'] < $order['pay_price']) { throw new \Exception('采购款不足'); } diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index 1f4e58e7e..23e864870 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -55,7 +55,8 @@ class StoreStorageSend implements Consumer 'bar_code' => $find['bar_code'], 'cate_id' => $find['cate_id'], 'price' => $find['price'], - 'cost' => $find['cost'], +// 'cost' => $find['cost'], //v1.0 + 'cost' => $find['purchase'], 'vip_price' => $find['vip_price'], 'unit' => $find['unit'], 'store_id' => $store_id, diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index eecfe3e13..2a08a4f1f 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -4,6 +4,7 @@ namespace app\store\controller\store_order; use app\api\logic\order\OrderLogic; use app\api\validate\OrderValidate; +use app\common\model\order\Cart; use app\common\model\user\User; use app\store\lists\store_order\StoreOrderLists; use app\common\controller\Definitions; @@ -141,7 +142,7 @@ class StoreOrderController extends BaseAdminController } $res = (new StoreOrderLogic())->dealSendSms($params); if($res){ - return $this->success('发送成功',[],1,1); + return $this->success('发送成功',[],0,1); }else{ return $this->fail('发送失败'); } @@ -156,20 +157,24 @@ class StoreOrderController extends BaseAdminController $addressId = (int)$this->request->post('address_id'); $auth_code = $this->request->post('auth_code'); //微信支付条码 $params = $this->request->post(); - if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { + if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS) { return $this->fail('支付条码不能为空'); } if (count($cartId) > 100) { return $this->fail('购物车商品不能超过100个'); } + $user = null; + if($pay_type == PayEnum::PURCHASE_FUNDS){ + $user = User::where('id',$this->request->post('uid'))->find(); + } $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 - $order = StoreOrderLogic::createOrder($cartId, $addressId, null, $params); + $order = StoreOrderLogic::createOrder($cartId, $addressId, $user, $params); if ($order != false) { switch ($pay_type) { case PayEnum::PURCHASE_FUNDS: //采购款支付 - PayNotifyLogic::handle('purchase_funds', $order['order_id']); - return $this->success('采购款支付成功'); + PayNotifyLogic::handle('purchase_funds', $order['order_id'],['uid'=>$this->request->post('uid')]); + return $this->success('采购款支付成功',[],0,1); case PayEnum::CASH_PAY: //现金支付 From d04149ba48da80abf9203c8b0a2aa10ffa384194 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 18:12:07 +0800 Subject: [PATCH 055/145] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/user/UserLists.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php index 7f7bc24fe..fb2746572 100644 --- a/app/store/lists/user/UserLists.php +++ b/app/store/lists/user/UserLists.php @@ -4,6 +4,7 @@ namespace app\store\lists\user; +use app\common\model\store_finance_flow\StoreFinanceFlow; use app\store\lists\BaseAdminDataLists; use app\common\model\user\User; use app\common\model\user\UserShip; @@ -37,7 +38,7 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface public function lists(): array { - $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time"; + $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds"; $lists = User::where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->field($field) @@ -46,6 +47,10 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface $data['sex_text'] = $data->sex_text; $data['mobile'] = substr_replace($data['mobile'], '****', 3, 4); $data['user_ship_name'] =$data['user_ship']==0?'一般用户':UserShip::where('id',$data['user_ship'])->value('title'); + $data['return_money'] = StoreFinanceFlow:: + where(['user_id'=>$data['id'],'status'=>0,'financial_pm'=>0]) + ->sum('number'); + })->toArray(); return $lists; } From 1f9765d44ffecaae4a30b33c252fabf079820db9 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 15 Jun 2024 18:45:10 +0800 Subject: [PATCH 056/145] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BA=86?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E6=9D=A1=E4=BB=B6=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E4=BB=A5=E5=A4=84=E7=90=86=E4=B8=8D=E5=90=8C=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E6=89=8B=E7=BB=AD=E8=B4=B9=E3=80=81=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E8=B4=B9=E7=94=A8=E7=AD=89=E6=94=AF=E5=87=BA=E5=92=8C?= =?UTF-8?q?=E6=94=B6=E5=85=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 75 ++++++++++++++++++----------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f40bd4027..cd804d806 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -304,10 +304,10 @@ class PayNotifyLogic extends BaseLogic //平台手续费 $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); $count_frees = bcadd($count_frees, $fees, 2); - $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']); //商户平台手续费支出 - //冻结金额的 + 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(); @@ -316,22 +316,32 @@ class PayNotifyLogic extends BaseLogic $count_frees = bcadd($count_frees, $store_profit, 2); if ($deposit > 0) { if ($deposit > $store_profit) { - $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + if ($store_profit > 0) { + $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } } else { $money = bcsub($store_profit, $deposit, 2); - $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0,$order['pay_type']); //平台手续费 + if ($deposit > 0) { + $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } + if ($money) { + $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费 + } } } else { - $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); //平台手续费 + if ($store_profit > 0) { + $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['is_vip'] >= 1) { if ($order['spread_uid'] > 0) { $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); $count_frees = bcadd($count_frees, $fees, 2); - $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']); + if ($fees > 0) { + $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); @@ -351,27 +361,34 @@ class PayNotifyLogic extends BaseLogic } } } - //村长获得 - if ($village_uid > 0) { - $financeLogic->other_arr['vip_uid'] = $village_uid; + if ($fees > 0) { + //村长获得 + if ($village_uid > 0) { + $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) { + $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']); + //其他获得 + $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']); } - $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) { - $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']); - //其他获得 - $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); //供应链订单获得 - $financeLogic->in($transaction_id, bcsub($order['pay_price'], $count_frees, 2), OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0,0, $order['pay_type']); - $financeLogic->out($transaction_id, $count_frees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - // } + 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(); // } } From 1976367b3cd31d47950768d05825281b99d2281a Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 18:46:37 +0800 Subject: [PATCH 057/145] =?UTF-8?q?=E9=A2=84=E7=95=99=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=88=B0=E8=B4=A7=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/store_order/StoreOrderLogic.php | 8 ++++-- app/common/service/SmsService.php | 28 +++++++++++++------ .../store_order/StoreOrderController.php | 13 +++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 9df2d5a1e..e76081670 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -314,7 +314,7 @@ class StoreOrderLogic extends BaseLogic } - public function dealSendSms($param) + public function dealSendSms($param,$type = 0) { $code = generateRandomCode(); $phone = User::where('id',$param['uid'])->value('mobile'); @@ -322,8 +322,12 @@ class StoreOrderLogic extends BaseLogic throw new \Exception('用户未设置手机号'); } $template = getenv('SMS_TEMPLATE'); + if($type){ + $check =(new SmsService())->client($phone,$template,$code,1); + }else{ + $check =(new SmsService())->client($phone,$template,$code); + } - $check =(new SmsService())->client($phone,$template,$code); if($check){ $remark = $param['uid'].'_smsPay'; Cache::set($remark,$code,5*60); diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index d1270b1a9..af0d86ba0 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -45,18 +45,30 @@ class SmsService } - public function client($phone,$template,$code) + public function client($phone,$template,$code,$type = 0) { try{ $easySms = new EasySms($this->config); - $res = $easySms->send($phone, [ - 'content' => '您的验证码为: '.$code, - 'template' => $template, - 'data' => [ - 'code' => $code - ], - ]); + if($type){//预留发送到货短信 + $res = $easySms->send($phone, [ + 'content' => '您的验证码为: '.$code, + 'template' => $template, + 'data' => [ + 'code' => $code + ], + ]); + + }else{ + $res = $easySms->send($phone, [ + 'content' => '您的验证码为: '.$code, + 'template' => $template, + 'data' => [ + 'code' => $code + ], + ]); + } + if($res && $res['aliyun']['status'] == 'success'){ return true; }else{ diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 2a08a4f1f..8f4fb0338 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -373,5 +373,18 @@ class StoreOrderController extends BaseAdminController } return $this->fail('支付失败'); } + + public function stocking() + { + $uid = $this->request->post('uid'); + $res = (new StoreOrderLogic())->dealSendSms(['uid'=>$uid],1); + if($res){ + return $this->success('发送成功',[],0,1); + }else{ + return $this->fail('发送失败'); + } + + + } } From dc1fea9a15520744779ab5d5d8a7442d107c3d72 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 18:52:20 +0800 Subject: [PATCH 058/145] =?UTF-8?q?=E5=85=85=E9=92=B1=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/store_order/StoreOrderController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 8f4fb0338..f58c12af8 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -142,7 +142,7 @@ class StoreOrderController extends BaseAdminController } $res = (new StoreOrderLogic())->dealSendSms($params); if($res){ - return $this->success('发送成功',[],0,1); + return $this->success('发送成功',[],1,1); }else{ return $this->fail('发送失败'); } @@ -174,7 +174,7 @@ class StoreOrderController extends BaseAdminController case PayEnum::PURCHASE_FUNDS: //采购款支付 PayNotifyLogic::handle('purchase_funds', $order['order_id'],['uid'=>$this->request->post('uid')]); - return $this->success('采购款支付成功',[],0,1); + return $this->success('采购款支付成功',[],1,1); case PayEnum::CASH_PAY: //现金支付 From 87227e38fa994758c7de5eb08e81791b8c0f13cd Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 15 Jun 2024 18:57:28 +0800 Subject: [PATCH 059/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/store_order/StoreOrderController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index f58c12af8..1584096d1 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -142,7 +142,7 @@ class StoreOrderController extends BaseAdminController } $res = (new StoreOrderLogic())->dealSendSms($params); if($res){ - return $this->success('发送成功',[],1,1); + return $this->success('发送成功',[],1,0); }else{ return $this->fail('发送失败'); } @@ -174,7 +174,7 @@ class StoreOrderController extends BaseAdminController case PayEnum::PURCHASE_FUNDS: //采购款支付 PayNotifyLogic::handle('purchase_funds', $order['order_id'],['uid'=>$this->request->post('uid')]); - return $this->success('采购款支付成功',[],1,1); + return $this->success('采购款支付成功',[],1,0); case PayEnum::CASH_PAY: //现金支付 From 04776f7b80976bb50a5dfb6c75010ffcbcd9d523 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sun, 16 Jun 2024 20:52:11 +0800 Subject: [PATCH 060/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=EF=BC=8C=E5=BC=95?= =?UTF-8?q?=E5=85=A5UserSign=E6=A8=A1=E5=9E=8B=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=9D=91=E9=95=BF=E5=92=8C=E9=98=9F=E9=95=BF=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=8E=B7=E5=BE=97=E5=85=91=E6=8D=A2=E5=88=B8=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E5=BA=93=E5=AD=98=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E6=AE=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 46 +++++++++++++++++-------- app/common/model/user_sign/UserSign.php | 22 ++++++++++++ app/queue/redis/StoreStorageSend.php | 1 + 3 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 app/common/model/user_sign/UserSign.php diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index c666b5917..e51603b15 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -15,6 +15,7 @@ use app\common\model\user\User; 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\PushService; use support\Log; use think\facade\Db; @@ -78,7 +79,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']); - self::afterPay($order); + // 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' => '您有一笔新的订单']); } @@ -112,7 +113,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']); - self::afterPay($order); + // 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' => '您有一笔新的订单']); } @@ -142,12 +143,12 @@ class PayNotifyLogic extends BaseLogic $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; + self::afterPay($order, $extra['transaction_id']); } else { $capitalFlowDao = new CapitalFlowLogic($user); //微信支付和用户余额无关 $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1); } - self::afterPay($order, $extra['transaction_id']); if ($order->pay_type == 9) { @@ -239,6 +240,7 @@ class PayNotifyLogic extends BaseLogic $order->paid = 1; $order->pay_time = time(); $order->status = 2; + self::afterPay($order); if (!$order->save()) { throw new \Exception('订单保存出错'); } @@ -272,8 +274,9 @@ class PayNotifyLogic extends BaseLogic } if ($order->pay_type == 9) { $order->status = 2; + self::afterPay($order); + } - self::afterPay($order); if ($order->pay_type == 9) { $extra['create_time'] = $order['create_time']; @@ -363,18 +366,33 @@ class PayNotifyLogic extends BaseLogic } if ($fees > 0) { //村长获得 - if ($village_uid > 0) { - $financeLogic->other_arr['vip_uid'] = $village_uid; - } + $sing=[]; + $user_sing=new UserSign(); - $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']); + $sing[]=[ + 'uid'=>$village_uid, + 'title'=>'村长订单获得兑换券', + 'store_id'=>$order['store_id'], + 'number'=>$fees, + ]; + $sing[]=[ + 'uid'=>$brigade_uid, + 'title'=>'队长订单获得兑换券', + 'store_id'=>$order['store_id'], + 'number'=>$fees, + ]; + // if ($village_uid > 0) { + // $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) { - $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']); + // if ($brigade_uid > 0) { + // $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']); diff --git a/app/common/model/user_sign/UserSign.php b/app/common/model/user_sign/UserSign.php new file mode 100644 index 000000000..db0ade179 --- /dev/null +++ b/app/common/model/user_sign/UserSign.php @@ -0,0 +1,22 @@ + $find['purchase'], 'vip_price' => $find['vip_price'], 'unit' => $find['unit'], + 'batch' => $find['batch'], 'store_id' => $store_id, 'sales' => 0, 'stock' => 0, From 0286d428e69c322bdd7709e83bbb44f0052f3818 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 10:02:16 +0800 Subject: [PATCH 061/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E4=BC=9A=E5=91=98=E5=85=85=E5=80=BC=E5=8A=9F=E8=83=BD?= 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 | 46 +++++++++++++++++-- app/api/controller/user/UserController.php | 1 - app/api/validate/UserValidate.php | 13 ++++++ .../store_order/StoreOrderController.php | 1 + 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index 49ef54b36..330c588da 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -102,7 +102,6 @@ class UserLogic extends BaseLogic return $res; } catch (\Exception $e) { Db::rollback(); - d($e); self::setError($e->getMessage()); return false; } diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index ef5b21d04..adc00994b 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -2,12 +2,18 @@ namespace app\api\controller\store; +use app\admin\logic\user\UserLogic as UserUserLogic; use app\api\lists\store\SystemStoreLists; use app\api\controller\BaseApiController; use app\api\logic\store\StoreLogic; -use app\common\service\pay\PayService; -use Webman\Config; - +use app\api\logic\user\UserLogic; +use app\api\validate\UserValidate; +use app\common\enum\PayEnum; +use app\common\logic\PaymentLogic; +use app\common\logic\PayNotifyLogic; +use app\common\model\user\User; +use app\common\model\user_recharge\UserRecharge; +use Webman\RedisQueue\Redis; class StoreController extends BaseApiController { @@ -32,5 +38,39 @@ class StoreController extends BaseApiController } } + /** + * 门店会员充值 + */ + public function recharge() + { + $params = (new UserValidate())->post()->goCheck('rechargeStoreMoney'); + $auth_code = $this->request->post('auth_code'); //微信支付条码 + $params['uid'] = $this->userId; + $params['channel_type'] = $this->userInfo['terminal']; + $find=User::where('mobile',$params['mobile'])->find(); + if(!$find){ + $find=UserUserLogic::StoreAdd($params); + } + $data=[ + 'store_id'=>$params['store_id'], + 'uid'=>$find['uid'], + 'staff_id'=>0, + 'order_id'=>getNewOrderId('CZ'), + 'price'=>$params['price'], + ]; + $order = UserRecharge::create($data); + $order['pay_price']=$order['price']; + $result = PaymentLogic::codepay($auth_code, $order); + if (PaymentLogic::hasError()) { + return $this->fail(PaymentLogic::getError(), $params); + } + if (isset($result['trade_state_desc']) && $result['trade_state_desc'] == '支付成功') { + PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result); + } else { + Redis::send('send-code-pay', ['order_id' => $order['order_id'],'pay_type'=>'recharge']); + return $this->success('用户支付中'); + } + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); + } } diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index b21be4f69..2f2e921e9 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -89,7 +89,6 @@ class UserController extends BaseApiController return $this->fail(PaymentLogic::getError(), $params); } return $this->success('', $result); - } // #[ diff --git a/app/api/validate/UserValidate.php b/app/api/validate/UserValidate.php index ddc907b23..d670e7327 100644 --- a/app/api/validate/UserValidate.php +++ b/app/api/validate/UserValidate.php @@ -16,10 +16,14 @@ class UserValidate extends BaseValidate protected $rule = [ 'code' => 'require', + 'store_id' => 'require', + 'mobile' => 'require', ]; protected $message = [ 'code.require' => '参数缺失', + 'store_id.require' => '门店id', + 'mobile.require' => '手机', ]; @@ -57,5 +61,14 @@ class UserValidate extends BaseValidate { return $this->only(['price']); } + /** + * @notes 充值 + * @return UserValidate + * @Time: 2024/6/4 22:50 + */ + public function sceneRechargeStoreMoney() + { + return $this->only(['price']); + } } \ No newline at end of file diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 1584096d1..765fb4a2b 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -2,6 +2,7 @@ namespace app\store\controller\store_order; +use app\admin\logic\user\UserLogic; use app\api\logic\order\OrderLogic; use app\api\validate\OrderValidate; use app\common\model\order\Cart; From 950cd2fe3a262f8c55e9af51190d08455cd11dbc Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 10:07:30 +0800 Subject: [PATCH 062/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=B3=A8=E5=86=8C=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/user/UserLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index 330c588da..894799e92 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -82,7 +82,7 @@ class UserLogic extends BaseLogic 'account' => $params['mobile'], 'password' => $password, 'mobile' => $params['mobile'], - 'user_ship' => $params['user_ship'], + 'user_ship' => $params['user_ship']??0, ]; $res=User::create($data); From 00a72c0b71db9b46630c27e740ac490306898f86 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 10:22:44 +0800 Subject: [PATCH 063/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=A0=B8=E9=94=80=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 | 4 ++++ .../controller/store_order/StoreOrderController.php | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 3d5189acd..7f50e6ea2 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -388,11 +388,15 @@ class OrderLogic extends BaseLogic 'status' => OrderEnum::RECEIVED_GOODS, 'is_writeoff' => OrderEnum::IS_OK, 'update_time' => time(), + 'store_id' => $params['store_id'], + 'staff_id' => $params['staff_id']??0, ], ['id' => $data['id']]); (new StoreOrderCartInfo())->update([ 'verify_code'=>$params['verify_code'].'-1', 'writeoff_time' => time(), 'is_writeoff' => YesNoEnum::YES, + 'store_id' => $params['store_id'], + 'staff_id' => $params['staff_id']??0, 'update_time' => time(), ], ['oid' => $data['id']]); $financeFlow = (new StoreFinanceFlowLogic)->getStoreOrder($data['id'], $data['store_id']); diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 765fb4a2b..70eba2f91 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -151,6 +151,9 @@ class StoreOrderController extends BaseAdminController } + /** + * 创建订单 + */ public function createOrder() { $cartId = (array)$this->request->post('cart_id', []); @@ -216,6 +219,9 @@ class StoreOrderController extends BaseAdminController } } + /** + * 重新支付 + */ public function pay() { $order_id = $this->request->post('order_id'); @@ -273,6 +279,9 @@ class StoreOrderController extends BaseAdminController return $this->fail('支付失败'); } + /** + * 订单核销 + */ public function writeoff_order() { $params = (new OrderValidate())->post()->goCheck('check'); @@ -280,6 +289,8 @@ class StoreOrderController extends BaseAdminController if (empty($count)) { return $this->fail('无该核销码请检查'); } + $params['store_id']=$this->adminInfo['store_id']; + $params['staff_id']=$this->adminId; $res = OrderLogic::writeOff($params); if ($res) { return $this->success('核销成功'); From 1eb395bbe0c230f2c57d41f98bb77e7a8e807f72 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 10:51:55 +0800 Subject: [PATCH 064/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E8=AE=A2=E5=8D=95API=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=80=9A=E7=9F=A5=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 | 2 +- app/api/logic/order/OrderLogic.php | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index adc00994b..253436c97 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -56,7 +56,7 @@ class StoreController extends BaseApiController 'uid'=>$find['uid'], 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), - 'price'=>$params['price'], + 'price'=>1000, ]; $order = UserRecharge::create($data); diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 7f50e6ea2..5896de4e4 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -8,6 +8,7 @@ use app\common\enum\UserShipEnum; use app\common\enum\YesNoEnum; use app\common\logic\BaseLogic; use app\common\logic\CapitalFlowLogic; +use app\common\logic\PayNotifyLogic; use app\common\logic\StoreFinanceFlowLogic; use app\common\model\dict\DictData; use app\common\model\dict\DictType; @@ -399,11 +400,13 @@ class OrderLogic extends BaseLogic 'staff_id' => $params['staff_id']??0, 'update_time' => time(), ], ['oid' => $data['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']); - } + // $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); Db::commit(); return true; } catch (\Exception $e) { From f1219258c3fed62156522df76d6d24dc5e8518f8 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 11:04:23 +0800 Subject: [PATCH 065/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E6=94=AF=E4=BB=98=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8F=8A=E6=9D=A1=E7=A0=81=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/PayController.php | 7 ++++++- app/api/controller/store/StoreController.php | 2 +- app/common/logic/PaymentLogic.php | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php index 6603df95e..90e6bfceb 100644 --- a/app/api/controller/PayController.php +++ b/app/api/controller/PayController.php @@ -68,6 +68,7 @@ class PayController extends BaseApiController public function wechatQuery() { $order_no = $this->request->get('order_no'); + $recharge = $this->request->get('recharge',0); $order = [ 'out_trade_no' => $order_no, ]; @@ -75,7 +76,11 @@ class PayController extends BaseApiController $res = $app->wechat->query($order); if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') { - PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res); + if($recharge==0){ + PayNotifyLogic::handle('wechat_common', $res['out_trade_no'], $res); + }else{ + PayNotifyLogic::handle('recharge', $res['out_trade_no'], $res); + } return $this->success('支付成功'); } else { return $this->fail('订单支付中'); diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 253436c97..9ac5b9b7a 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -61,7 +61,7 @@ class StoreController extends BaseApiController $order = UserRecharge::create($data); $order['pay_price']=$order['price']; - $result = PaymentLogic::codepay($auth_code, $order); + $result = PaymentLogic::codepay($auth_code, $order,'条码支付'); if (PaymentLogic::hasError()) { return $this->fail(PaymentLogic::getError(), $params); } diff --git a/app/common/logic/PaymentLogic.php b/app/common/logic/PaymentLogic.php index 98b0c7fb4..51df608a2 100644 --- a/app/common/logic/PaymentLogic.php +++ b/app/common/logic/PaymentLogic.php @@ -74,7 +74,7 @@ class PaymentLogic extends BaseLogic /** * 微信条码支付 */ - public static function codepay($auth_code, $order) + public static function codepay($auth_code, $order,$description='条码商品') { $pattern = '/^(10|11|12|13|14|15)\d{16}$/'; @@ -83,7 +83,7 @@ class PaymentLogic extends BaseLogic return false; } $order = [ - 'description' => '条码商品', + 'description' => $description, 'out_trade_no' => (string)$order['order_id'], 'payer' => [ 'auth_code' => (string)$auth_code From 2a9887e632a0b7053f627cddb29b5b8847a15260 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 11:43:28 +0800 Subject: [PATCH 066/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=9A=84=E5=95=86=E6=88=B7=E5=88=86=E7=B1=BB=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/store_product/StoreProductLogic.php | 103 +++++++++++++----- .../store_product_cate/StoreProductCate.php | 14 +++ 2 files changed, 91 insertions(+), 26 deletions(-) create mode 100644 app/common/model/store_product_cate/StoreProductCate.php diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index e88207b5f..e8ab690b5 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -9,6 +9,7 @@ use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_branch_product_attr_value\StoreBranchProductAttrValue; use app\common\model\store_category\StoreCategory; use app\common\model\store_product_attr_value\StoreProductAttrValue; +use app\common\model\store_product_cate\StoreProductCate; use app\common\model\system_store\SystemStore; use app\common\model\system_store_storage\SystemStoreStorage; use app\Request; @@ -48,7 +49,7 @@ class StoreProductLogic extends BaseLogic 'purchase' => $params['purchase'], 'rose' => $params['rose'], 'is_return' => $params['is_return'], - 'swap' => $params['swap']??0, + 'swap' => $params['swap'] ?? 0, ]; // if ($params['rose'] > 0) { // $rose_price = bcmul($params['cost'], $params['rose'], 2); @@ -94,6 +95,34 @@ class StoreProductLogic extends BaseLogic } } + public static function deleteRelatedData($cate_id) + { + $data_to_delete = StoreProductCate::where('cate_id', $cate_id)->select(); + foreach ($data_to_delete as $item) { + + if ($item['pid'] != 0) { + self::deleteRelatedData($item['pid']); + StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]); + } + + if($item['pid'] == 0 && in_array($item['count'],[0,1])){ + StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]); + } + + } + } + + // 递归减少分类数据的count值 + public static function decreaseCount($cate_id) + { + $data_to_decrease = StoreProductCate::where('cate_id', $cate_id)->select(); + foreach ($data_to_decrease as $item) { + if ($item['pid'] != 0) { + self::decreaseCount($item['pid']); + } + StoreProductCate::where('id', $item['id'])->update(['count' => $item['count'] - 1]); + } + } /** * @notes 编辑商品列表 @@ -106,30 +135,51 @@ class StoreProductLogic extends BaseLogic { Db::startTrans(); try { - $data = [ - 'store_name' => $params['store_name'], - 'image' => $params['image'], - 'bar_code' => $params['bar_code'] ?? '', - 'cate_id' => $params['cate_id'], - 'unit' => $params['unit'], - 'stock' => $params['stock'], - 'cost' => $params['cost'], - 'purchase' => $params['purchase'], - 'rose' => $params['rose'], - 'is_return' => $params['is_return'], - 'price' => $params['price'], - 'vip_price' => $params['vip_price'], - 'cost' => $params['cost'], - 'swap' => $params['swap']??0, + $data = [ + 'store_name' => $params['store_name'], + 'image' => $params['image'], + 'bar_code' => $params['bar_code'] ?? '', + 'cate_id' => $params['cate_id'], + 'unit' => $params['unit'], + 'stock' => $params['stock'], + 'cost' => $params['cost'], + 'purchase' => $params['purchase'], + 'rose' => $params['rose'], + 'is_return' => $params['is_return'], + 'price' => $params['price'], + 'vip_price' => $params['vip_price'], + 'swap' => $params['swap'] ?? 0, + + ]; + + StoreProduct::where('id', $params['id'])->update($data); + $old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id') + ->select(); + + // 获取分类ID + foreach ($old_cate as $vv) { + $related_data = Db::name('store_product_cate')->where('cate_id', $vv['cate_id'])->select(); + //删除之前的分类 + foreach ($related_data as $value) { + if ($value['count'] == 1) { + self::deleteRelatedData($value['cate_id']); + } elseif ($value['count'] > 1) { + self::decreaseCount($value['cate_id']); + } + //新增对应的分类 + self::updateGoodsclass($params['cate_id'], $value['store_id']); + } + } + + + //修改 + StoreBranchProduct::where('product_id', $params['id'])->update([ + 'price' => $params['price'], 'vip_price' => $params['vip_price'], + 'cost' => $params['cost'], 'cate_id' => $params['cate_id'] + ]); - ]; - StoreProduct::where('id', $params['id'])->update($data); - StoreBranchProduct::where('product_id', $params['id'])->update([ - 'price' => $params['price'], 'vip_price' => $params['vip_price'], - 'cost' => $params['cost'] - ]); Db::commit(); - return true; + return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); @@ -148,7 +198,7 @@ class StoreProductLogic extends BaseLogic public static function delete(array $params): bool { $res = StoreProduct::destroy($params['id']); - StoreBranchProduct::where('product_id', $params['id'])->update(['delete_time'=>time()]); + StoreBranchProduct::where('product_id', $params['id'])->update(['delete_time' => time()]); return $res; } @@ -192,7 +242,7 @@ class StoreProductLogic extends BaseLogic self::cate_update($cate_id, $two['id'], $store_id, 3); self::cate_update($two['id'], $two['pid'], $store_id, 2); self::cate_update($two['pid'], 0, $store_id, 1); - }else{ + } else { if ($one['pid'] == 0) { self::cate_update($one['id'], 0, $store_id, 1); } else { @@ -200,7 +250,7 @@ class StoreProductLogic extends BaseLogic self::cate_update($one['pid'], 0, $store_id, 1); } } - } + } } } @@ -213,6 +263,7 @@ class StoreProductLogic extends BaseLogic Db::name('store_product_cate')->insert(['pid' => $pid, 'store_id' => $store_id, 'cate_id' => $cate_id, 'count' => 1, 'level' => $level, 'create_time' => time(), 'update_time' => time()]); } } + /** * 复制商品到门店 */ diff --git a/app/common/model/store_product_cate/StoreProductCate.php b/app/common/model/store_product_cate/StoreProductCate.php new file mode 100644 index 000000000..41338c9e7 --- /dev/null +++ b/app/common/model/store_product_cate/StoreProductCate.php @@ -0,0 +1,14 @@ + Date: Mon, 17 Jun 2024 11:52:13 +0800 Subject: [PATCH 067/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?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/lists/cate/CateLists.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/lists/cate/CateLists.php b/app/api/lists/cate/CateLists.php index 87a8fb73c..e924419bf 100644 --- a/app/api/lists/cate/CateLists.php +++ b/app/api/lists/cate/CateLists.php @@ -46,6 +46,7 @@ class CateLists extends BaseAdminDataLists implements ListsSearchInterface $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'); $lists = []; if ($cate_arr) { From 097ca47c074edfd71211bf539bab86a74e9ca0c3 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 13:34:30 +0800 Subject: [PATCH 068/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=E5=AD=97=E6=AE=B5=E5=88=B0=E5=95=86=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=92=8C=E9=80=BB=E8=BE=91=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/store_product/StoreProductLists.php | 2 +- app/admin/logic/store_product/StoreProductLogic.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 7c0c9836e..8d2d6969b 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -46,7 +46,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa public function lists(): array { return StoreProduct::where($this->searchWhere) - ->field(['id', 'image', 'store_name','swap', 'cate_id', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code']) + ->field(['id', 'image', 'store_name','swap', 'cate_id','batch', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) { diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index e88207b5f..3ca4152de 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -49,6 +49,7 @@ class StoreProductLogic extends BaseLogic 'rose' => $params['rose'], 'is_return' => $params['is_return'], 'swap' => $params['swap']??0, + 'batch' => $params['batch']??0, ]; // if ($params['rose'] > 0) { // $rose_price = bcmul($params['cost'], $params['rose'], 2); @@ -120,6 +121,7 @@ class StoreProductLogic extends BaseLogic 'price' => $params['price'], 'vip_price' => $params['vip_price'], 'cost' => $params['cost'], + 'batch' => $params['batch'], 'swap' => $params['swap']??0, ]; From ed5d63035ba8f0b9cf02b99b96a84908e4d5416b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 13:39:56 +0800 Subject: [PATCH 069/145] =?UTF-8?q?feat(StoreController):=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=BA=86=20StoreController=20=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=AF=86=E5=88=AB=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 9ac5b9b7a..59493a688 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -45,15 +45,13 @@ class StoreController extends BaseApiController { $params = (new UserValidate())->post()->goCheck('rechargeStoreMoney'); $auth_code = $this->request->post('auth_code'); //微信支付条码 - $params['uid'] = $this->userId; - $params['channel_type'] = $this->userInfo['terminal']; $find=User::where('mobile',$params['mobile'])->find(); if(!$find){ $find=UserUserLogic::StoreAdd($params); } $data=[ 'store_id'=>$params['store_id'], - 'uid'=>$find['uid'], + 'uid'=>$find['id'], 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), 'price'=>1000, From b0bda5044971a26a88df7d64b1e6ac9ae7326f23 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 13:47:45 +0800 Subject: [PATCH 070/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=85=91=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreBranchProductController.php | 7 +- .../StoreBranchProductExchangeLists.php | 125 ++++++++++++++++++ app/api/controller/store/StoreController.php | 2 +- 3 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 app/admin/lists/store_branch_product exchange/StoreBranchProductExchangeLists.php diff --git a/app/admin/controller/store_branch_product/StoreBranchProductController.php b/app/admin/controller/store_branch_product/StoreBranchProductController.php index c26452cb4..8b97950eb 100644 --- a/app/admin/controller/store_branch_product/StoreBranchProductController.php +++ b/app/admin/controller/store_branch_product/StoreBranchProductController.php @@ -5,6 +5,7 @@ namespace app\admin\controller\store_branch_product; use app\admin\controller\BaseAdminController; use app\admin\lists\store_branch_product\StoreBranchProductLists; +use app\admin\lists\store_branch_product_exchange\StoreBranchProductExchangeLists; use app\admin\logic\store_branch_product\StoreBranchProductLogic; use app\admin\logic\store_product\StoreProductLogic; use app\admin\validate\store_product\StoreProductValidate; @@ -27,7 +28,11 @@ class StoreBranchProductController extends BaseAdminController */ public function lists() { - return $this->dataLists(new StoreBranchProductLists()); + if($this->request->get('exchange',0)==1){ + return $this->dataLists(new StoreBranchProductExchangeLists()); + }else{ + return $this->dataLists(new StoreBranchProductLists()); + } } diff --git a/app/admin/lists/store_branch_product exchange/StoreBranchProductExchangeLists.php b/app/admin/lists/store_branch_product exchange/StoreBranchProductExchangeLists.php new file mode 100644 index 000000000..f4144ab48 --- /dev/null +++ b/app/admin/lists/store_branch_product exchange/StoreBranchProductExchangeLists.php @@ -0,0 +1,125 @@ + ['product_id', 'cate_id','store_id','status'], + '%pipe_like%' => ['store_name_code'=>'store_name|bar_code'], + '%like%' => ['store_name'], + ]; + } + + + /** + * @notes 获取门店列表列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2024/05/31 17:45 + */ + public function lists(): array + { + $status = $this->params['status'] ?? ''; + $class_all=$this->request->get('class_all'); + $where=[]; + if($class_all){ + $arr=Cate::where('pid',$class_all)->column('id'); + if($arr){ + $arr2=Cate::where('pid','in',$arr)->column('id'); + $where[]=['cate_id','in',array_merge($arr,$arr2)]; + } + } + return StoreBranchProductExchange::where($this->searchWhere)->where($where) + ->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'status']) + ->when(!empty($this->adminInfo['store_id']), function ($query) { + $query->where('store_id', $this->adminInfo['store_id']); + }) + ->when(!empty($status), function ($query) use ($status) { + if ($status == 1) { + $query->where('status', $status); + } elseif ($status == 2) { + $query->where('status', 0); + } elseif ($status == 3) { + $query->where('stock', '<=', 0); + } elseif ($status == 4) { + $query->where('stock', '<', 10)->where('stock', '>', 0); + } + }) + ->limit($this->limitOffset, $this->limitLength) + ->order(['sort' => 'desc','stock'=>'desc','id' => 'desc']) + ->select() + ->each(function ($item) { + $item['system_store_name']=SystemStore::where('id',$item['store_id'])->value('name'); + $item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name'); + $item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name'); + return $item; + }) + ->toArray(); + } + + + /** + * @notes 获取门店列表数量 + * @return int + * @author admin + * @date 2024/05/31 17:45 + */ + public function count(): int + { + $status = $this->params['status'] ?? ''; + $class_all=$this->request->get('class_all'); + $where=[]; + if($class_all){ + $arr=Cate::where('pid',$class_all)->column('id'); + if($arr){ + $arr2=Cate::where('pid','in',$arr)->column('id'); + $where[]=['cate_id','in',array_merge($arr,$arr2)]; + } + } + return StoreBranchProductExchange::where($this->searchWhere)->where($where) + ->when(!empty($this->adminInfo['store_id']), function ($query) { + $query->where('store_id', $this->adminInfo['store_id']); + }) + ->when(!empty($status), function ($query) use ($status) { + if ($status == 1) { + $query->where('status', $status); + } elseif ($status == 2) { + $query->where('status', 0); + } elseif ($status == 3) { + $query->where('stock', '<=', 0); + } elseif ($status == 4) { + $query->where('stock', '<', 10)->where('stock', '>', 0); + } + }) + ->count(); + } + +} diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 59493a688..a620c3d24 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -54,7 +54,7 @@ class StoreController extends BaseApiController 'uid'=>$find['id'], 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), - 'price'=>1000, + 'price'=>0.01, ]; $order = UserRecharge::create($data); From c3e6bdf5d00497c36b28829c89d28d7c264b1ec9 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 14:09:39 +0800 Subject: [PATCH 071/145] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E6=94=B6=E6=AC=BE=E5=92=8C=E9=97=A8=E5=BA=97=E6=94=B6=E6=AC=BE?= =?UTF-8?q?=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 1 + app/store/logic/WorkbenchLogic.php | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index a620c3d24..9c8c22fb0 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -55,6 +55,7 @@ class StoreController extends BaseApiController 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), 'price'=>0.01, + 'recharge_type'=>'wechat_mini' ]; $order = UserRecharge::create($data); diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index bb7e57183..8f349359c 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -28,6 +28,7 @@ use app\common\model\store_order\StoreOrder; use app\common\model\store_order_cart_info\StoreOrderCartInfo; use app\common\model\store_visit\StoreVisit; use app\common\model\system_store\SystemStore; +use app\common\model\user_recharge\UserRecharge; use app\common\service\ConfigService; use app\common\service\FileService; @@ -60,6 +61,11 @@ class WorkbenchLogic extends BaseLogic $data['verify_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTime, $endTime, ['shipping_type' => 2]); //门店收益金额 $data['income_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTime, $endTime, [], 'profit'); + //门店收款金额 + $data['receipt_amount'] = UserRecharge::where([ + 'store_id'=>$params['store_id'], + 'paid'=>YesNoEnum::YES + ])->sum('price'); //门店成交用户数 $data['user_number'] = StoreOrder::where('store_id', $params['store_id']) ->where('paid', 1) @@ -82,7 +88,8 @@ class WorkbenchLogic extends BaseLogic $i++; } $field = 'from_unixtime(pay_time,"%m-%d") as pay_time,sum(pay_price) as pay_price'; - } else { + } + else { $group = 'MONTH(pay_time)'; $i = 0; $month = 0; From b6211105c0554992aa9bd8f0fa66865da7f5c41a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 14:19:54 +0800 Subject: [PATCH 072/145] =?UTF-8?q?feat(store):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E4=BC=9A=E5=91=98=E5=85=85=E5=80=BC=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 15 +++++ .../user/UserRechargeController.php | 24 +++++++ app/api/lists/product/ProductLists.php | 4 +- app/api/lists/user/UserRechargeLists.php | 63 +++++++++++++++++++ .../store_order/StoreOrderController.php | 1 + 5 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 app/api/controller/user/UserRechargeController.php create mode 100644 app/api/lists/user/UserRechargeLists.php diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index a620c3d24..c4368e496 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -55,6 +55,7 @@ class StoreController extends BaseApiController 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), 'price'=>0.01, + 'recharge_type'=>'INDUSTRYMEMBERS', ]; $order = UserRecharge::create($data); @@ -71,4 +72,18 @@ class StoreController extends BaseApiController } return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); } + + /** + * 门店会员充值数量 + */ + public function recharge_count() + { + $store_id = $this->request->get('store_id',0); + $count=0; + if($store_id){ + $count= UserRecharge::where(['store_id'=>$store_id,'recharge_type'=>'INDUSTRYMEMBERS','paid'=>1])->count(); + } + return $this->success('ok',['count'=>$count]); + + } } diff --git a/app/api/controller/user/UserRechargeController.php b/app/api/controller/user/UserRechargeController.php new file mode 100644 index 000000000..6ca86becf --- /dev/null +++ b/app/api/controller/user/UserRechargeController.php @@ -0,0 +1,24 @@ +dataLists(new UserFeedbackLists()); + } + } diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index a11a486c2..438a317e5 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -113,7 +113,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li if($M_store_id){ $where[]=['store_id','=',$M_store_id]; $data = StoreBranchProduct::where($this->searchWhere)->where($where) - ->field(['id', 'product_id','cate_id','store_name', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit']) + ->field(['id', 'product_id','cate_id','store_name','batch', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit']) ->limit($this->limitOffset, $this->limitLength) ->with(['className','unitName']) ->order($this->sortOrder) @@ -122,7 +122,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li }else{ $data = StoreBranchProduct::where($this->searchWhere)->where($where) - ->field(['id', 'product_id','cate_id','store_name','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit']) + ->field(['id', 'product_id','cate_id','store_name','batch','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit']) ->limit($this->limitOffset, $this->limitLength) ->with(['className','unitName']) ->order($this->sortOrder) diff --git a/app/api/lists/user/UserRechargeLists.php b/app/api/lists/user/UserRechargeLists.php new file mode 100644 index 000000000..482cf821c --- /dev/null +++ b/app/api/lists/user/UserRechargeLists.php @@ -0,0 +1,63 @@ + ['store_id','recharge_type'], + ]; + } + + + /** + * @notes 获取用户充值表列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/05/13 16:56 + */ + public function lists(): array + { + return UserRecharge::where($this->searchWhere) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select()->each(function($data){ + $user = User::field('nickname')->where('id',$data['uid'])->findOrEmpty(); + $data['user_name'] = !$user->isEmpty() ? $user['nickname'] : ''; + }) + ->toArray(); + } + + + /** + * @notes 获取用户充值表数量 + * @return int + * @author likeadmin + * @date 2024/05/13 16:56 + */ + public function count(): int + { + return UserFeedback::where($this->searchWhere)->count(); + } + + } \ No newline at end of file diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 70eba2f91..de727787f 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -350,6 +350,7 @@ class StoreOrderController extends BaseAdminController 'staff_id'=>$this->adminId, 'order_id'=>getNewOrderId('CZ'), 'price'=>$params['price'], + 'recharge_type'=>'INDUSTRYMEMBERS', ]; $order = UserRecharge::create($data); $order['pay_price']=$order['price']; From 449a0a7d2eb7ae903a50bb3b8c838ca94889ef86 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 14:20:50 +0800 Subject: [PATCH 073/145] =?UTF-8?q?=E8=B5=B7=E6=89=B9=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/product/ProductLists.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index a11a486c2..f208633c8 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -113,7 +113,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li if($M_store_id){ $where[]=['store_id','=',$M_store_id]; $data = StoreBranchProduct::where($this->searchWhere)->where($where) - ->field(['id', 'product_id','cate_id','store_name', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit']) + ->field(['id', 'product_id','cate_id','store_name', 'cost','store_id','price', 'bar_code','image','sales','store_info','delete_time','unit','batch']) ->limit($this->limitOffset, $this->limitLength) ->with(['className','unitName']) ->order($this->sortOrder) @@ -122,7 +122,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface,Li }else{ $data = StoreBranchProduct::where($this->searchWhere)->where($where) - ->field(['id', 'product_id','cate_id','store_name','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit']) + ->field(['id', 'product_id','cate_id','store_name','cost', 'store_id','price', 'bar_code','image','sales','store_info','delete_time','unit','batch']) ->limit($this->limitOffset, $this->limitLength) ->with(['className','unitName']) ->order($this->sortOrder) From 26f3117e8996273f8ebe92b7a40646431673a581 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 14:28:17 +0800 Subject: [PATCH 074/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BA=86=E5=95=86=E5=93=81=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=B5=81=E7=A8=8B=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=AF=B9=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=E7=9A=84=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=93=8D=E4=BD=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/store_product/StoreProductLogic.php | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index a26b5bf96..59f7c655f 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -49,8 +49,8 @@ class StoreProductLogic extends BaseLogic 'purchase' => $params['purchase'], 'rose' => $params['rose'], 'is_return' => $params['is_return'], - 'swap' => $params['swap']??0, - 'batch' => $params['batch']??0, + 'swap' => $params['swap'] ?? 0, + 'batch' => $params['batch'] ?? 0, ]; // if ($params['rose'] > 0) { // $rose_price = bcmul($params['cost'], $params['rose'], 2); @@ -106,10 +106,9 @@ class StoreProductLogic extends BaseLogic StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]); } - if($item['pid'] == 0 && in_array($item['count'],[0,1])){ + if ($item['pid'] == 0 && in_array($item['count'], [0, 1])) { StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]); } - } } @@ -151,38 +150,41 @@ class StoreProductLogic extends BaseLogic 'vip_price' => $params['vip_price'], 'cost' => $params['cost'], 'batch' => $params['batch'], - 'swap' => $params['swap']??0, + 'swap' => $params['swap'] ?? 0, - ]; + ]; - StoreProduct::where('id', $params['id'])->update($data); - $old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id') - ->select(); - - // 获取分类ID - foreach ($old_cate as $vv) { - $related_data = Db::name('store_product_cate')->where('cate_id', $vv['cate_id'])->select(); - //删除之前的分类 - foreach ($related_data as $value) { - if ($value['count'] == 1) { - self::deleteRelatedData($value['cate_id']); - } elseif ($value['count'] > 1) { - self::decreaseCount($value['cate_id']); + StoreProduct::where('id', $params['id'])->update($data); + $old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id') + ->select(); + StoreBranchProduct::where('product_id', $params['id']) + ->update([ + 'batch' => $params['batch'], 'price' => $params['price'], 'vip_price' => $params['vip_price'], 'cost' => $params['purchase'], 'store_name' => $params['store_name'], 'image' => $params['image'], 'bar_code' => $params['bar_code'] + ]); + // 获取分类ID + foreach ($old_cate as $vv) { + $related_data = Db::name('store_product_cate')->where('cate_id', $vv['cate_id'])->select(); + //删除之前的分类 + foreach ($related_data as $value) { + if ($value['count'] == 1) { + self::deleteRelatedData($value['cate_id']); + } elseif ($value['count'] > 1) { + self::decreaseCount($value['cate_id']); + } + //新增对应的分类 + self::updateGoodsclass($params['cate_id'], $value['store_id']); } - //新增对应的分类 - self::updateGoodsclass($params['cate_id'], $value['store_id']); } - } - //修改 - StoreBranchProduct::where('product_id', $params['id'])->update([ - 'price' => $params['price'], 'vip_price' => $params['vip_price'], - 'cost' => $params['cost'], 'cate_id' => $params['cate_id'] - ]); + //修改 + StoreBranchProduct::where('product_id', $params['id'])->update([ + 'price' => $params['price'], 'vip_price' => $params['vip_price'], + 'cost' => $params['cost'], 'cate_id' => $params['cate_id'] + ]); Db::commit(); - return true; + return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); From ab96b647efbcffd078732b3733bc20769290cc99 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 14:29:18 +0800 Subject: [PATCH 075/145] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=E4=BA=86?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=86=E6=94=AF=E5=95=86=E5=93=81=E7=9A=84?= =?UTF-8?q?=E5=86=97=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/store_product/StoreProductLogic.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 59f7c655f..dc7187270 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -157,10 +157,6 @@ class StoreProductLogic extends BaseLogic StoreProduct::where('id', $params['id'])->update($data); $old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id') ->select(); - StoreBranchProduct::where('product_id', $params['id']) - ->update([ - 'batch' => $params['batch'], 'price' => $params['price'], 'vip_price' => $params['vip_price'], 'cost' => $params['purchase'], 'store_name' => $params['store_name'], 'image' => $params['image'], 'bar_code' => $params['bar_code'] - ]); // 获取分类ID foreach ($old_cate as $vv) { $related_data = Db::name('store_product_cate')->where('cate_id', $vv['cate_id'])->select(); From eff0242d8fe8acb7db7ff025cffba3e52c6142e2 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 14:30:30 +0800 Subject: [PATCH 076/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E6=89=B9=E6=AC=A1=E7=9A=84=E5=95=86=E5=93=81=E6=9B=B4=E6=96=B0?= =?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/logic/store_product/StoreProductLogic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index dc7187270..72b3ad1ef 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -176,7 +176,8 @@ class StoreProductLogic extends BaseLogic //修改 StoreBranchProduct::where('product_id', $params['id'])->update([ 'price' => $params['price'], 'vip_price' => $params['vip_price'], - 'cost' => $params['cost'], 'cate_id' => $params['cate_id'] + 'cost' => $params['cost'], 'cate_id' => $params['cate_id'], + 'batch'=>$params['batch'] ]); Db::commit(); From 08c8de158b7cc0cf558ca446dba2d3e05742d4de Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 14:49:10 +0800 Subject: [PATCH 077/145] =?UTF-8?q?feat(user):=20=E4=BF=AE=E6=94=B9UserRec?= =?UTF-8?q?hargeController=E5=92=8CUserRechargeLists=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/user/UserRechargeController.php | 4 ++-- app/api/lists/user/UserRechargeLists.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/controller/user/UserRechargeController.php b/app/api/controller/user/UserRechargeController.php index 6ca86becf..ba97d6a54 100644 --- a/app/api/controller/user/UserRechargeController.php +++ b/app/api/controller/user/UserRechargeController.php @@ -6,7 +6,7 @@ use app\api\logic\user\UserFeedbackLogic; use app\admin\validate\user\UserFeedbackValidate; use app\api\controller\BaseApiController; - +use app\api\lists\user\UserRechargeLists; class UserRechargeController extends BaseApiController { @@ -19,6 +19,6 @@ */ public function lists() { - return $this->dataLists(new UserFeedbackLists()); + return $this->dataLists(new UserRechargeLists()); } } diff --git a/app/api/lists/user/UserRechargeLists.php b/app/api/lists/user/UserRechargeLists.php index 482cf821c..fcf0d396b 100644 --- a/app/api/lists/user/UserRechargeLists.php +++ b/app/api/lists/user/UserRechargeLists.php @@ -57,7 +57,7 @@ use app\common\model\user_recharge\UserRecharge; */ public function count(): int { - return UserFeedback::where($this->searchWhere)->count(); + return UserRecharge::where($this->searchWhere)->count(); } } \ No newline at end of file From 1432a29f05c6cf71c97ac954d5aaf58b79850062 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 14:55:33 +0800 Subject: [PATCH 078/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=85=85=E5=80=BC=E5=88=97=E8=A1=A8=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/user/UserRechargeLists.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/api/lists/user/UserRechargeLists.php b/app/api/lists/user/UserRechargeLists.php index fcf0d396b..2090f6420 100644 --- a/app/api/lists/user/UserRechargeLists.php +++ b/app/api/lists/user/UserRechargeLists.php @@ -42,8 +42,7 @@ use app\common\model\user_recharge\UserRecharge; ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ - $user = User::field('nickname')->where('id',$data['uid'])->findOrEmpty(); - $data['user_name'] = !$user->isEmpty() ? $user['nickname'] : ''; + $data['real_name'] =User::where('id',$data['uid'])->value('real_name'); }) ->toArray(); } From 9dde487cb9abadcab3512ca5dfecfc77b318b689 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 15:12:03 +0800 Subject: [PATCH 079/145] =?UTF-8?q?feat(order):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=AA=8C=E8=AF=81=E7=A0=81=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=B7=AF=E5=BE=84=E5=8F=8A=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E6=AC=BE=E4=B8=8D=E8=B6=B3=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 2 +- app/common/logic/PayNotifyLogic.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 5896de4e4..10b196451 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -194,7 +194,7 @@ class OrderLogic extends BaseLogic $generator = new BarcodeGeneratorPNG(); $barcode = $generator->getBarcode($verify_code, $generator::TYPE_CODE_128); $findPath = '/image/barcode/'.time().'.png'; - $savePath = 'public'.$findPath; + $savePath = public_path().$findPath; file_put_contents($savePath, $barcode); $_order['verify_img'] = $findPath; Db::startTrans(); diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index e51603b15..98556c7c2 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -97,7 +97,7 @@ class PayNotifyLogic extends BaseLogic public static function purchase_funds($orderSn, $extra = []) { $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); - $user = User::where('id', $extra['uid'])->find(); + $user = User::where('id', $order['uid'])->find(); if ($user['purchase_funds'] < $order['pay_price']) { throw new \Exception('采购款不足'); } From f1d5a04b46294e9e093a3dc42811d13c0dde8c5a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 15:27:22 +0800 Subject: [PATCH 080/145] =?UTF-8?q?feat(store=5Forder):=20=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=89=93=E5=8D=B0=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- app/common/logic/PayNotifyLogic.php | 9 ++--- .../store_order/StoreOrderController.php | 34 ++++++++++++++++++- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 575640412..ee1734d91 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .env /tests/tmp /tests/.phpunit.result.cache -public/uploads \ No newline at end of file +public/uploads +public/image \ No newline at end of file diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 98556c7c2..49e30112e 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -80,7 +80,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']); // self::afterPay($order); - Redis::send('push-platform-print', ['id' => $order['id']], 60); + // Redis::send('push-platform-print', ['id' => $order['id']], 60); PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } @@ -114,7 +114,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']); // self::afterPay($order); - Redis::send('push-platform-print', ['id' => $order['id']], 60); + // Redis::send('push-platform-print', ['id' => $order['id']], 60); PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } @@ -154,11 +154,11 @@ class PayNotifyLogic extends BaseLogic 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' => '您有一笔新的订单']); // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); } - Redis::send('push-platform-print', ['id' => $order['id']]); if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 5); } @@ -281,10 +281,11 @@ class PayNotifyLogic extends BaseLogic 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' => '您有一笔新的订单']); } - Redis::send('push-platform-print', ['id' => $order['id']]); return true; } diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index de727787f..206e34efc 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -15,7 +15,12 @@ use app\common\logic\PayNotifyLogic; use app\common\logic\SystemStoreStaffLogic; use app\store\controller\BaseAdminController; use app\common\logic\store_order\StoreOrderLogic; +use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_order\StoreOrder; +use app\common\model\store_order_cart_info\StoreOrderCartInfo; +use app\common\model\store_product_unit\StoreProductUnit; +use app\common\model\system_store\SystemStore; +use app\common\model\system_store\SystemStoreStaff; use app\common\model\user_recharge\UserRecharge; use app\store\validate\store_order\StoreOrderValidate; use support\Log; @@ -396,8 +401,35 @@ class StoreOrderController extends BaseAdminController }else{ return $this->fail('发送失败'); } + } - + /** + * 订单打印 + */ + public function print(){ + $id=$this->request->get('id'); + $find = StoreOrder::where('id', $id)->find(); + if ($find) { + $merchant = SystemStore::where('id', $find['store_id'])->field('name,phone')->find(); + $mer_user_info = SystemStoreStaff::where('store_id', $find['store_id'])->where('is_admin',1)->field('staff_name,phone')->find(); + $user = User::where('id', $find['uid'])->field('nickname,mobile')->find(); + $find['system_store_name'] = $merchant['name']; + $find['pay_type_name'] = PayEnum::getPaySceneDesc($find['pay_type']); + $find['system_store_phone'] = $merchant['phone']; + $find['staff_name'] = $mer_user_info['staff_name']; + $find['staff_phone'] = $mer_user_info['phone']; + $find['nickname'] = $user['nickname']??''; + $find['user_mobile'] = $user['mobile']??''; + $find['info'] = StoreOrderCartInfo::where('oid', $find['id'])->field('store_id,product_id,cart_num,cart_info')->select()->each(function ($item) { + $goods = StoreBranchProduct::where(['store_id'=>$item['store_id'],'product_id'=>$item['product_id']])->field('store_name,unit')->find(); + $item['unit_name'] = StoreProductUnit::where('id', $goods['unit'])->value('name'); + $item['store_name'] = $goods['store_name']; + $item['total_price'] = $item['cart_info']['total_price']; + $item['price'] = $item['cart_info']['price']; + return $item; + }); + } + return $this->success('获取成功', $find); } } From bc881d8e09f7937cbaa826de82a7670ed799aebb Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 15:27:43 +0800 Subject: [PATCH 081/145] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=92=8C=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E5=95=86=E5=93=81=E7=9A=84=E9=80=BB=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreBranchProductLists.php | 2 +- app/api/logic/order/OrderLogic.php | 15 +++++++++------ app/common/enum/UserShipEnum.php | 13 +++++++++---- app/queue/redis/StoreStorageSend.php | 4 +++- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php index a15a4e13a..cce4193a4 100644 --- a/app/admin/lists/store_branch_product/StoreBranchProductLists.php +++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php @@ -58,7 +58,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI } } return StoreBranchProduct::where($this->searchWhere)->where($where) - ->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost', 'status']) + ->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost','purchase', 'status']) ->when(!empty($this->adminInfo['store_id']), function ($query) { $query->where('store_id', $this->adminInfo['store_id']); }) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 5896de4e4..d87393fd9 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -66,30 +66,33 @@ class OrderLogic extends BaseLogic try { self::$total_price = 0; self::$pay_price = 0; - self::$cost = 0; //成本 + self::$cost = 0; //成本由采购价替代原成本为门店零售价 self::$profit = 0; //利润 self::$activity_price = 0; //活动减少 /** 计算价格 */ foreach ($cart_select as $k => $v) { - $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,product_id')->withTrashed()->find(); + $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id')->withTrashed()->find(); if (!$find) { continue; } unset($cart_select[$k]['id']); + if($user && in_array($user['user_ship'],UserShipEnum::DISCOUNT_ARRAY)){ + $find['price'] = $find['cost']; + } $cart_select[$k]['price'] = $find['price']; $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 if ($user && $user['user_ship'] == 4) { - $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); + $deduction_price_count=bcmul(bcsub($find['price'], $find['purchase'], 2),$v['cart_num'],2); $cart_select[$k]['deduction_price'] =$deduction_price_count; self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); } //利润 // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 - $cart_select[$k]['cost'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //成本 + $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额 $cart_select[$k]['product_id'] = $find['product_id']; $cart_select[$k]['old_cart_id'] = $v['id']; @@ -110,7 +113,7 @@ class OrderLogic extends BaseLogic $cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name'); self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2); self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2); - self::$cost = bcadd(self::$cost, $cart_select[$k]['cost'], 2); + self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2); // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 @@ -141,7 +144,7 @@ class OrderLogic extends BaseLogic if ($params['store_id']) { $order['default_delivery'] = SystemStore::where('id', $params['store_id'])->value('is_send'); } - if($user['user_ship']>=1 &&$user['user_ship']<=3){ + if($user && $user['user_ship']>=1 &&$user['user_ship']<=3){ $order['is_vip'] = 1; } diff --git a/app/common/enum/UserShipEnum.php b/app/common/enum/UserShipEnum.php index ea4b84ccf..772a54456 100644 --- a/app/common/enum/UserShipEnum.php +++ b/app/common/enum/UserShipEnum.php @@ -8,9 +8,14 @@ class UserShipEnum * 会员等级 */ const VIP1 = 1; - const VIP2 = 7; - const VIP3 = 8; - const VIP4 = 9; - const VIP5 = 10; + const VIP2 = 2; + const VIP3 = 3; + const VIP4 = 4; + const VIP5 = 5; + + /** + * 切换折扣价 + */ + const DISCOUNT_ARRAY = [4,5,6]; } \ No newline at end of file diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index f2069763c..3e755bd3c 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -56,7 +56,8 @@ class StoreStorageSend implements Consumer 'cate_id' => $find['cate_id'], 'price' => $find['price'], // 'cost' => $find['cost'], //v1.0 - 'cost' => $find['purchase'], + 'cost' => $find['cost'], + 'purchase' => $find['purchase'], 'vip_price' => $find['vip_price'], 'unit' => $find['unit'], 'batch' => $find['batch'], @@ -117,6 +118,7 @@ class StoreStorageSend implements Consumer 'cate_id' => $find['cate_id'], 'price' => $find['price'], 'cost' => $find['cost'], + 'purchase' => $find['purchase'], 'vip_price' => $find['vip_price'], 'unit' => $find['unit'], 'store_id' => $store_id, From 725dc922bf9ffe4ef4c87506bc2eea6c40c94930 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 15:32:36 +0800 Subject: [PATCH 082/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ee1734d91..a0a855bf2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ /tests/tmp /tests/.phpunit.result.cache public/uploads +public/image/barcode public/image \ No newline at end of file From 3ccaee48978507701facd57f8673f1d7883babfb Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 15:50:05 +0800 Subject: [PATCH 083/145] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/WorkbenchController.php | 11 +++++++++++ app/store/logic/WorkbenchLogic.php | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/app/store/controller/WorkbenchController.php b/app/store/controller/WorkbenchController.php index 3ca20e3cb..6617466ca 100644 --- a/app/store/controller/WorkbenchController.php +++ b/app/store/controller/WorkbenchController.php @@ -3,12 +3,14 @@ namespace app\store\controller; use app\common\controller\Definitions; +use app\common\model\dict\DictType; use app\store\lists\store_order\StoreOrderLists; use app\store\logic\WorkbenchLogic; // #[ApiDoc\Title('工作台')] class WorkbenchController extends BaseAdminController { + public $notNeedLogin = ['recharge_statistics']; // #[ // ApiDoc\Title('交易统计'), @@ -159,4 +161,13 @@ class WorkbenchController extends BaseAdminController $result = WorkbenchLogic::revenueStatistics($params); return $this->data($result); } + + + public function recharge_statistics() + { + $params['store_id'] = DictType::where('type','store')->value('remark')??5; + $result = WorkbenchLogic::rechargeData($params); + return $this->data($result); + + } } diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index 8f349359c..53aa4eec5 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -709,6 +709,14 @@ class WorkbenchLogic extends BaseLogic } + public static function rechargeData($params) + { + $data['receipt_amount'] = UserRecharge::where([ + 'store_id'=>$params['store_id'], + 'paid'=>YesNoEnum::YES + ])->sum('price'); + return $data??[]; + } From 5dc332ae0a8e92e71bd855e830e53bf41d29114f Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 15:56:26 +0800 Subject: [PATCH 084/145] =?UTF-8?q?feat(StoreOrderController):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=8E=B7=E5=8F=96=E6=88=90=E5=8A=9F=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/store_order/StoreOrderController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 206e34efc..692ee5a09 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -429,7 +429,8 @@ class StoreOrderController extends BaseAdminController return $item; }); } - return $this->success('获取成功', $find); + return $this->success('获取成功', $find?->toArray()); + } } From 7b6816aa80c84469ad4d2494abf5cdc80d9f72af Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 16:07:43 +0800 Subject: [PATCH 085/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/store_product/StoreProductLogic.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 72b3ad1ef..cfd50ef30 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -148,7 +148,6 @@ class StoreProductLogic extends BaseLogic 'is_return' => $params['is_return'], 'price' => $params['price'], 'vip_price' => $params['vip_price'], - 'cost' => $params['cost'], 'batch' => $params['batch'], 'swap' => $params['swap'] ?? 0, @@ -177,7 +176,7 @@ class StoreProductLogic extends BaseLogic StoreBranchProduct::where('product_id', $params['id'])->update([ 'price' => $params['price'], 'vip_price' => $params['vip_price'], 'cost' => $params['cost'], 'cate_id' => $params['cate_id'], - 'batch'=>$params['batch'] + 'batch'=>$params['batch'],'store_name'=>$params['store_name'] ]); Db::commit(); From a82e96e259cfc33b17e63e6d7a7a98851c889447 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 16:44:32 +0800 Subject: [PATCH 086/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=A7=AF=E5=88=86=E6=9F=A5=E8=AF=A2=E5=92=8C=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/user/UserLogic.php | 2 +- app/api/controller/store/StoreController.php | 17 ++++++++++---- app/api/logic/user/UserLogic.php | 2 +- app/common/logic/PayNotifyLogic.php | 23 ++++++++++--------- .../store_order/StoreOrderController.php | 6 ++--- app/store/lists/user/UserLists.php | 2 +- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index 894799e92..b2ea61dbd 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -147,7 +147,7 @@ class UserLogic extends BaseLogic public static function detail(int $userId): array { $field = [ - 'id', 'account', 'nickname', 'avatar', 'real_name', + 'id', 'account', 'nickname', 'avatar', 'real_name','integral', 'sex', 'mobile', 'create_time', 'login_time', 'channel','now_money','purchase_funds' ]; diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index c4368e496..4bb7e039a 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -24,15 +24,24 @@ class StoreController extends BaseApiController } + /** + * 门店信息 + */ public function detail() { $store_id = (int)$this->request->get('store_id'); - $where = [ - 'id' => $store_id - ]; + $phone = (int)$this->request->get('phone'); + $where = []; + if($phone){ + $where['phone'] = $phone; + } + if($store_id){ + $where['id'] = $store_id; + } + $info = StoreLogic::search($where); if ($info) { - return $this->data($info); + return $this->data($info?->toArray()); } else { return $this->fail('店铺不存在'); } diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 5ba8704c4..bdbd73512 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -68,7 +68,7 @@ class UserLogic extends BaseLogic { $data = User::with(['userShip'])->where('id',$uid) ->field('id,avatar,real_name,nickname,account,mobile,sex,login_ip,now_money,total_recharge_amount,user_ship - ,purchase_funds') + ,purchase_funds,integral') ->find(); //判断是不是员工 if($data){ diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 49e30112e..f73cbd930 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -81,7 +81,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']); // self::afterPay($order); // Redis::send('push-platform-print', ['id' => $order['id']], 60); - PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); + // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } @@ -115,7 +115,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']); // self::afterPay($order); // Redis::send('push-platform-print', ['id' => $order['id']], 60); - PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); + // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } /** @@ -153,12 +153,13 @@ class PayNotifyLogic extends BaseLogic 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]); + // 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' => '您有一笔新的订单']); + } + // else { + // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); - } + // } if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 5); } @@ -280,12 +281,12 @@ class PayNotifyLogic extends BaseLogic 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]); + // 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' => '您有一笔新的订单']); - } + } + // else { + // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); + // } return true; } diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 692ee5a09..b9f70c37b 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -183,12 +183,12 @@ class StoreOrderController extends BaseAdminController case PayEnum::PURCHASE_FUNDS: //采购款支付 PayNotifyLogic::handle('purchase_funds', $order['order_id'],['uid'=>$this->request->post('uid')]); - return $this->success('采购款支付成功',[],1,0); + return $this->success('采购款支付成功',['id'=>$order['id']]); case PayEnum::CASH_PAY: //现金支付 PayNotifyLogic::handle('cash_pay', $order['order_id']); - return $this->success('现金支付成功'); + return $this->success('现金支付成功',['id'=>$order['id']]); case PayEnum::WECHAT_PAY_BARCODE: //微信条码支付 @@ -250,7 +250,7 @@ class StoreOrderController extends BaseAdminController case PayEnum::CASH_PAY: //现金支付 PayNotifyLogic::handle('cash_pay', $order['order_id']); - return $this->success('现金支付成功'); + return $this->success('现金支付成功',['id'=>$order['id']]); break; case PayEnum::WECHAT_PAY_BARCODE: //微信条码支付 diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php index fb2746572..e410ceec3 100644 --- a/app/store/lists/user/UserLists.php +++ b/app/store/lists/user/UserLists.php @@ -38,7 +38,7 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface public function lists(): array { - $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds"; + $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds,integral"; $lists = User::where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) ->field($field) From adfd149e5dbdc73bd4f31f3770b6c296726d9372 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 16:46:08 +0800 Subject: [PATCH 087/145] =?UTF-8?q?feat(StoreController):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=BA=97=E9=93=BA=E6=90=9C=E7=B4=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=A0=BC=E5=BC=8F?= 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 4bb7e039a..2334ce3aa 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -41,7 +41,7 @@ class StoreController extends BaseApiController $info = StoreLogic::search($where); if ($info) { - return $this->data($info?->toArray()); + return $this->success('ok',$info?$info->toArray():[]); } else { return $this->fail('店铺不存在'); } From fdd8e762a43607da01a89771fb4a71a943d5aa62 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 16:50:41 +0800 Subject: [PATCH 088/145] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E8=B4=AD=E4=B9=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=BB=E8=BE=91=E6=9F=A5=E8=AF=A2=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 2a6503732..ccb309821 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -297,17 +297,16 @@ class OrderLogic extends BaseLogic public static function purchaseAgain($order_id) { - $arr = StoreOrderCartInfo::where('oid', $order_id)->field('product_id,cart_num,staff_id')->select(); + $arr = StoreOrderCartInfo::where('oid', $order_id)->field('product_id,cart_num,staff_id,store_id')->select(); $data = []; foreach ($arr as $k => $v) { $data[$k]['product_id'] = $v['product_id']; - $unique = StoreProductAttrValue::where('product_id', $v['product_id'])->value('v'); - $data[$k]['product_attr_unique'] = $unique; +// $unique = StoreProductAttrValue::where('product_id', $v['product_id'])->value('v'); + $data[$k]['product_attr_unique'] = ''; $data[$k]['cart_num'] = $v['cart_num']; $data[$k]['type'] = ''; $data[$k]['uid'] = Request()->userId; - $store_id = StoreProduct::where('id', $v['product_id'])->value('store_id'); - $data[$k]['store_id'] = $store_id; + $data[$k]['store_id'] = $v['store_id']; $data[$k]['staff_id'] = $v['staff_id']; $data[$k]['combination_id'] = 0; $data[$k]['seckill_id'] = 0; From 204e7f006d27ba942a805e0de3b6b21225292bc4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 17:06:25 +0800 Subject: [PATCH 089/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=A0=87=E7=AD=BE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user_label/UserLabelController.php | 95 +++++++++++++++++++ app/admin/lists/user_label/UserLabelLists.php | 65 +++++++++++++ app/admin/logic/user_label/UserLabelLogic.php | 94 ++++++++++++++++++ .../validate/user_label/UserLabelValidate.php | 84 ++++++++++++++++ app/api/controller/store/StoreController.php | 2 +- app/common/model/user_label/UserLabel.php | 22 +++++ 6 files changed, 361 insertions(+), 1 deletion(-) create mode 100644 app/admin/controller/user_label/UserLabelController.php create mode 100644 app/admin/lists/user_label/UserLabelLists.php create mode 100644 app/admin/logic/user_label/UserLabelLogic.php create mode 100644 app/admin/validate/user_label/UserLabelValidate.php create mode 100644 app/common/model/user_label/UserLabel.php diff --git a/app/admin/controller/user_label/UserLabelController.php b/app/admin/controller/user_label/UserLabelController.php new file mode 100644 index 000000000..b03673825 --- /dev/null +++ b/app/admin/controller/user_label/UserLabelController.php @@ -0,0 +1,95 @@ +dataLists(new UserLabelLists()); + } + + + /** + * @notes 添加用户标签 + * @return \think\response\Json + * @author admin + * @date 2024/06/17 17:02 + */ + public function add() + { + $params = (new UserLabelValidate())->post()->goCheck('add'); + $result = UserLabelLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(UserLabelLogic::getError()); + } + + + /** + * @notes 编辑用户标签 + * @return \think\response\Json + * @author admin + * @date 2024/06/17 17:02 + */ + public function edit() + { + $params = (new UserLabelValidate())->post()->goCheck('edit'); + $result = UserLabelLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(UserLabelLogic::getError()); + } + + + /** + * @notes 删除用户标签 + * @return \think\response\Json + * @author admin + * @date 2024/06/17 17:02 + */ + public function delete() + { + $params = (new UserLabelValidate())->post()->goCheck('delete'); + UserLabelLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取用户标签详情 + * @return \think\response\Json + * @author admin + * @date 2024/06/17 17:02 + */ + public function detail() + { + $params = (new UserLabelValidate())->goCheck('detail'); + $result = UserLabelLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/admin/lists/user_label/UserLabelLists.php b/app/admin/lists/user_label/UserLabelLists.php new file mode 100644 index 000000000..4e142b649 --- /dev/null +++ b/app/admin/lists/user_label/UserLabelLists.php @@ -0,0 +1,65 @@ + ['label_name'], + ]; + } + + + /** + * @notes 获取用户标签列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2024/06/17 17:02 + */ + public function lists(): array + { + return UserLabel::where($this->searchWhere) + ->field(['label_id', 'label_name']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['label_id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取用户标签数量 + * @return int + * @author admin + * @date 2024/06/17 17:02 + */ + public function count(): int + { + return UserLabel::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/admin/logic/user_label/UserLabelLogic.php b/app/admin/logic/user_label/UserLabelLogic.php new file mode 100644 index 000000000..d8a766b7c --- /dev/null +++ b/app/admin/logic/user_label/UserLabelLogic.php @@ -0,0 +1,94 @@ + $params['label_name'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑用户标签 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/17 17:02 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + UserLabel::where('label_id', $params['label_id'])->update([ + 'label_name' => $params['label_name'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除用户标签 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/17 17:02 + */ + public static function delete(array $params): bool + { + return UserLabel::destroy($params['label_id']); + } + + + /** + * @notes 获取用户标签详情 + * @param $params + * @return array + * @author admin + * @date 2024/06/17 17:02 + */ + public static function detail($params): array + { + return UserLabel::findOrEmpty($params['label_id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/admin/validate/user_label/UserLabelValidate.php b/app/admin/validate/user_label/UserLabelValidate.php new file mode 100644 index 000000000..2289e5630 --- /dev/null +++ b/app/admin/validate/user_label/UserLabelValidate.php @@ -0,0 +1,84 @@ + 'require', + 'label_name' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'label_id' => 'label_id', + 'label_name' => '标签名称', + ]; + + + /** + * @notes 添加场景 + * @return UserLabelValidate + * @author admin + * @date 2024/06/17 17:02 + */ + public function sceneAdd() + { + return $this->only(['label_name']); + } + + + /** + * @notes 编辑场景 + * @return UserLabelValidate + * @author admin + * @date 2024/06/17 17:02 + */ + public function sceneEdit() + { + return $this->only(['label_id','label_name']); + } + + + /** + * @notes 删除场景 + * @return UserLabelValidate + * @author admin + * @date 2024/06/17 17:02 + */ + public function sceneDelete() + { + return $this->only(['label_id']); + } + + + /** + * @notes 详情场景 + * @return UserLabelValidate + * @author admin + * @date 2024/06/17 17:02 + */ + public function sceneDetail() + { + return $this->only(['label_id']); + } + +} \ No newline at end of file diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 2334ce3aa..20e5a93a9 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -41,7 +41,7 @@ class StoreController extends BaseApiController $info = StoreLogic::search($where); if ($info) { - return $this->success('ok',$info?$info->toArray():[]); + return $this->success('ok',$info??[]); } else { return $this->fail('店铺不存在'); } diff --git a/app/common/model/user_label/UserLabel.php b/app/common/model/user_label/UserLabel.php new file mode 100644 index 000000000..adeb03be2 --- /dev/null +++ b/app/common/model/user_label/UserLabel.php @@ -0,0 +1,22 @@ + Date: Mon, 17 Jun 2024 17:37:55 +0800 Subject: [PATCH 090/145] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E6=A0=A1=E9=AA=8C?= =?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/store/controller/store_order/StoreOrderController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index b9f70c37b..e09ce0c47 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -136,13 +136,15 @@ class StoreOrderController extends BaseAdminController public function checkSms() { $params = (new StoreOrderValidate())->post()->goCheck('check'); - $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 $user= User::where('id',$params['uid'])->find(); if(empty($user)){ return $this->fail('无该用户请检查'); } $order = StoreOrderLogic::cartIdByOrderInfo($params['cart_id'], null, $user, $params); + if(!$order){ + return $this->fail(StoreOrderLogic::getError()); + } if($order['order']['pay_price'] > $user['purchase_funds']){ return $this->fail('当前用户采购款不足支付'); } From c0c61dd042049d69c63b9536d780dfd1c8ab908c Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 17:38:55 +0800 Subject: [PATCH 091/145] =?UTF-8?q?=E4=B8=8B=E5=8D=95=E6=97=B6=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E7=94=A8=E6=88=B7=E4=B8=BA=E5=BD=93=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=BA=E6=91=8A=E8=B4=A9/=E9=85=92=E5=BA=97/=E9=A3=9F?= =?UTF-8?q?=E5=A0=82=E6=97=B6,=E8=BF=94=E5=9B=9E=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index ccb309821..20fe8d784 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -47,6 +47,7 @@ class OrderLogic extends BaseLogic public static $pay_price; public static $cost; public static $profit; + public static $store_price;//门店零售价 public static $activity_price; /** @@ -69,6 +70,7 @@ class OrderLogic extends BaseLogic self::$cost = 0; //成本由采购价替代原成本为门店零售价 self::$profit = 0; //利润 self::$activity_price = 0; //活动减少 + self::$store_price = 0; //门店零售价 /** 计算价格 */ foreach ($cart_select as $k => $v) { @@ -77,11 +79,9 @@ class OrderLogic extends BaseLogic continue; } unset($cart_select[$k]['id']); - if($user && in_array($user['user_ship'],UserShipEnum::DISCOUNT_ARRAY)){ - $find['price'] = $find['cost']; - } $cart_select[$k]['price'] = $find['price']; + $cart_select[$k]['cost'] = $find['cost']; $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 @@ -94,6 +94,7 @@ class OrderLogic extends BaseLogic // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额 + $cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价 $cart_select[$k]['product_id'] = $find['product_id']; $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; @@ -114,9 +115,17 @@ class OrderLogic extends BaseLogic self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2); self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2); self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2); + self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } + $preferential_amount = 0;//差价(用户为UserShipEnum::DISCOUNT_ARRAY 的时候的优惠差价) + $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + if($user && in_array($user['user_ship'],UserShipEnum::DISCOUNT_ARRAY)){ + $pay_price =bcsub(self::$store_price, self::$activity_price, 2); //减去活动优惠金额 + $preferential_amount = bcsub(self::$pay_price,self::$store_price,2); + } + $vipPrice = 0; //成本价 收益 $order = [ @@ -138,6 +147,7 @@ class OrderLogic extends BaseLogic 'activities' => self::$activity_price>0?1:0, 'deduction_price' => self::$activity_price, 'is_vip' => 0, + 'preferential_amount' => $preferential_amount, ]; $order['default_delivery'] = 0; From e6bd6a937d86a42d6c3608bc2026ec91cf8ce49b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 17:45:34 +0800 Subject: [PATCH 092/145] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D=E4=BF=AE=E6=94=B9?= =?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/api/controller/store/StoreController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 20e5a93a9..97bd8068d 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -57,6 +57,9 @@ class StoreController extends BaseApiController $find=User::where('mobile',$params['mobile'])->find(); if(!$find){ $find=UserUserLogic::StoreAdd($params); + }else{ + $find['real_name']=$params['real_name']; + $find->save(); } $data=[ 'store_id'=>$params['store_id'], From 991dec0760d06c710ef6032bd5753184979d648e Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 17:53:59 +0800 Subject: [PATCH 093/145] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 20fe8d784..78dc82275 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -85,11 +85,11 @@ class OrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 - if ($user && $user['user_ship'] == 4) { - $deduction_price_count=bcmul(bcsub($find['price'], $find['purchase'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - } +// if ($user && $user['user_ship'] == 4) { +// $deduction_price_count=bcmul(bcsub($find['price'], $find['purchase'], 2),$v['cart_num'],2); +// $cart_select[$k]['deduction_price'] =$deduction_price_count; +// self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); +// } //利润 // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 From cb6ddb2dbb409e71728a88d75ab2b54d09b01b80 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 18:00:40 +0800 Subject: [PATCH 094/145] =?UTF-8?q?feat(user):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=A0=87=E7=AD=BEID=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=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 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index b2ea61dbd..e825dbe32 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -118,14 +118,15 @@ class UserLogic extends BaseLogic Db::startTrans(); try { User::where('id', $params['id'])->update([ - 'avatar' => $params['avatar'] ?? '', - 'real_name' => $params['real_name'], - 'nickname' => $params['nickname'], - 'account' => $params['account'], - 'password' => $params['password'] ?? '', - 'mobile' => $params['mobile'] ?? '', - 'sex' => $params['sex'] ?? 0, - 'is_disable' => $params['is_disable'] ?? 0, + // 'avatar' => $params['avatar'] ?? '', + // 'real_name' => $params['real_name'], + // 'nickname' => $params['nickname'], + // 'account' => $params['account'], + // 'password' => $params['password'] ?? '', + // 'mobile' => $params['mobile'] ?? '', + // 'sex' => $params['sex'] ?? 0, + // 'is_disable' => $params['is_disable'] ?? 0, + 'label_id'=>$params['label_id'] ]); Db::commit(); From 8d0d8ab603e47323a07977c89b256d2493a8b113 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 18:03:23 +0800 Subject: [PATCH 095/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=88=90=E5=8A=9F=E8=BF=94=E5=9B=9E=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=AE=A2=E5=8D=95id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/store_order/StoreOrderController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index e09ce0c47..024cb88af 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -205,7 +205,7 @@ class StoreOrderController extends BaseAdminController Redis::send('send-code-pay', ['order_id' => $order['order_id']]); return $this->success('用户支付中'); } - return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id'],'id'=>$order['id']]); case PayEnum::ALIPAY_BARCODE: //支付宝条码支付 $result = PaymentLogic::ali_auth_code($auth_code, $order); @@ -217,7 +217,7 @@ class StoreOrderController extends BaseAdminController } PayNotifyLogic::handle('alipay_cashier', $result['out_trade_no'], $result); $result['create_time'] = $order['create_time']; - return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no']]); + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no'],'id'=>$order['id']]); default: return $this->fail('支付方式错误'); } @@ -266,7 +266,7 @@ class StoreOrderController extends BaseAdminController Redis::send('send-code-pay', ['order_id' => $order['order_id']]); return $this->success('用户支付中'); } - return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id'],'id'=>$order['id']]); case PayEnum::ALIPAY_BARCODE: //支付宝条码支付 $result = PaymentLogic::ali_auth_code($auth_code, $order); @@ -279,7 +279,7 @@ class StoreOrderController extends BaseAdminController PayNotifyLogic::handle('alipay_cashier', $result['out_trade_no'], $result); $result['create_time'] = $order['create_time']; - return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no']]); + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no'],'id'=>$order['id']]); default: return $this->fail('支付方式错误'); } From d1e1c67978991d00c7cdbf79ad9b61e19b53e943 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 17 Jun 2024 18:11:18 +0800 Subject: [PATCH 096/145] =?UTF-8?q?=E5=95=86=E6=88=B7=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=97=B6=E7=9A=84=E7=94=A8=E6=88=B7id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/store_order/StoreOrderLogic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index e76081670..bf3c58cdc 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -49,7 +49,7 @@ class StoreOrderLogic extends BaseLogic /** 计算价格 */ foreach ($cart_select as $k => $v) { - $find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,price,cost,product_id')->find(); + $find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,price,cost,product_id')->withTrashed()->find(); if (!$find) { continue; } @@ -147,6 +147,7 @@ class StoreOrderLogic extends BaseLogic return false; } $_order = $orderInfo['order']; + $_order['uid'] = $user['id']??0; $_order['pay_type'] = $orderInfo['order']['pay_type']; $_order['verify_code'] = $verify_code; if (isset($params['reservation_time'])) { From 7d84388fc92babd740f06e9bad3a1d80316cf4d5 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 18:12:26 +0800 Subject: [PATCH 097/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/system_store_storage/SystemStoreStorageLists.php | 2 +- .../lists/system_store_storage/SystemStoreStorageLists.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/lists/system_store_storage/SystemStoreStorageLists.php b/app/admin/lists/system_store_storage/SystemStoreStorageLists.php index 900eb1e33..59cfcd955 100644 --- a/app/admin/lists/system_store_storage/SystemStoreStorageLists.php +++ b/app/admin/lists/system_store_storage/SystemStoreStorageLists.php @@ -29,7 +29,7 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI public function setSearch(): array { return [ - '=' => ['store_id', 'admin_id', 'staff_id', 'status'], + '=' => ['store_id', 'admin_id', 'staff_id', 'status','type'], ]; } diff --git a/app/store/lists/system_store_storage/SystemStoreStorageLists.php b/app/store/lists/system_store_storage/SystemStoreStorageLists.php index e2e94148c..c31918b02 100644 --- a/app/store/lists/system_store_storage/SystemStoreStorageLists.php +++ b/app/store/lists/system_store_storage/SystemStoreStorageLists.php @@ -29,7 +29,7 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI public function setSearch(): array { return [ - '=' => ['admin_id', 'staff_id', 'status'], + '=' => ['admin_id', 'staff_id', 'status','type'], ]; } From 30a6a404c68dc5b2b57b256c0f752b366e7f3c8e Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 18:17:19 +0800 Subject: [PATCH 098/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=BA=93=E5=AD=98=E5=88=9B=E5=BB=BA=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/queue/redis/StoreStorageSend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index 3e755bd3c..a291bd6a1 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -125,7 +125,7 @@ class StoreStorageSend implements Consumer 'sales' => 0, 'stock' => 0, ]; - StoreBranchProduct::create($product); + StoreBranchProductExchange::create($product); if ($product_arr['stock'] > 0) { $this->storage($find, $store_id, $admin_id, $product_arr); } From f050252966432a358dd9008965e34d90fd000110 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 19:02:13 +0800 Subject: [PATCH 099/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=8F=91=E9=80=81=E7=B1=BB=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E5=8F=82=E6=95=B01=E5=88=B0=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E6=96=B9=E6=B3=95=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/queue/redis/StoreStorageSend.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index a291bd6a1..d2cb8e0e4 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -90,7 +90,7 @@ class StoreStorageSend implements Consumer Db::startTrans(); try { if ($product_arr['stock'] > 0) { - $this->storage($find, $store_id, $admin_id, $product_arr); + $this->storage($find, $store_id, $admin_id, $product_arr,1); } Db::commit(); return true; @@ -141,7 +141,7 @@ class StoreStorageSend implements Consumer Db::startTrans(); try { if ($product_arr['stock'] > 0) { - $this->storage($find, $store_id, $admin_id, $product_arr); + $this->storage($find, $store_id, $admin_id, $product_arr,2); } Db::commit(); return true; From 6b2be63031f339bdd771ff695bb17253f7b619d8 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 19:45:17 +0800 Subject: [PATCH 100/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20config=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=92=8C=E6=9B=B4=E6=96=B0=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 14 +++++++++++++- app/common/logic/PayNotifyLogic.php | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index d3a680899..5bdbe8cc5 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -22,7 +22,7 @@ use Webman\RedisQueue\Redis; class IndexController extends BaseApiController { - public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street','village','brigade']; + public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street','village','brigade','config']; public function index() { @@ -180,5 +180,17 @@ class IndexController extends BaseApiController { $list = Db::name('geo_brigade')->select()?->toArray(); return $this->success('ok', $list); + } + + /** + * @notes 获取队列表 + */ + public function config() + { + $list=[ + 'store_id'=>5, + 'store_name'=>'测试', + ]; + return $this->success('ok', $list); } } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f73cbd930..cd156ec9e 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -330,11 +330,13 @@ class PayNotifyLogic extends BaseLogic $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']); //平台手续费 } } @@ -344,6 +346,7 @@ class PayNotifyLogic extends BaseLogic $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(); $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']); } From ba9ce8fdf126ae12446df26fb9585e20ff8f40c3 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 19:46:37 +0800 Subject: [PATCH 101/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E5=A5=96=E5=8A=B1=20village=5Fuid=20=E5=92=8C=20briga?= =?UTF-8?q?de=5Fuid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index cd156ec9e..9a4e21e80 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -362,10 +362,16 @@ class PayNotifyLogic extends BaseLogic $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid'); if ($arr1) { $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); + if($village_uid){ + User::where('id', $village_uid)->inc('integral', $fees)->update(); + } } $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); if ($arr2) { $brigade_uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); + if($brigade_uid){ + User::where('id', $brigade_uid)->inc('integral', $fees)->update(); + } } } } From 4c1a07e5987299445f6693c12c60e9b982a21550 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 19:51:13 +0800 Subject: [PATCH 102/145] =?UTF-8?q?feat(IndexController):=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0IndexController=E4=BB=A5=E6=94=AF=E6=8C=81=E6=96=B0?= =?UTF-8?q?=E7=9A=84API=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 5bdbe8cc5..c3014c879 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -188,7 +188,7 @@ class IndexController extends BaseApiController public function config() { $list=[ - 'store_id'=>5, + 'id'=>5, 'store_name'=>'测试', ]; return $this->success('ok', $list); From d43d26163feb9a732cf5a3905242937eea88b199 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 17 Jun 2024 20:08:38 +0800 Subject: [PATCH 103/145] =?UTF-8?q?feat(process):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=A4=84=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/process.php | 3 +++ process/Task.php | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 process/Task.php diff --git a/config/process.php b/config/process.php index fc6af1ffb..916875cc3 100644 --- a/config/process.php +++ b/config/process.php @@ -40,4 +40,7 @@ return [ ] ] ], + 'task' => [ + 'handler' => process\Task::class + ], ]; diff --git a/process/Task.php b/process/Task.php new file mode 100644 index 000000000..fa0e66504 --- /dev/null +++ b/process/Task.php @@ -0,0 +1,22 @@ +0]; + $where[]=['create_time','<',time() - 600];// 10分钟前创建的订单 + // 删除10分钟未支付的订单 + StoreOrder::where($where)->update(['delete_time'=>time()]); // 删除时间设置为当前时间,即删除 + }); + + + } +} \ No newline at end of file From e5336610ead2d9f6592d1d67ff4d939eb8911a69 Mon Sep 17 00:00:00 2001 From: liuchaofu <1873441552@qq.com> Date: Mon, 17 Jun 2024 21:33:42 +0800 Subject: [PATCH 104/145] =?UTF-8?q?vip=E7=AD=89=E7=BA=A7=E4=B8=BA1?= =?UTF-8?q?=E6=97=B6=E5=8A=A0=E5=85=A5=E5=86=BB=E7=BB=93=E9=87=91=E9=A2=9D?= =?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 | 7 +- app/common/logic/PayNotifyLogic.php | 4 + app/common/logic/VipLogic.php | 183 ++++++++++++++++++++++++++++ 3 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 app/common/logic/VipLogic.php diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 78dc82275..1728473f1 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -99,12 +99,13 @@ class OrderLogic extends BaseLogic $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; - + //vip1待返回金额 + + $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],2); +// d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] ); $cartInfo = $cart_select[$k]; $cartInfo['name'] = $find['store_name']; $cartInfo['image'] = $find['image']; - - $cartInfo['vip_price'] = 0; //$cart_select[$k]['total'] - $vipPrice ?? 0; $cart_select[$k]['cart_info'] = json_encode($cartInfo); $cart_select[$k]['branch_product_id'] = $find['branch_product_id']; //理论上每笔都是拆分了 diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 9a4e21e80..5b2b3ab5e 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -113,6 +113,10 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']); + if($user['user_ship'] == 1){ + VipLogic::dealVipAmount($order,PayEnum::PURCHASE_FUNDS); + } + // 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' => '您有一笔新的订单']); diff --git a/app/common/logic/VipLogic.php b/app/common/logic/VipLogic.php new file mode 100644 index 000000000..d47b95051 --- /dev/null +++ b/app/common/logic/VipLogic.php @@ -0,0 +1,183 @@ +select()->toArray(); + $total_vip = 0; + foreach ($detail as $value){ + $total_vip +=$value['cart_info']['vip_frozen_price']; + } + $data=[ + 'order_id' => $order['id'], + 'transaction_id' => $transaction_id??0, + 'order_sn' =>$order['order_id'], + 'user_id' => $order['uid'], +// 'financial_type' => $financialType, + '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); + //todo 限制执行 +// self::afterPay($order,$transaction_id,$total_vip); + return true; + } + + + + + + + + public static function afterPay($order, $transaction_id = 0,$Vipmoney=0) + { + $financeLogic = new StoreFinanceFlowLogic(); + $financeLogic->order = $order; + $financeLogic->user = ['uid' => $order['uid']]; + + $financeLogic->in($transaction_id, $Vipmoney, OrderEnum::USER_ORDER_PAY); //用户订单支付 + $count_frees = 0; + + //平台手续费 + $fees = bcdiv(bcmul($Vipmoney, '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($Vipmoney, '0.05', 2), 1, 2); + $count_frees = bcadd($count_frees, $store_profit, 2); + if ($deposit > 0) { + if ($deposit > $store_profit) { + if ($store_profit > 0) { + $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } + } else { + $money = bcsub($store_profit, $deposit, 2); + if ($deposit > 0) { + $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']; + $fees = bcdiv(bcmul($Vipmoney, '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(); + $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($Vipmoney, '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) { + $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); + if($village_uid){ + User::where('id', $village_uid)->inc('integral', $fees)->update(); + } + } + $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); + if ($arr2) { + $brigade_uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); + if($brigade_uid){ + User::where('id', $brigade_uid)->inc('integral', $fees)->update(); + } + } + } + } + if ($fees > 0) { + //村长获得 + $sing=[]; + $user_sing=new UserSign(); + + $sing[]=[ + 'uid'=>$village_uid, + 'title'=>'村长订单获得兑换券', + 'store_id'=>$order['store_id'], + 'number'=>$fees, + ]; + $sing[]=[ + 'uid'=>$brigade_uid, + 'title'=>'队长订单获得兑换券', + 'store_id'=>$order['store_id'], + 'number'=>$fees, + ]; + // if ($village_uid > 0) { + // $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) { + // $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($Vipmoney, $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(); + + } + + +} \ No newline at end of file From 4292c803013337352a977fd388a400b1c5969d3b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 09:21:17 +0800 Subject: [PATCH 105/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=E4=BB=A5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=96=B0=E7=9A=84=E7=94=A8=E6=88=B7=E7=AD=BE=E5=88=B0?= =?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/common/logic/PayNotifyLogic.php | 56 ++++++++++++++++------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 9a4e21e80..ebc034de2 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -155,10 +155,10 @@ class PayNotifyLogic extends BaseLogic $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' => '您有一笔新的订单']); - // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); + // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); + // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); // } if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 5); @@ -276,14 +276,13 @@ class PayNotifyLogic extends BaseLogic if ($order->pay_type == 9) { $order->status = 2; self::afterPay($order); - } 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' => '您有一笔新的订单']); // } @@ -298,6 +297,8 @@ class PayNotifyLogic extends BaseLogic public static function afterPay($order, $transaction_id = 0) { $financeLogic = new StoreFinanceFlowLogic(); + $user_sing = new UserSign(); + $financeLogic->order = $order; $financeLogic->user = ['uid' => $order['uid']]; // if ($order->pay_type != 9 || $order->pay_type != 10) { @@ -305,6 +306,15 @@ class PayNotifyLogic extends BaseLogic $count_frees = 0; //商户应该获得的钱 每个商品的price-ot_price 利润 // if (isset($order->profit) && $order->profit > 0) { + if($order['uid']>0){ + $sing = [ + 'uid' => $order['uid'], + 'title' => '购买商品获得兑换券', + 'store_id' => $order['store_id'], + 'number' => bcmul($order['pay_price'], '0.01', 2), + ]; + $user_sing->save($sing); + } //平台手续费 $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); @@ -362,14 +372,14 @@ class PayNotifyLogic extends BaseLogic $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid'); if ($arr1) { $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); - if($village_uid){ + if ($village_uid) { User::where('id', $village_uid)->inc('integral', $fees)->update(); } } $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); if ($arr2) { $brigade_uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); - if($brigade_uid){ + if ($brigade_uid) { User::where('id', $brigade_uid)->inc('integral', $fees)->update(); } } @@ -377,23 +387,22 @@ class PayNotifyLogic extends BaseLogic } if ($fees > 0) { //村长获得 - $sing=[]; - $user_sing=new UserSign(); + $sing = []; - $sing[]=[ - 'uid'=>$village_uid, - 'title'=>'村长订单获得兑换券', - 'store_id'=>$order['store_id'], - 'number'=>$fees, + $sing[] = [ + 'uid' => $village_uid, + 'title' => '村长订单获得兑换券', + 'store_id' => $order['store_id'], + 'number' => $fees, ]; - $sing[]=[ - 'uid'=>$brigade_uid, - 'title'=>'队长订单获得兑换券', - 'store_id'=>$order['store_id'], - 'number'=>$fees, + $sing[] = [ + 'uid' => $brigade_uid, + 'title' => '队长订单获得兑换券', + 'store_id' => $order['store_id'], + 'number' => $fees, ]; // if ($village_uid > 0) { - // $financeLogic->other_arr['vip_uid'] = $village_uid; + // $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']); @@ -410,14 +419,13 @@ class PayNotifyLogic extends BaseLogic $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); + $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->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(); // } } From c8d20b33d6126b60d56a0b107d455fe64ee45db3 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 09:37:01 +0800 Subject: [PATCH 106/145] =?UTF-8?q?feat(user):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=BC=96=E8=BE=91=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=94=AF=E4=BB=98=E9=80=9A=E7=9F=A5=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/admin/controller/user/UserController.php | 3 ++- app/common/logic/PayNotifyLogic.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/admin/controller/user/UserController.php b/app/admin/controller/user/UserController.php index 2b55bb1f6..b2046e788 100644 --- a/app/admin/controller/user/UserController.php +++ b/app/admin/controller/user/UserController.php @@ -57,7 +57,8 @@ class UserController extends BaseAdminController */ public function edit() { - $params = (new UserValidate())->post()->goCheck('edit'); + // $params = (new UserValidate())->post()->goCheck('edit'); + $params = $this->request->post(); $result = UserLogic::edit($params); if (true === $result) { return $this->success('编辑成功', [], 1, 1); diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 24c1a74e1..b5ca18a3e 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -306,7 +306,7 @@ class PayNotifyLogic extends BaseLogic $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); //用户订单支付 + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY,$order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 $count_frees = 0; //商户应该获得的钱 每个商品的price-ot_price 利润 // if (isset($order->profit) && $order->profit > 0) { From 5091d0a6bb25d17d7cdddc139a8bdbd6a55cdd1e Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 09:44:13 +0800 Subject: [PATCH 107/145] =?UTF-8?q?=E6=94=B6=E9=93=B6=E6=9C=BA=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=B0=8F=E7=A8=8B=E5=BA=8F=E9=87=87=E8=B4=AD=E6=AC=BE?= =?UTF-8?q?=E6=94=AF=E4=BB=98vip=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/store_order/StoreOrderLogic.php | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index bf3c58cdc..78eb61cf4 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -4,6 +4,7 @@ namespace app\common\logic\store_order; use app\common\enum\OrderEnum; use app\common\enum\PayEnum; +use app\common\enum\UserShipEnum; use app\common\logic\BaseLogic; use app\common\enum\YesNoEnum; use app\common\model\dict\DictType; @@ -25,6 +26,7 @@ class StoreOrderLogic extends BaseLogic public static $pay_price; public static $cost; public static $profit; + public static $store_price;//门店零售价 public static $activity_price; /** * @notes 获取购物车商品信息 @@ -46,32 +48,37 @@ class StoreOrderLogic extends BaseLogic self::$cost = 0; //成本 self::$profit = 0; //利润 self::$activity_price = 0; //活动减少 - + self::$store_price = 0; //门店零售价 /** 计算价格 */ foreach ($cart_select as $k => $v) { - $find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,price,cost,product_id')->withTrashed()->find(); + $find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id')->withTrashed()->find(); if (!$find) { continue; } unset($cart_select[$k]['id']); $cart_select[$k]['price'] = $find['price']; + $cart_select[$k]['cost'] = $find['cost']; $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 - if ($user && $user['user_ship'] == 4) { - $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - } +// if ($user && $user['user_ship'] == 4) { +// $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); +// $cart_select[$k]['deduction_price'] =$deduction_price_count; +// self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); +// } //利润 // $cart_select[$k]['profit'] = bcmul($cart_select[$k]['total_price'],0.05,2); //利润 - $cart_select[$k]['cost'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //成本 + $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额 + $cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价 $cart_select[$k]['product_id'] = $find['product_id']; $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; + //vip1待返回金额 + + $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],2); $cartInfo = $cart_select[$k]; $cartInfo['name'] = $find['store_name']; $cartInfo['image'] = $find['image']; @@ -80,7 +87,7 @@ class StoreOrderLogic extends BaseLogic // if ($vipPrice) { // $cartInfo['price'] = $vipPrice; // } - $cartInfo['vip_price'] = 0;//$cart_select[$k]['total'] - $vipPrice ?? 0; + //$cart_select[$k]['total'] - $vipPrice ?? 0; $cart_select[$k]['cart_info'] = json_encode($cartInfo); $cart_select[$k]['branch_product_id'] = $find['branch_product_id']; //理论上每笔都是拆分了 @@ -91,10 +98,16 @@ class StoreOrderLogic extends BaseLogic self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2); self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2); self::$cost = bcadd(self::$cost, $cart_select[$k]['cost'], 2); + self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - //TODO 收单打9.9折 会员按照比例打折 等级按照充值去升级 - $pay_price = bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + $preferential_amount = 0;//差价(用户为UserShipEnum::DISCOUNT_ARRAY 的时候的优惠差价) + + $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + if($user && in_array($user['user_ship'],UserShipEnum::DISCOUNT_ARRAY)){ + $pay_price =bcsub(self::$store_price, self::$activity_price, 2); //减去活动优惠金额 + $preferential_amount = bcsub(self::$pay_price,self::$store_price,2); + } $vipPrice = 0; //成本价 收益 $order = [ @@ -116,12 +129,11 @@ class StoreOrderLogic extends BaseLogic 'activities' => self::$activity_price>0?1:0, 'default_delivery'=>1, 'original_price'=>self::$total_price, - 'deduction_price' => self::$activity_price + 'deduction_price' => self::$activity_price, + 'preferential_amount' => $preferential_amount, ]; - if($user){ - if($user['user_ship']!=4){ - $order['is_vip']=1; - } + if($user && $user['user_ship']!=4){ + $order['is_vip']=1; } } catch (\Exception $e) { From 7d622b150ebe515ffa6f0e2a88ad1fd9a7f2fc63 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 09:47:03 +0800 Subject: [PATCH 108/145] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/store_order/StoreOrderLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 78eb61cf4..d0c11d7bf 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -172,7 +172,7 @@ class StoreOrderLogic extends BaseLogic $goods_list = $orderInfo['cart_list']; foreach ($goods_list as $k => $v) { $goods_list[$k]['oid'] = $order['id']; - $goods_list[$k]['uid'] = 0; + $goods_list[$k]['uid'] = $user['id']??0; $goods_list[$k]['cart_id'] = implode(',', $cartId); $goods_list[$k]['delivery_id'] = $params['store_id']; //商家id $stock = StoreBranchProduct::where('id',$v['branch_product_id'])->value('stock'); From 92c20a157049125b0f20766fef02a2be456ea298 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 09:53:59 +0800 Subject: [PATCH 109/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95ID=E5=88=B0=E6=94=AF=E4=BB=98=E9=80=9A=E7=9F=A5?= =?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/common/logic/PayNotifyLogic.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index b5ca18a3e..29c96ba69 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -313,6 +313,7 @@ class PayNotifyLogic extends BaseLogic if($order['uid']>0){ $sing = [ 'uid' => $order['uid'], + 'order_id' => $order['order_id'], 'title' => '购买商品获得兑换券', 'store_id' => $order['store_id'], 'number' => bcmul($order['pay_price'], '0.01', 2), @@ -395,12 +396,14 @@ class PayNotifyLogic extends BaseLogic $sing[] = [ 'uid' => $village_uid, + 'order_id' => $order['order_id'], 'title' => '村长订单获得兑换券', 'store_id' => $order['store_id'], 'number' => $fees, ]; $sing[] = [ 'uid' => $brigade_uid, + 'order_id' => $order['order_id'], 'title' => '队长订单获得兑换券', 'store_id' => $order['store_id'], 'number' => $fees, From 5768afd77a14dce12da6d7bd8336d0c1febb5180 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 09:56:32 +0800 Subject: [PATCH 110/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9PayNotifyLogi?= =?UTF-8?q?c=E4=BB=A5=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E7=A7=AF?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 29c96ba69..48a0c0a6d 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -311,14 +311,16 @@ class PayNotifyLogic extends BaseLogic //商户应该获得的钱 每个商品的price-ot_price 利润 // if (isset($order->profit) && $order->profit > 0) { if($order['uid']>0){ + $user_number=bcmul($order['pay_price'], '0.01', 2); $sing = [ 'uid' => $order['uid'], 'order_id' => $order['order_id'], 'title' => '购买商品获得兑换券', 'store_id' => $order['store_id'], - 'number' => bcmul($order['pay_price'], '0.01', 2), + 'number' =>$user_number, ]; $user_sing->save($sing); + User::where('id', $order['uid'])->inc('integral', $user_number)->update(); } //平台手续费 From fe86e652ce77c86a1c59779bfa0fd8a0803682ee Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 10:06:41 +0800 Subject: [PATCH 111/145] =?UTF-8?q?=E5=BA=97=E9=93=BA=E7=AB=AF=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE=E9=80=BB=E8=BE=91?= =?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/store/logic/WorkbenchLogic.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index 53aa4eec5..a0b9934ee 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -44,23 +44,21 @@ class WorkbenchLogic extends BaseLogic public static function index($params) { $data = []; - $startTime = $params['start_time']; - $endTime = $params['end_time']; - $endTime = date('Y-m-d', strtotime($endTime) + 86400); - $dateDiff = (new \DateTime($endTime))->diff(new \DateTime($startTime)); + $startTimeDefault = date('Y-m-d',time()); + $endTimeDefault =date('Y-m-d', strtotime($startTimeDefault) + 86400); $orderLogic = new StoreOrderLogic(); //订单总金额 - $data['order_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTime, $endTime); + $data['order_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTimeDefault, $endTimeDefault); //余额支付总金额 - $data['balance_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTime, $endTime, ['pay_type' => PayEnum::BALANCE_PAY]); + $data['balance_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTimeDefault, $endTimeDefault, ['pay_type' => PayEnum::BALANCE_PAY]); //线下收银总金额 - $data['cashier_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTime, $endTime, ['shipping_type' => 3]); + $data['cashier_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTimeDefault, $endTimeDefault, ['shipping_type' => 3]); //现金收银总金额 - $data['cash_amount'] = StoreCashFinanceFlow::where('store_id', $params['store_id'])->whereBetweenTime('create_time', $startTime, $endTime)->sum('cash_price'); + $data['cash_amount'] = StoreCashFinanceFlow::where('store_id', $params['store_id'])->whereBetweenTime('create_time', $startTimeDefault, $endTimeDefault)->sum('cash_price'); //核销订单金额 - $data['verify_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTime, $endTime, ['shipping_type' => 2]); + $data['verify_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTimeDefault, $endTimeDefault, ['shipping_type' => 2]); //门店收益金额 - $data['income_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTime, $endTime, [], 'profit'); + $data['income_amount'] = $orderLogic->storeOrderSumByDate($params['store_id'], $startTimeDefault, $endTimeDefault, [], 'profit'); //门店收款金额 $data['receipt_amount'] = UserRecharge::where([ 'store_id'=>$params['store_id'], @@ -69,9 +67,14 @@ class WorkbenchLogic extends BaseLogic //门店成交用户数 $data['user_number'] = StoreOrder::where('store_id', $params['store_id']) ->where('paid', 1) - ->whereBetweenTime('pay_time', $startTime, $endTime) + ->whereBetweenTime('pay_time', $startTimeDefault, $endTimeDefault) ->group('uid') ->count(); + + $startTime = $params['start_time']; + $endTime = $params['end_time']; + $endTime = date('Y-m-d', strtotime($endTime) + 86400); + $dateDiff = (new \DateTime($endTime))->diff(new \DateTime($startTime)); if ($dateDiff->days == 1) { $group = 'HOUR(pay_time)'; $i = 0; From a08d9ff06701a48c41212cbb436de126485798a2 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 10:12:36 +0800 Subject: [PATCH 112/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=92=8C=E8=AE=A2=E5=8D=95=E7=9B=B8=E5=85=B3=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/admin/logic/user/UserLogic.php | 4 +- .../store_order/StoreOrderController.php | 144 +++++++----------- 2 files changed, 53 insertions(+), 95 deletions(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index e825dbe32..46b7033c4 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -77,7 +77,7 @@ class UserLogic extends BaseLogic try { $data=[ 'avatar' => $avatar, - 'real_name' =>'', + 'real_name' => $params['real_name']??"", 'nickname' => '用户'.time(), 'account' => $params['mobile'], 'password' => $password, @@ -88,7 +88,7 @@ class UserLogic extends BaseLogic $res=User::create($data); UserAddress::create([ 'uid' => $res['id'], - 'real_name' => $data['nickname'], + 'real_name' => $params['real_name']??"", 'mobile' => $params['mobile'], 'province' => $params['province'], 'city' => $params['city'], diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 024cb88af..ba689ab31 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -35,41 +35,7 @@ use Webman\RedisQueue\Redis; class StoreOrderController extends BaseAdminController { - // #[ - // ApiDoc\Title('订单列表'), - // ApiDoc\url('/store/store_order/storeOrder/lists'), - // ApiDoc\Method('GET'), - // ApiDoc\NotHeaders(), - // ApiDoc\Author('中国队长'), - // ApiDoc\Query(name: 'order_id', type: 'string', require: false, desc: '订单编号'), - // ApiDoc\Query(name: 'staff_id', type: 'int', require: false, desc: '店员id'), - // ApiDoc\Query(name: 'delivery_phone', type: 'int', require: false, desc: '配送员手机号'), - // ApiDoc\Query(name: 'shipping_type', type: 'int', require: false, desc: '订单配送方式:1配送订单,2核销订单,3收银台订单'), - // ApiDoc\Query(name: 'start_time', type: 'string', require: false, desc: '开始时间'), - // ApiDoc\Query(name: 'end_time', type: 'string', require: false, desc: '结束时间'), - // ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:-1待支付,0待发货,1待收货,2已完成'), - // ApiDoc\Header(ref: [Definitions::class, "token"]), - // ApiDoc\Query(ref: [Definitions::class, "page"]), - // ApiDoc\ResponseSuccess("data", type: "array", children: [ - // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - // ['name' => 'order_id', 'desc' => '订单编号', 'type' => 'string'], - // ['name' => 'pay_price', 'desc' => '支付金额', 'type' => 'string'], - // ['name' => 'pay_time', 'desc' => '支付时间', 'type' => 'float'], - // ['name' => 'pay_type', 'desc' => '支付方式', 'type' => 'float'], - // ['name' => 'status_name', 'desc' => '状态', 'type' => 'int'], - // ['name' => 'staff_name', 'desc' => '店员', 'type' => 'int'], - // ['name' => 'nickname', 'desc' => '用户昵称', 'type' => 'string'], - // ['name' => 'avatar', 'desc' => '用户头像', 'type' => 'string'], - // ['name' => 'product', 'desc' => '商品信息', 'type' => 'array', 'children' => [ - // ['name' => 'cart_info', 'desc' => '商品信息', 'type' => 'array', 'children' => [ - // ['name' => 'name', 'desc' => '商品名称', 'type' => 'int'], - // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - // ['name' => 'cart_num', 'desc' => '购买数量', 'type' => 'string'], - // ['name' => 'price', 'desc' => '单价', 'type' => 'string'], - // ]], - // ]], - // ]), - // ] + /**订单列表 */ public function lists() { return $this->dataLists(new StoreOrderLists()); @@ -98,17 +64,9 @@ class StoreOrderController extends BaseAdminController ]); } - // #[ - // ApiDoc\Title('订单详情'), - // ApiDoc\url('/store/store_order/storeOrder/detail'), - // ApiDoc\Method('GET'), - // ApiDoc\NotHeaders(), - // ApiDoc\Author('中国队长'), - // ApiDoc\Header(ref: [Definitions::class, "token"]), - // ApiDoc\Query(name: 'id', type: 'int', require: false, desc: '订单id'), - // ApiDoc\Query(name: 'verify_code', type: 'string', require: false, desc: '核销码'), - // ApiDoc\ResponseSuccess("data", type: "array"), - // ] + /** + * 订单详情 + */ public function detail(StoreOrderLogic $orderLogic) { $params = (new StoreOrderValidate())->goCheck('detail'); @@ -116,11 +74,14 @@ class StoreOrderController extends BaseAdminController return $this->data($result); } + /** + * 订单检查 + */ public function checkOrder() { $cartId = (array)$this->request->post('cart_id', []); $params = $this->request->post(); - $params['store_id']=$this->adminInfo['store_id']; + $params['store_id'] = $this->adminInfo['store_id']; $res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, null, $params); if ($res == false) { $msg = StoreOrderLogic::getError(); @@ -137,24 +98,23 @@ class StoreOrderController extends BaseAdminController { $params = (new StoreOrderValidate())->post()->goCheck('check'); $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 - $user= User::where('id',$params['uid'])->find(); - if(empty($user)){ + $user = User::where('id', $params['uid'])->find(); + if (empty($user)) { return $this->fail('无该用户请检查'); } $order = StoreOrderLogic::cartIdByOrderInfo($params['cart_id'], null, $user, $params); - if(!$order){ + if (!$order) { return $this->fail(StoreOrderLogic::getError()); } - if($order['order']['pay_price'] > $user['purchase_funds']){ + if ($order['order']['pay_price'] > $user['purchase_funds']) { return $this->fail('当前用户采购款不足支付'); } $res = (new StoreOrderLogic())->dealSendSms($params); - if($res){ - return $this->success('发送成功',[],1,0); - }else{ + if ($res) { + return $this->success('发送成功', [], 1, 0); + } else { return $this->fail('发送失败'); } - } @@ -175,8 +135,8 @@ class StoreOrderController extends BaseAdminController return $this->fail('购物车商品不能超过100个'); } $user = null; - if($pay_type == PayEnum::PURCHASE_FUNDS){ - $user = User::where('id',$this->request->post('uid'))->find(); + if ($pay_type == PayEnum::PURCHASE_FUNDS) { + $user = User::where('id', $this->request->post('uid'))->find(); } $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 $order = StoreOrderLogic::createOrder($cartId, $addressId, $user, $params); @@ -184,13 +144,13 @@ class StoreOrderController extends BaseAdminController switch ($pay_type) { case PayEnum::PURCHASE_FUNDS: //采购款支付 - PayNotifyLogic::handle('purchase_funds', $order['order_id'],['uid'=>$this->request->post('uid')]); - return $this->success('采购款支付成功',['id'=>$order['id']]); + PayNotifyLogic::handle('purchase_funds', $order['order_id'], ['uid' => $this->request->post('uid')]); + return $this->success('采购款支付成功', ['id' => $order['id']]); case PayEnum::CASH_PAY: //现金支付 PayNotifyLogic::handle('cash_pay', $order['order_id']); - return $this->success('现金支付成功',['id'=>$order['id']]); + return $this->success('现金支付成功', ['id' => $order['id']]); case PayEnum::WECHAT_PAY_BARCODE: //微信条码支付 @@ -205,7 +165,7 @@ class StoreOrderController extends BaseAdminController Redis::send('send-code-pay', ['order_id' => $order['order_id']]); return $this->success('用户支付中'); } - return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id'],'id'=>$order['id']]); + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id'], 'id' => $order['id']]); case PayEnum::ALIPAY_BARCODE: //支付宝条码支付 $result = PaymentLogic::ali_auth_code($auth_code, $order); @@ -217,7 +177,7 @@ class StoreOrderController extends BaseAdminController } PayNotifyLogic::handle('alipay_cashier', $result['out_trade_no'], $result); $result['create_time'] = $order['create_time']; - return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no'],'id'=>$order['id']]); + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no'], 'id' => $order['id']]); default: return $this->fail('支付方式错误'); } @@ -252,7 +212,7 @@ class StoreOrderController extends BaseAdminController case PayEnum::CASH_PAY: //现金支付 PayNotifyLogic::handle('cash_pay', $order['order_id']); - return $this->success('现金支付成功',['id'=>$order['id']]); + return $this->success('现金支付成功', ['id' => $order['id']]); break; case PayEnum::WECHAT_PAY_BARCODE: //微信条码支付 @@ -266,7 +226,7 @@ class StoreOrderController extends BaseAdminController Redis::send('send-code-pay', ['order_id' => $order['order_id']]); return $this->success('用户支付中'); } - return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id'],'id'=>$order['id']]); + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id'], 'id' => $order['id']]); case PayEnum::ALIPAY_BARCODE: //支付宝条码支付 $result = PaymentLogic::ali_auth_code($auth_code, $order); @@ -279,7 +239,7 @@ class StoreOrderController extends BaseAdminController PayNotifyLogic::handle('alipay_cashier', $result['out_trade_no'], $result); $result['create_time'] = $order['create_time']; - return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no'],'id'=>$order['id']]); + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no'], 'id' => $order['id']]); default: return $this->fail('支付方式错误'); } @@ -296,8 +256,8 @@ class StoreOrderController extends BaseAdminController if (empty($count)) { return $this->fail('无该核销码请检查'); } - $params['store_id']=$this->adminInfo['store_id']; - $params['staff_id']=$this->adminId; + $params['store_id'] = $this->adminInfo['store_id']; + $params['staff_id'] = $this->adminId; $res = OrderLogic::writeOff($params); if ($res) { return $this->success('核销成功'); @@ -328,17 +288,16 @@ class StoreOrderController extends BaseAdminController $params['page_no'] = 1; $params['page_size'] = 15; } - $params['store_id'] =$this->request->adminInfo['store_id']; + $params['store_id'] = $this->request->adminInfo['store_id']; $result = $orderLogic->writeList($params); $data = [ 'lists' => $result, 'count' => count($result), 'page_no' => $params['page_no'], - 'page_size' =>$params['page_size'], + 'page_size' => $params['page_size'], ]; - return $this->success('ok',$data); - + return $this->success('ok', $data); } /** * vip充值 @@ -351,16 +310,16 @@ class StoreOrderController extends BaseAdminController return $this->fail('支付条码不能为空'); } $params = $this->request->post(); - $data=[ - 'store_id'=>$this->adminInfo['store_id'], - 'uid'=>$params['uid'], - 'staff_id'=>$this->adminId, - 'order_id'=>getNewOrderId('CZ'), - 'price'=>$params['price'], - 'recharge_type'=>'INDUSTRYMEMBERS', + $data = [ + 'store_id' => $this->adminInfo['store_id'], + 'uid' => $params['uid'], + 'staff_id' => $this->adminId, + 'order_id' => getNewOrderId('CZ'), + 'price' => $params['price'], + 'recharge_type' => 'INDUSTRYMEMBERS', ]; $order = UserRecharge::create($data); - $order['pay_price']=$order['price']; + $order['pay_price'] = $order['price']; switch ($pay_type) { case PayEnum::WECHAT_PAY_BARCODE: //微信条码支付 @@ -371,7 +330,7 @@ class StoreOrderController extends BaseAdminController if (isset($result['trade_state_desc']) && $result['trade_state_desc'] == '支付成功') { PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result); } else { - Redis::send('send-code-pay', ['order_id' => $order['order_id'],'pay_type'=>'recharge']); + Redis::send('send-code-pay', ['order_id' => $order['order_id'], 'pay_type' => 'recharge']); return $this->success('用户支付中'); } return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); @@ -384,7 +343,7 @@ class StoreOrderController extends BaseAdminController if ($result['msg'] !== 'Success') { return $this->success('用户支付中'); } - PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result,'ali'); + PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result, 'ali'); $result['create_time'] = $order['create_time']; return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::ALIPAY_BARCODE, 'transaction_id' => $result['trade_no']]); @@ -397,10 +356,10 @@ class StoreOrderController extends BaseAdminController public function stocking() { $uid = $this->request->post('uid'); - $res = (new StoreOrderLogic())->dealSendSms(['uid'=>$uid],1); - if($res){ - return $this->success('发送成功',[],0,1); - }else{ + $res = (new StoreOrderLogic())->dealSendSms(['uid' => $uid], 1); + if ($res) { + return $this->success('发送成功', [], 0, 1); + } else { return $this->fail('发送失败'); } } @@ -408,22 +367,23 @@ class StoreOrderController extends BaseAdminController /** * 订单打印 */ - public function print(){ - $id=$this->request->get('id'); + public function print() + { + $id = $this->request->get('id'); $find = StoreOrder::where('id', $id)->find(); if ($find) { $merchant = SystemStore::where('id', $find['store_id'])->field('name,phone')->find(); - $mer_user_info = SystemStoreStaff::where('store_id', $find['store_id'])->where('is_admin',1)->field('staff_name,phone')->find(); + $mer_user_info = SystemStoreStaff::where('store_id', $find['store_id'])->where('is_admin', 1)->field('staff_name,phone')->find(); $user = User::where('id', $find['uid'])->field('nickname,mobile')->find(); $find['system_store_name'] = $merchant['name']; $find['pay_type_name'] = PayEnum::getPaySceneDesc($find['pay_type']); $find['system_store_phone'] = $merchant['phone']; $find['staff_name'] = $mer_user_info['staff_name']; $find['staff_phone'] = $mer_user_info['phone']; - $find['nickname'] = $user['nickname']??''; - $find['user_mobile'] = $user['mobile']??''; + $find['nickname'] = $user['nickname'] ?? ''; + $find['user_mobile'] = $user['mobile'] ?? ''; $find['info'] = StoreOrderCartInfo::where('oid', $find['id'])->field('store_id,product_id,cart_num,cart_info')->select()->each(function ($item) { - $goods = StoreBranchProduct::where(['store_id'=>$item['store_id'],'product_id'=>$item['product_id']])->field('store_name,unit')->find(); + $goods = StoreBranchProduct::where(['store_id' => $item['store_id'], 'product_id' => $item['product_id']])->field('store_name,unit')->find(); $item['unit_name'] = StoreProductUnit::where('id', $goods['unit'])->value('name'); $item['store_name'] = $goods['store_name']; $item['total_price'] = $item['cart_info']['total_price']; @@ -432,7 +392,5 @@ class StoreOrderController extends BaseAdminController }); } return $this->success('获取成功', $find?->toArray()); - } - } From 1c6cb9b1a5881947256bcce2f100aac5270a37fb Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 10:16:02 +0800 Subject: [PATCH 113/145] =?UTF-8?q?refactor(PayNotifyLogic):=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E6=94=AF=E4=BB=98=E7=B1=BB=E5=9E=8B=E4=B8=BA9?= =?UTF-8?q?=E7=9A=84=E8=AE=A2=E5=8D=95=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 48a0c0a6d..fe735a893 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -155,11 +155,11 @@ class PayNotifyLogic extends BaseLogic } - if ($order->pay_type == 9) { - $extra['create_time'] = $order['create_time']; + // 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']]); - } + // Redis::send('push-platform-print', ['id' => $order['id']]); + // } // else { // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); @@ -251,7 +251,7 @@ class PayNotifyLogic extends BaseLogic } $cashFlowLogic = new CashFlowLogic(); $cashFlowLogic->insert($order['store_id'], $order['pay_price']); - Redis::send('push-platform-print', ['id' => $order['id']]); + // Redis::send('push-platform-print', ['id' => $order['id']]); } /** @@ -282,11 +282,11 @@ class PayNotifyLogic extends BaseLogic self::afterPay($order); } - if ($order->pay_type == 9) { - $extra['create_time'] = $order['create_time']; + // 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']]); - } + // Redis::send('push-platform-print', ['id' => $order['id']]); + // } // else { // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); // } From 7cf53797553dffe00de468d0741dcdf0855c81f2 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 10:18:01 +0800 Subject: [PATCH 114/145] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=AC=BE=E6=94=B6=E9=93=B6=E6=94=AF=E4=BB=98=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/enum/PayEnum.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/common/enum/PayEnum.php b/app/common/enum/PayEnum.php index 99786c428..7cf6e2364 100644 --- a/app/common/enum/PayEnum.php +++ b/app/common/enum/PayEnum.php @@ -100,6 +100,7 @@ class PayEnum self::ALIPAY_QRCODE => '支付宝二维码', self::ALIPAY_BARCODE => '支付宝条码', self::BALANCE_PAY => '余额支付', + self::PURCHASE_FUNDS => '采购款收银', ]; if ($value === true) { From ac9eb17056811cf9c3ecf56ec286b23a5aebd17a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 10:44:00 +0800 Subject: [PATCH 115/145] =?UTF-8?q?feat(store=5Forder):=20=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E6=94=AF=E4=BB=98=E7=B1=BB=E5=9E=8B=E5=92=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7ID=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/store_order/StoreOrderController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index ba689ab31..639433742 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -127,6 +127,7 @@ class StoreOrderController extends BaseAdminController $pay_type = (int)$this->request->post('pay_type'); $addressId = (int)$this->request->post('address_id'); $auth_code = $this->request->post('auth_code'); //微信支付条码 + $uid=$this->request->post('uid'); $params = $this->request->post(); if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY && $pay_type != PayEnum::PURCHASE_FUNDS) { return $this->fail('支付条码不能为空'); @@ -135,8 +136,8 @@ class StoreOrderController extends BaseAdminController return $this->fail('购物车商品不能超过100个'); } $user = null; - if ($pay_type == PayEnum::PURCHASE_FUNDS) { - $user = User::where('id', $this->request->post('uid'))->find(); + if ($uid) { + $user = User::where('id', $uid)->find(); } $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 $order = StoreOrderLogic::createOrder($cartId, $addressId, $user, $params); @@ -144,7 +145,7 @@ class StoreOrderController extends BaseAdminController switch ($pay_type) { case PayEnum::PURCHASE_FUNDS: //采购款支付 - PayNotifyLogic::handle('purchase_funds', $order['order_id'], ['uid' => $this->request->post('uid')]); + PayNotifyLogic::handle('purchase_funds', $order['order_id'], ['uid' => $uid]); return $this->success('采购款支付成功', ['id' => $order['id']]); case PayEnum::CASH_PAY: From b5b364a3d1f5b3ef1cfe2ed0d4a1b4fb9ddae558 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 10:46:18 +0800 Subject: [PATCH 116/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9PayNotifyLogi?= =?UTF-8?q?c=E7=B1=BB=E4=BB=A5=E6=AD=A3=E7=A1=AE=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=A9=E6=B6=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index fe735a893..090909fa7 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -311,7 +311,7 @@ class PayNotifyLogic extends BaseLogic //商户应该获得的钱 每个商品的price-ot_price 利润 // if (isset($order->profit) && $order->profit > 0) { if($order['uid']>0){ - $user_number=bcmul($order['pay_price'], '0.01', 2); + $user_number=bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], 'order_id' => $order['order_id'], From a546ddd3532078d71cfb3aa8ad916819ece251eb Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 10:47:26 +0800 Subject: [PATCH 117/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E7=9B=88=E6=94=B6=E7=BB=9F=E8=AE=A1=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=92=8C=E6=94=B6=E9=93=B6=E5=8F=B0=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E5=90=8E=E9=BB=98=E8=AE=A4=E4=B8=BA=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/CashFlowLogic.php | 2 ++ app/store/logic/WorkbenchLogic.php | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/common/logic/CashFlowLogic.php b/app/common/logic/CashFlowLogic.php index 9a1d06004..4f0a39bdd 100644 --- a/app/common/logic/CashFlowLogic.php +++ b/app/common/logic/CashFlowLogic.php @@ -2,6 +2,7 @@ namespace app\common\logic; +use app\common\enum\YesNoEnum; use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow; class CashFlowLogic extends BaseLogic @@ -13,6 +14,7 @@ class CashFlowLogic extends BaseLogic $model->store_id = $storeId; $model->cash_price = $amount; $model->receivable = $amount; + $model->status = YesNoEnum::YES;//收银台收了默认算完成了 $model->save(); } diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index a0b9934ee..701840ded 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -548,24 +548,27 @@ class WorkbenchLogic extends BaseLogic public static function revenueStatistics($params) { - //当日营业额的统计 当日利润的统计 当日成本合集的统计 当日加到保证金的 当日的现金收银 + //当日营业额的统计 $today = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]); $turnover_today = $today ->whereDay('create_time') ->sum('pay_price'); + //当日利润的统计 $profit_today = $today ->whereDay('create_time') ->sum('profit'); + //当日成本合集的统计 $cost_today = $today ->whereDay('create_time') ->sum('cost'); - $deposit = StoreFinanceFlow::where(['store_id'=>$params['store_id']]) + //当日加到保证金的 + $deposit = StoreFinanceFlow::where(['store_id'=>$params['store_id'],'status'=>YesNoEnum::YES]) ->where('financial_type',OrderEnum::ORDER_MARGIN); $deposit_today =$deposit ->whereDay('create_time') ->sum('number'); - + //当日的现金收银 $cash_today = StoreCashFinanceFlow::where('store_id',$params['store_id']) ->whereDay('create_time') ->where('status',YesNoEnum::YES) @@ -574,8 +577,8 @@ class WorkbenchLogic extends BaseLogic //总的营业额的统计 总的利润的统计 总的成本合集的统计 总的加到保证金的 $all = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]); - $deposit_all = SystemStore::where('id',$params['store_id']) - ->value('paid_deposit'); + $deposit_all = StoreFinanceFlow::where(['store_id'=>$params['store_id'],'status'=>YesNoEnum::YES]) + ->sum('number'); $cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id']) ->where('status',YesNoEnum::YES) From c9750921f1b5ba088f0b8db444a8f26a15087da7 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 11:16:48 +0800 Subject: [PATCH 118/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/logic/WorkbenchLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index 701840ded..06902ee1d 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -572,7 +572,7 @@ class WorkbenchLogic extends BaseLogic $cash_today = StoreCashFinanceFlow::where('store_id',$params['store_id']) ->whereDay('create_time') ->where('status',YesNoEnum::YES) - ->sum('receipts'); + ->sum('receivable'); //总的营业额的统计 总的利润的统计 总的成本合集的统计 总的加到保证金的 $all = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]); @@ -593,7 +593,7 @@ class WorkbenchLogic extends BaseLogic $cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id']) ->where('status',YesNoEnum::YES) ->whereMonth('create_time', $params['month']) - ->sum('receipts'); + ->sum('receivable'); } $turnover_all = $all ->sum('pay_price'); From 4b686647c4655e5095da73d45b3f513dd6c8d081 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 11:29:08 +0800 Subject: [PATCH 119/145] =?UTF-8?q?feat(StoreOrderController):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=87=87=E8=B4=AD=E6=AC=BE=E6=94=AF=E4=BB=98=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/validate/user/UserValidate.php | 2 +- app/common/logic/PayNotifyLogic.php | 158 +++++++++--------- .../store_order/StoreOrderController.php | 6 +- 3 files changed, 84 insertions(+), 82 deletions(-) diff --git a/app/admin/validate/user/UserValidate.php b/app/admin/validate/user/UserValidate.php index ef36fbb7f..90911234c 100644 --- a/app/admin/validate/user/UserValidate.php +++ b/app/admin/validate/user/UserValidate.php @@ -24,7 +24,7 @@ class UserValidate extends BaseValidate 'nickname' => 'require', 'account' => 'require', 'password' => 'require', - 'mobile' => 'require|mobile', + 'mobile' => 'require|unique:user', 'is_disable' => 'in:0,1', 'sex' => 'in:1,2', 'province' => 'require', diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 090909fa7..0db3235b4 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -113,8 +113,8 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']); - if($user['user_ship'] == 1){ - VipLogic::dealVipAmount($order,PayEnum::PURCHASE_FUNDS); + if ($user['user_ship'] == 1) { + VipLogic::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); } // self::afterPay($order); @@ -156,8 +156,8 @@ class PayNotifyLogic extends BaseLogic // 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]); + // $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 { @@ -283,9 +283,9 @@ class PayNotifyLogic extends BaseLogic } // 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']]); + // $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' => '您有一笔新的订单']); @@ -306,18 +306,18 @@ class PayNotifyLogic extends BaseLogic $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']); //用户订单支付 + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 $count_frees = 0; //商户应该获得的钱 每个商品的price-ot_price 利润 // if (isset($order->profit) && $order->profit > 0) { - if($order['uid']>0){ - $user_number=bcmul($order['pay_price'], '0.10', 2); + if ($order['uid'] > 0) { + $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], 'order_id' => $order['order_id'], 'title' => '购买商品获得兑换券', 'store_id' => $order['store_id'], - 'number' =>$user_number, + 'number' => $user_number, ]; $user_sing->save($sing); User::where('id', $order['uid'])->inc('integral', $user_number)->update(); @@ -357,77 +357,77 @@ class PayNotifyLogic extends BaseLogic $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']; - $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(); - $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) { - $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); - if ($village_uid) { - User::where('id', $village_uid)->inc('integral', $fees)->update(); - } - } - $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); - if ($arr2) { - $brigade_uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); - if ($brigade_uid) { - User::where('id', $brigade_uid)->inc('integral', $fees)->update(); - } - } - } - } + // if ($order['is_vip'] >= 1) { + if ($order['spread_uid'] > 0) { + $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; + $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); + $count_frees = bcadd($count_frees, $fees, 2); if ($fees > 0) { - //村长获得 - $sing = []; - - $sing[] = [ - 'uid' => $village_uid, - 'order_id' => $order['order_id'], - 'title' => '村长订单获得兑换券', - 'store_id' => $order['store_id'], - 'number' => $fees, - ]; - $sing[] = [ - 'uid' => $brigade_uid, - 'order_id' => $order['order_id'], - 'title' => '队长订单获得兑换券', - 'store_id' => $order['store_id'], - 'number' => $fees, - ]; - // if ($village_uid > 0) { - // $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) { - // $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']); + User::where('id', $order['spread_uid'])->inc('now_money', $fees)->update(); + $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) { + $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); + if ($village_uid) { + User::where('id', $village_uid)->inc('integral', $fees)->update(); + } + } + $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); + if ($arr2) { + $brigade_uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); + if ($brigade_uid) { + User::where('id', $brigade_uid)->inc('integral', $fees)->update(); + } + } + } + } + if ($fees > 0) { + //村长获得 + $sing = []; + + $sing[] = [ + 'uid' => $village_uid, + 'order_id' => $order['order_id'], + 'title' => '村长订单获得兑换券', + 'store_id' => $order['store_id'], + 'number' => $fees, + ]; + $sing[] = [ + 'uid' => $brigade_uid, + 'order_id' => $order['order_id'], + 'title' => '队长订单获得兑换券', + 'store_id' => $order['store_id'], + 'number' => $fees, + ]; + // if ($village_uid > 0) { + // $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) { + // $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) { diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 639433742..d4213a31a 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -207,9 +207,11 @@ class StoreOrderController extends BaseAdminController if (!$order) { return $this->fail('订单不存在或已支付'); } - switch ($pay_type) { - + case PayEnum::PURCHASE_FUNDS: + //采购款支付 + PayNotifyLogic::handle('purchase_funds', $order['order_id'], ['uid' => $order['uid']]); + return $this->success('采购款支付成功', ['id' => $order['id']]); case PayEnum::CASH_PAY: //现金支付 PayNotifyLogic::handle('cash_pay', $order['order_id']); From 84d056bfaf2e3254614be193d0226e5512c1888b Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 11:45:09 +0800 Subject: [PATCH 120/145] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=E4=BB=A5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 0db3235b4..a6da7a402 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -378,16 +378,18 @@ class PayNotifyLogic extends BaseLogic if ($address) { $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid'); if ($arr1) { - $village_uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); - if ($village_uid) { - User::where('id', $village_uid)->inc('integral', $fees)->update(); + $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) { - $brigade_uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); - if ($brigade_uid) { - User::where('id', $brigade_uid)->inc('integral', $fees)->update(); + $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; } } } From b67259a91effae1134fc97128cfc30c823337ecf Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 11:49:53 +0800 Subject: [PATCH 121/145] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BD=99=E9=A2=9D=E6=94=AF=E4=BB=98=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=B5=81=E6=B0=B4=E8=AE=B0=E5=BD=95=E9=80=BB=E8=BE=91?= =?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/enum/OrderEnum.php | 4 ++++ app/common/logic/CapitalFlowLogic.php | 14 ++++++++------ app/common/logic/PayNotifyLogic.php | 6 +++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index f22c9d32c..8a5ca32e1 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -132,6 +132,10 @@ class OrderEnum const REFUND_STATUS_FINISH = 2; const CANCEL_SALE = 3; + //判断资金流水是否余额支付 + const BALANCE_PAYMEN_NO = 1; + + /** * @notes 获取支付类型 * @param bool $value diff --git a/app/common/logic/CapitalFlowLogic.php b/app/common/logic/CapitalFlowLogic.php index e8ac3a513..fd12bb687 100644 --- a/app/common/logic/CapitalFlowLogic.php +++ b/app/common/logic/CapitalFlowLogic.php @@ -2,6 +2,7 @@ namespace app\common\logic; +use app\common\enum\OrderEnum; use app\common\model\finance\CapitalFlow; class CapitalFlowLogic extends BaseLogic @@ -55,21 +56,22 @@ class CapitalFlowLogic extends BaseLogic * @param $mark * @return mixed */ - public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0) + public function userExpense($store_id=0,$category, $linkType, $linkId, $amount, $mark = '',$payType=0) { $model = new CapitalFlow(); $model->uid = $this->user['id']; $model->category = $category; + $model->store_id = $store_id; $model->link_type = $linkType; $model->link_id = $linkId; $model->amount = $amount; - // if($payType == 1){ + if($payType == OrderEnum::BALANCE_PAYMEN_NO){ $model->before_balance = $this->user['now_money']; $model->balance = $this->user['now_money']; - // }else{ - // $model->before_balance = $this->user['now_money']; - // $model->balance = bcsub($this->user['now_money'], $amount, 2); - // } + }else{ + $model->before_balance = $this->user['now_money']; + $model->balance = bcsub($this->user['now_money'], $amount, 2); + } $model->create_time = date('Y-m-d H:i:s'); $model->type = 'out'; $model->title = $this->getTitle($category, $amount); diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index a6da7a402..bfe287bb9 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -78,7 +78,7 @@ class PayNotifyLogic extends BaseLogic $user->save(); $capitalFlowDao = new CapitalFlowLogic($user); - $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']); + $capitalFlowDao->userExpense($order['store_id'],'user_order_pay', 'order', $order['id'], $order['pay_price']); // self::afterPay($order); // Redis::send('push-platform-print', ['id' => $order['id']], 60); // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); @@ -112,7 +112,7 @@ class PayNotifyLogic extends BaseLogic $user->save(); $capitalFlowDao = new CapitalFlowLogic($user); - $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']); + $capitalFlowDao->userExpense($order['store_id'],'user_order_purchase_pay', 'order', $order['id'], $order['pay_price'],'',1); if ($user['user_ship'] == 1) { VipLogic::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); } @@ -151,7 +151,7 @@ class PayNotifyLogic extends BaseLogic } else { $capitalFlowDao = new CapitalFlowLogic($user); //微信支付和用户余额无关 - $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1); + $capitalFlowDao->userExpense($order['store_id'],'user_order_pay', 'order', $order['id'], $order->pay_price, '', 1); } From 79e89fa22ddb3ac76d231bb3b1d8e10cdad73e25 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 12:10:21 +0800 Subject: [PATCH 122/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E5=92=8C=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7=E4=BD=99=E9=A2=9D?= =?UTF-8?q?=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/CapitalFlowLogic.php | 3 ++- app/common/logic/PayNotifyLogic.php | 6 +++--- app/store/logic/WorkbenchLogic.php | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/common/logic/CapitalFlowLogic.php b/app/common/logic/CapitalFlowLogic.php index fd12bb687..d2c7ab918 100644 --- a/app/common/logic/CapitalFlowLogic.php +++ b/app/common/logic/CapitalFlowLogic.php @@ -50,13 +50,14 @@ class CapitalFlowLogic extends BaseLogic /** * 用户支出 * @param $category + * @param $store_id * @param $linkType * @param $linkId * @param $amount * @param $mark * @return mixed */ - public function userExpense($store_id=0,$category, $linkType, $linkId, $amount, $mark = '',$payType=0) + public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0,$store_id=0,) { $model = new CapitalFlow(); $model->uid = $this->user['id']; diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index bfe287bb9..a9c5d72c0 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -78,7 +78,7 @@ class PayNotifyLogic extends BaseLogic $user->save(); $capitalFlowDao = new CapitalFlowLogic($user); - $capitalFlowDao->userExpense($order['store_id'],'user_order_pay', 'order', $order['id'], $order['pay_price']); + $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price'],'',0,$order['store_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' => '您有一笔新的订单']); @@ -112,7 +112,7 @@ class PayNotifyLogic extends BaseLogic $user->save(); $capitalFlowDao = new CapitalFlowLogic($user); - $capitalFlowDao->userExpense($order['store_id'],'user_order_purchase_pay', 'order', $order['id'], $order['pay_price'],'',1); + $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price'],'',1,$order['store_id']); if ($user['user_ship'] == 1) { VipLogic::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); } @@ -151,7 +151,7 @@ class PayNotifyLogic extends BaseLogic } else { $capitalFlowDao = new CapitalFlowLogic($user); //微信支付和用户余额无关 - $capitalFlowDao->userExpense($order['store_id'],'user_order_pay', 'order', $order['id'], $order->pay_price, '', 1); + $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1,$order['store_id']); } diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index 06902ee1d..ea4e9de58 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -21,6 +21,7 @@ use app\common\enum\YesNoEnum; use app\common\logic\BaseLogic; use app\common\logic\store_order\StoreOrderLogic; use app\common\logic\StoreFinanceFlowLogic; +use app\common\model\finance\CapitalFlow; use app\common\model\order\Cart; use app\common\model\store_cash_finance_flow\StoreCashFinanceFlow; use app\common\model\store_finance_flow\StoreFinanceFlow; @@ -582,7 +583,7 @@ class WorkbenchLogic extends BaseLogic $cash_all = StoreCashFinanceFlow::where('store_id',$params['store_id']) ->where('status',YesNoEnum::YES) - ->sum('receipts'); + ->sum('receivable'); if(isset($params['month']) && $params['month']){ $all = StoreOrder::where(['paid'=>YesNoEnum::YES,'store_id'=>$params['store_id']]) ->whereMonth('create_time', $params['month']) @@ -599,11 +600,10 @@ class WorkbenchLogic extends BaseLogic ->sum('pay_price'); $profit_all = $all ->sum('profit'); - $cost_all = $all - ->sum('cost'); - - - + //消耗余额 V2.0 + $cost_all = CapitalFlow:: + where(['category'=>'user_order_balance_pay','store_id'=>$params['store_id']]) + ->sum('amount'); $time = self::getLastSevenDays(); $newArr = []; From 325014ee992d36c3fab7f66e58250b1ab2ab8f2a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 15:01:36 +0800 Subject: [PATCH 123/145] =?UTF-8?q?feat(user):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=A0=87=E7=AD=BE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/user/UserLogic.php | 4 ++- .../logic/store_order/StoreOrderLogic.php | 21 +++++-------- app/store/controller/user/UserController.php | 8 +++++ .../controller/user/UserLabelController.php | 30 +++++++++++++++++++ 4 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 app/store/controller/user/UserLabelController.php diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index 46b7033c4..ff86b002b 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -19,6 +19,7 @@ use app\common\model\store_finance_flow\StoreFinanceFlow; use app\common\model\user\User; use app\common\model\user\UserAddress; use app\common\model\user\UserRecharge; +use app\common\model\user_label\UserLabel; use think\facade\Db; use app\common\service\FileService; use Webman\Config; @@ -148,7 +149,7 @@ class UserLogic extends BaseLogic public static function detail(int $userId): array { $field = [ - 'id', 'account', 'nickname', 'avatar', 'real_name','integral', + 'id', 'account', 'nickname', 'avatar', 'real_name','integral','label_id', 'sex', 'mobile', 'create_time', 'login_time', 'channel','now_money','purchase_funds' ]; @@ -158,6 +159,7 @@ class UserLogic extends BaseLogic $user['channel'] = UserTerminalEnum::getTermInalDesc($user['channel']); $user->sex = $user->getData('sex'); $user['number']=StoreFinanceFlow::where('other_uid',$userId)->where(['status'=>0,'financial_pm'=>1,'type'=>1])->sum('number'); + $user['label_name']=$user->label_id?UserLabel::where('label_id',$user->label_id)->value('label_name'):""; return $user->toArray(); } diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index d0c11d7bf..bbb40ea62 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -62,11 +62,11 @@ class StoreOrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 -// if ($user && $user['user_ship'] == 4) { -// $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); -// $cart_select[$k]['deduction_price'] =$deduction_price_count; -// self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); -// } + if ($user && $user['user_ship'] == 4) { + $deduction_price_count=bcmul(bcsub($find['price'], $find['purchase'], 2),$v['cart_num'],2); + $cart_select[$k]['deduction_price'] =$deduction_price_count; + self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + } //利润 // $cart_select[$k]['profit'] = bcmul($cart_select[$k]['total_price'],0.05,2); //利润 $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 @@ -101,13 +101,9 @@ class StoreOrderLogic extends BaseLogic self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - $preferential_amount = 0;//差价(用户为UserShipEnum::DISCOUNT_ARRAY 的时候的优惠差价) $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 - if($user && in_array($user['user_ship'],UserShipEnum::DISCOUNT_ARRAY)){ - $pay_price =bcsub(self::$store_price, self::$activity_price, 2); //减去活动优惠金额 - $preferential_amount = bcsub(self::$pay_price,self::$store_price,2); - } + $vipPrice = 0; //成本价 收益 $order = [ @@ -125,12 +121,11 @@ class StoreOrderLogic extends BaseLogic 'store_id' => $params['store_id'] ?? 0, 'shipping_type' =>3,//配送方式 1=快递 ,2=门店自提 'activity' =>'减免', - 'activity_price' =>self::$activity_price, + 'activity_price' =>self::$activity_price,//活动优惠价 'activities' => self::$activity_price>0?1:0, 'default_delivery'=>1, 'original_price'=>self::$total_price, - 'deduction_price' => self::$activity_price, - 'preferential_amount' => $preferential_amount, + 'deduction_price' => self::$activity_price,//抵扣金额 ]; if($user && $user['user_ship']!=4){ $order['is_vip']=1; diff --git a/app/store/controller/user/UserController.php b/app/store/controller/user/UserController.php index 3ad486640..5e45e7786 100644 --- a/app/store/controller/user/UserController.php +++ b/app/store/controller/user/UserController.php @@ -47,4 +47,12 @@ class UserController extends BaseAdminController return $this->success('设置成功'); } + public function user_label(){ + $label_id=$this->request->post('label_id',0); + $id=$this->request->post('id',0); + + User::where('id',$id)->update(['label_id'=>$label_id]); + return $this->success('设置成功'); + } + } \ No newline at end of file diff --git a/app/store/controller/user/UserLabelController.php b/app/store/controller/user/UserLabelController.php new file mode 100644 index 000000000..abae0d92b --- /dev/null +++ b/app/store/controller/user/UserLabelController.php @@ -0,0 +1,30 @@ +dataLists(new UserLabelLists()); + } + +} \ No newline at end of file From 17239d39e84b80babded41e3193e62e875bb65a3 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 15:27:42 +0800 Subject: [PATCH 124/145] =?UTF-8?q?=E8=BF=81=E7=A7=BBvip=E4=B8=BA1?= =?UTF-8?q?=E5=BE=97=E6=97=B6=E5=80=99=E5=BE=97=E5=86=BB=E7=BB=93=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E5=92=8C=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=BE=97=E5=B8=A6=E8=BF=94=E5=9B=9E=E5=86=BB=E7=BB=93?= =?UTF-8?q?=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/UserLogic.php | 6 ++-- app/common/logic/PayNotifyLogic.php | 43 ++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index bdbd73512..e6b493914 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -15,6 +15,8 @@ use app\common\{logic\BaseLogic, model\user\UserRecharge, model\user\UserShip, service\wechat\WeChatMnpService}; +use think\facade\Db; + /** * 会员逻辑层 @@ -90,8 +92,8 @@ class UserLogic extends BaseLogic $data['store_id'] = $check['store_id']; } } - $data['return_money'] = StoreFinanceFlow:: - where(['user_id'=>$uid,'status'=>0,'financial_pm'=>0]) + $data['return_money'] = Db::name('vip_flow')-> + where(['user_id'=>$uid,'status'=>0]) ->sum('number'); }else{ diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index a9c5d72c0..f7923921f 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -10,6 +10,7 @@ use app\common\model\finance\PayNotifyLog; use app\common\model\pay\PayNotify; 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\system_store\SystemStore; use app\common\model\user\User; use app\common\model\user\UserAddress; @@ -114,7 +115,7 @@ class PayNotifyLogic extends BaseLogic $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) { - VipLogic::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); + self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); } // self::afterPay($order); @@ -311,6 +312,11 @@ class PayNotifyLogic extends BaseLogic //商户应该获得的钱 每个商品的price-ot_price 利润 // if (isset($order->profit) && $order->profit > 0) { if ($order['uid'] > 0) { + //用户下单该用户等级为1得时候才处理冻结金额 + $user = User::where('id', $order['uid'])->find(); + if ($user['user_ship'] == 1) { + self::dealVipAmount($order, $order['pay_type']); + } $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], @@ -460,4 +466,39 @@ class PayNotifyLogic extends BaseLogic ]; PayNotify::create($data); } + + + /** + * 处理用户为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) + { + $detail = StoreOrderCartInfo::where('oid',$order['id'])->select()->toArray(); + $total_vip = 0; + foreach ($detail as $value){ + $total_vip +=$value['cart_info']['vip_frozen_price']; + } + $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; + } + } From b23cafcb64a9d4b19adb2e851dff330ee40850d6 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 16:18:12 +0800 Subject: [PATCH 125/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E4=B8=BA1=E6=97=B6=E6=83=85=E5=86=B5=E4=B8=8B=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=87=91=E9=A2=9D=E4=B8=BA=E6=94=AF=E4=BB=98=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E5=87=8F=E5=8E=BB=E5=86=BB=E7=BB=93=E9=87=91=E9=A2=9D?= =?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/common/logic/PayNotifyLogic.php | 43 ++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f7923921f..748971e67 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -304,14 +304,10 @@ class PayNotifyLogic extends BaseLogic $financeLogic = new StoreFinanceFlowLogic(); $user_sing = new UserSign(); - $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; - //商户应该获得的钱 每个商品的price-ot_price 利润 - // if (isset($order->profit) && $order->profit > 0) { if ($order['uid'] > 0) { + // 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去 + $vipFrozenAmount = self::dealFrozenPrice($order['id']); + $order['pay_price'] = bcsub($order['pay_price'],$vipFrozenAmount,2); //用户下单该用户等级为1得时候才处理冻结金额 $user = User::where('id', $order['uid'])->find(); if ($user['user_ship'] == 1) { @@ -329,6 +325,12 @@ class PayNotifyLogic extends BaseLogic 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); @@ -467,6 +469,25 @@ class PayNotifyLogic extends BaseLogic 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时得冻结资金 @@ -478,13 +499,9 @@ class PayNotifyLogic extends BaseLogic * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public static function dealVipAmount($order,$pay_type =1, $transaction_id = 0) + public static function dealVipAmount($order,$pay_type =1,$transaction_id = 0) { - $detail = StoreOrderCartInfo::where('oid',$order['id'])->select()->toArray(); - $total_vip = 0; - foreach ($detail as $value){ - $total_vip +=$value['cart_info']['vip_frozen_price']; - } + $total_vip = self::dealFrozenPrice($order['id']); $data=[ 'order_id' => $order['id'], 'transaction_id' => $transaction_id??0, From 479de5cc419bb4c067d97af79c29418d411b2486 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 16:57:10 +0800 Subject: [PATCH 126/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=89=A3=E9=99=A4=E9=87=91=E9=A2=9D=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 | 31 ++++++++++--------- .../logic/store_order/StoreOrderLogic.php | 13 ++++++-- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 1728473f1..6f66fd902 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -85,23 +85,32 @@ class OrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 -// if ($user && $user['user_ship'] == 4) { -// $deduction_price_count=bcmul(bcsub($find['price'], $find['purchase'], 2),$v['cart_num'],2); -// $cart_select[$k]['deduction_price'] =$deduction_price_count; -// self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); -// } + if ($user && $user['user_ship'] == 1) { + //更新 会员为1的时候原价减去会员价 + $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); + $cart_select[$k]['deduction_price'] =$deduction_price_count; + self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + } + if ($user && $user['user_ship'] == 4) { + //更新 为4商户的时候减去商户价格 + $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); + $cart_select[$k]['deduction_price'] =$deduction_price_count; + self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + } + //利润 // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额 $cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价 + $cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2)??0; //vip售价 + $cart_select[$k]['product_id'] = $find['product_id']; $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; //vip1待返回金额 - - $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],2); + $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'],2); // d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] ); $cartInfo = $cart_select[$k]; $cartInfo['name'] = $find['store_name']; @@ -119,13 +128,7 @@ class OrderLogic extends BaseLogic self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - $preferential_amount = 0;//差价(用户为UserShipEnum::DISCOUNT_ARRAY 的时候的优惠差价) - $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 - if($user && in_array($user['user_ship'],UserShipEnum::DISCOUNT_ARRAY)){ - $pay_price =bcsub(self::$store_price, self::$activity_price, 2); //减去活动优惠金额 - $preferential_amount = bcsub(self::$pay_price,self::$store_price,2); - } $vipPrice = 0; //成本价 收益 @@ -148,8 +151,6 @@ class OrderLogic extends BaseLogic 'activities' => self::$activity_price>0?1:0, 'deduction_price' => self::$activity_price, 'is_vip' => 0, - 'preferential_amount' => $preferential_amount, - ]; $order['default_delivery'] = 0; if ($params['store_id']) { diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index bbb40ea62..00f2c5150 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -62,8 +62,16 @@ class StoreOrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 + if ($user && $user['user_ship'] == 1) { + //更新 会员为1的时候原价减去会员价 + $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); + $cart_select[$k]['deduction_price'] =$deduction_price_count; + self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + } + if ($user && $user['user_ship'] == 4) { - $deduction_price_count=bcmul(bcsub($find['price'], $find['purchase'], 2),$v['cart_num'],2); + //更新 为4商户的时候减去商户价格 + $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); $cart_select[$k]['deduction_price'] =$deduction_price_count; self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); } @@ -72,13 +80,14 @@ class StoreOrderLogic extends BaseLogic $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额 $cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价 + $cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2)??0; //vip售价 $cart_select[$k]['product_id'] = $find['product_id']; $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; //vip1待返回金额 - $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],2); + $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'],2); $cartInfo = $cart_select[$k]; $cartInfo['name'] = $find['store_name']; $cartInfo['image'] = $find['image']; From f00ca73aa97b0e74bf6540e7761d9fa0280f0f26 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 17:27:36 +0800 Subject: [PATCH 127/145] =?UTF-8?q?=E6=9C=80=E8=BF=91=E5=BA=97=E9=93=BA?= =?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/controller/order/OrderController.php | 8 +++++++- app/api/logic/order/OrderLogic.php | 20 +++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/api/controller/order/OrderController.php b/app/api/controller/order/OrderController.php index 0d6e336ff..27553902d 100644 --- a/app/api/controller/order/OrderController.php +++ b/app/api/controller/order/OrderController.php @@ -366,12 +366,18 @@ class OrderController extends BaseApiController public function detail() { $order_id = (int)$this->request->get('order_id'); + $lat = $this->request->get('lat',''); + $lng = $this->request->get('long',''); $where = [ 'id' => $order_id, 'uid' => $this->userId, ]; $url = 'https://'.$this->request->host(true); - $order = OrderLogic::detail($where,$url); + $parm = [ + 'lat'=>$lat, + 'long'=>$lng + ]; + $order = OrderLogic::detail($where,$url,$parm); if ($order) { return $this->data($order); } else { diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 6f66fd902..38ce2fe1d 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -338,7 +338,7 @@ class OrderLogic extends BaseLogic } - public static function detail($params,$url=''): array + public static function detail($params,$url='',$param=[]): array { $find = StoreOrder::where($params)->findOrEmpty()->toArray(); if ($find) { @@ -360,6 +360,24 @@ class OrderLogic extends BaseLogic if($find['verify_img']){ $find['verify_img'] = $url.$find['verify_img']; } + //处理返回最近的店铺 + if($param['lat'] && $param['long']){ + $storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray(); + $nearestStore = null; + $minDistance = PHP_FLOAT_MAX; + foreach ($storeAll as $value){ + $value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$param['lat'] ,$param['long']); + if ($value['distance'] < $minDistance) { + $minDistance = $value['distance']; + $nearestStore = $value; + } + } + if ($nearestStore) { + $find['near_store'] =$nearestStore; + + } + + } } return $find; } From e200cdcd67c1f8669bc0db12d271d44504668b16 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 17:33:41 +0800 Subject: [PATCH 128/145] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/store_order/StoreOrderController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index d4213a31a..70d8173e4 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -82,7 +82,8 @@ class StoreOrderController extends BaseAdminController $cartId = (array)$this->request->post('cart_id', []); $params = $this->request->post(); $params['store_id'] = $this->adminInfo['store_id']; - $res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, null, $params); + $user=User::where('id',$params['uid'])->find(); + $res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, $user, $params); if ($res == false) { $msg = StoreOrderLogic::getError(); if ($msg == '购物车为空') { From e210bb790635b10b4409c535d1ba2dd451868cb1 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 18:14:25 +0800 Subject: [PATCH 129/145] =?UTF-8?q?feat(WorkbenchController):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=9C=AC=E6=9C=88=E8=AE=A2=E5=8D=95=E6=95=B0=E5=92=8C?= =?UTF-8?q?=E6=9C=AC=E6=9C=88=E6=94=AF=E4=BB=98=E4=BA=BA=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/WorkbenchController.php | 4 +- app/common/controller/BaseLikeController.php | 3 - app/common/model/store_visit/StoreVisit.php | 2 +- app/statistics/controller/IndexController.php | 107 ++++++++++++++++++ app/statistics/logic/OrderLogic.php | 69 +++++++++++ app/statistics/logic/ProductLogic.php | 51 +++++++++ app/statistics/logic/UserLogic.php | 33 ++++++ config/middleware.php | 7 +- 8 files changed, 269 insertions(+), 7 deletions(-) create mode 100644 app/statistics/controller/IndexController.php create mode 100644 app/statistics/logic/OrderLogic.php create mode 100644 app/statistics/logic/ProductLogic.php create mode 100644 app/statistics/logic/UserLogic.php diff --git a/app/admin/controller/WorkbenchController.php b/app/admin/controller/WorkbenchController.php index 3ad24544d..20335665f 100644 --- a/app/admin/controller/WorkbenchController.php +++ b/app/admin/controller/WorkbenchController.php @@ -704,8 +704,8 @@ class WorkbenchController extends BaseAdminController ] ], "month" => [ - WorkbenchLogic::month_order_count($dates_two,'本月订单数'), - WorkbenchLogic::month_order_count($dates_two,'本月支付人数') + WorkbenchLogic::month_order_count('本月订单数'), + WorkbenchLogic::month_order_count('本月支付人数') ] ] ]; diff --git a/app/common/controller/BaseLikeController.php b/app/common/controller/BaseLikeController.php index 56a6b1fd1..13c07d9c8 100644 --- a/app/common/controller/BaseLikeController.php +++ b/app/common/controller/BaseLikeController.php @@ -74,9 +74,6 @@ class BaseLikeController extends BaseController } - // #[ - // ApiDoc\Title('是否免登录验证'), - // ] public function isNotNeedLogin() : bool { $notNeedLogin = $this->notNeedLogin; diff --git a/app/common/model/store_visit/StoreVisit.php b/app/common/model/store_visit/StoreVisit.php index 0f506070a..82a837d8f 100644 --- a/app/common/model/store_visit/StoreVisit.php +++ b/app/common/model/store_visit/StoreVisit.php @@ -8,7 +8,7 @@ use think\model\concern\SoftDelete; /** - * 计量单位 + * 商品浏览分析 * Class StoreProductUnit * @package app\common\model\store_product_unit */ diff --git a/app/statistics/controller/IndexController.php b/app/statistics/controller/IndexController.php new file mode 100644 index 000000000..a28a407b1 --- /dev/null +++ b/app/statistics/controller/IndexController.php @@ -0,0 +1,107 @@ +fail(OrderLogic::getError()); //获取错误信息并返回错误信息 + } + return $this->success('ok', ['dayPayPrice' => $res]); + } + public function user() + { + $today = strtotime(date('Y-m-d')); + $dates=[]; + // 循环输出前5天的日期 + for ($i = 0; $i <= 4; $i++) { + // 计算前第$i天的日期时间戳 + $timestamp = $today - ($i * 86400); // 86400秒等于1天 + + // 将时间戳格式化为日期 + $date = date('Y-m-d', $timestamp); + $dates[]=$date; + } + $res = UserLogic::userCount(5,$dates); + if (UserLogic::hasError()) { + return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息 + } + return $this->success('ok', $res); + } + + /** + * 中间商品统计 + */ + public function product_count() + { + $res = ProductLogic::Count(5); + if (ProductLogic::hasError()) { + return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 + } + return $this->success('ok', $res); + } + /** + * 订单统计 + */ + public function order_user_num_count() + { + $res = OrderLogic::Count(5); + if (ProductLogic::hasError()) { + return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 + } + return $this->success('ok', $res); + } + /** + * 商品销量排行榜统计 + */ + public function sales_ranking() + { + $res = ProductLogic::sales(5); + if (ProductLogic::hasError()) { + return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 + } + return $this->success('ok', $res); + } + /** + * 成交用户数据 + */ + public function user_trade_count() + { + $dates = []; + + $today = new DateTime(); + $thirtyDaysAgo = new DateTime($today->format('Y-m-d')); + $thirtyDaysAgo->modify('-30 days'); + for ($i = 0; $i < 31; $i++) { + $date = new DateTime($thirtyDaysAgo->format('Y-m-d')); + $date->modify('+' . $i . ' days'); + $dates[] = $date->format('Y-m-d'); + } + $res = UserLogic::TradeCount(5, $dates); + if (UserLogic::hasError()) { + return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息 + } + return $this->success('ok', $res); + } + /** + * 当日订单金额 + */ + public function street_currday_order_count() + { + $res = OrderLogic::Currday(5); + if (ProductLogic::hasError()) { + return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 + } + return $this->success('ok', $res); + } +} diff --git a/app/statistics/logic/OrderLogic.php b/app/statistics/logic/OrderLogic.php new file mode 100644 index 000000000..83d7054df --- /dev/null +++ b/app/statistics/logic/OrderLogic.php @@ -0,0 +1,69 @@ +whereDay('create_time')->count(); + $orderPayNum = StoreOrder::where('store_id', $store_id)->where('paid', 1)->whereDay('create_time')->group('uid')->count(); + $monthOrderNum = StoreOrder::where('store_id', $store_id)->whereMonth('create_time')->count(); + $monthOrderPayNum = StoreOrder::where('store_id', $store_id)->where('paid', 1)->whereMonth('create_time')->group('uid')->count(); + $data = [ + "orderNum" => $orderNum, + "monthOrderNum" => $monthOrderNum, + "monthOrderNumRate" => 0, + "orderNumRate" => 0, + "orderPayNum" => $orderPayNum, + "monthOrderPayNum" => $monthOrderPayNum, + "monthOrderPayRate" => 0, + "orderOrderPayRate" => 0 + ]; + return $data; + } + public static function Currday($store_id) + { + $date = date("Y-m-d"); + $startTime = strtotime($date . ' 00:00:00'); // 当天的开始时间戳 + $endTime = strtotime($date . ' 23:59:59'); // 当天的结束时间戳 + + $interval = 4 * 60 * 60; // 4小时的秒数 + $data = []; + for ($time = $startTime; $time < $endTime; $time += $interval) { + + $endTimeSegment = $time + $interval; + $startTimeSegment = date('Y-m-d H:i:s', $time); + $yesterendTimeSegment = date('Y-m-d H:i:s', $endTimeSegment - 86400); + $endTimeSegment = date('Y-m-d H:i:s', $endTimeSegment); + $yesterstartTimeSegment = date('Y-m-d H:i:s', $time - 86400); + // 统计当前时间段的订单 + $todayAmount = StoreOrder::where('store_id', $store_id) + ->where('paid', 1) + ->whereBetween('create_time', [strtotime($startTimeSegment), strtotime($endTimeSegment)]) + ->sum('pay_price'); + $yesterdayAmount = StoreOrder::where('store_id', $store_id) + ->where('paid', 1) + ->whereBetween('create_time', [strtotime($yesterstartTimeSegment), strtotime($yesterendTimeSegment)]) + ->sum('pay_price'); + $data[] = [ + 'todayAmount' => $todayAmount, + 'yesterdayAmount' => $yesterdayAmount, + ]; + } + return $data; + } + public static function dayPayPrice($store_id) + { + $todayAmount = UserRecharge::where('store_id', $store_id) + ->where('paid', 1) + ->whereDay('create_time') + ->sum('price'); + + return $todayAmount; + } +} diff --git a/app/statistics/logic/ProductLogic.php b/app/statistics/logic/ProductLogic.php new file mode 100644 index 000000000..1b6a8aa83 --- /dev/null +++ b/app/statistics/logic/ProductLogic.php @@ -0,0 +1,51 @@ +count(); + $yestertodayProductCount=StoreBranchProduct::where('store_id',$store_id)->where('create_time', '<',strtotime(date('Y-md'))-1)->count(); + if ($yestertodayProductCount == 0 ||$todayProductCount==0) { + $weeklyProductTotalGrowthRate = 0; + } else { + $weeklyProductTotalGrowthRate = ($todayProductCount - $yestertodayProductCount) / $yestertodayProductCount * 100; + } + + $todayNewProductCount=StoreBranchProduct::where('store_id',$store_id)->whereDay('create_time')->count(); + $yestertodayNewProductCount=StoreBranchProduct::where('store_id',$store_id)->whereDay('create_time', 'yesterday')->count(); + if ($yestertodayProductCount == 0 ||$todayProductCount==0) { + $weeklyNewProductTotalGrowthRate = 0; + } else { + $weeklyNewProductTotalGrowthRate = ($todayNewProductCount - $yestertodayNewProductCount) / $yestertodayNewProductCount * 100; + } + $data = [ + "totalProductCounInfo" => [ + "todayProductCount" => $todayProductCount, + "yestertodayProductCount" => $yestertodayProductCount, + "weeklyProductTotalGrowthRate" => $weeklyProductTotalGrowthRate + ], + "newProductCountInfo" => [ + "todayNewProductCount" => 0, + "yestertodayNewProductCount" => 0, + "weeklyNewProductTotalGrowthRate" => $weeklyNewProductTotalGrowthRate + ], + "merchantCountInfo" => [ + "todayMerchantCount" => 1, + "yestertodayMerchantCount" => 1, + "weeklyMerchantGrowthRate" => 0 + ] + ]; + return $data; + } + + public static function sales($store_id){ + $select=StoreBranchProduct::where('store_id',$store_id)->limit(10)->order('sales desc')->field('id,store_name,image,sales')->select(); + return $select?->toArray(); + } +} diff --git a/app/statistics/logic/UserLogic.php b/app/statistics/logic/UserLogic.php new file mode 100644 index 000000000..5c34dc12f --- /dev/null +++ b/app/statistics/logic/UserLogic.php @@ -0,0 +1,33 @@ +$date) { + $data[$k]['newUserCount']=UserRecharge::whereDay('create_time', $date)->where('store_id',$store_id)->where('paid',1)->where('recharge_type','INDUSTRYMEMBERS')->count(); + $data[$k]['viewUserCount']=StoreVisit::whereDay('create_time', $date)->where('store_id',$store_id)->group('uid')->count(); + $data[$k]['totalUserCount']=UserRecharge::where('create_time','<',strtotime($date) )->where('store_id',$store_id)->where('paid',1)->where('recharge_type','INDUSTRYMEMBERS')->count(); + } + return $data; + } + public static function TradeCount($store_id,$dates) + { + $data = []; + foreach ($dates as $k=>$date) { + $data[$k]['date']=$date; + $data[$k]['visitUser']=StoreVisit::whereDay('create_time', $date)->where('store_id',$store_id)->cache('statistics_store_visit_count_' . $date, 300)->group('uid')->count(); + $data[$k]['orderUser']=StoreOrder::whereDay('create_time', $date)->where('store_id',$store_id)->cache('statistics_store_order_count_' . $date, 300)->group('uid')->count(); + $data[$k]['payOrderUser']=StoreOrder::whereDay('create_time', $date)->where('store_id',$store_id)->where('paid',1)->cache('statistics_store_order_pay_count_' . $date, 300)->group('uid')->count(); + } + return $data; + } +} diff --git a/config/middleware.php b/config/middleware.php index 6bc9bfc97..f2a5297fd 100644 --- a/config/middleware.php +++ b/config/middleware.php @@ -38,5 +38,10 @@ return [ app\store\middleware\InitMiddleware::class, app\store\middleware\LoginMiddleware::class, // app\store\middleware\AuthMiddleware::class, - ] + ], + 'statistics' => [ + // 跨域中间件 + app\common\http\middleware\AdminAllowMiddleware::class, + + ], ]; From a9e418ba8dace86f9ee3b91a0979769c247300be Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 18:15:17 +0800 Subject: [PATCH 130/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=BAvip1=E7=9A=84=E6=97=B6=E5=80=99=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/api/logic/order/OrderLogic.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 38ce2fe1d..e95c756ae 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -128,7 +128,11 @@ class OrderLogic extends BaseLogic self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + if ($user && $user['user_ship'] == 1) { + $pay_price = self::$pay_price; + }else{ + $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + } $vipPrice = 0; //成本价 收益 From 3a789a37267dcad33bdd10e1015805829137ae7c Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 18 Jun 2024 18:17:39 +0800 Subject: [PATCH 131/145] =?UTF-8?q?feat(IndexController):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=B3=BB=E7=BB=9F=E5=95=86=E5=BA=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index c3014c879..5ccf27950 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -7,6 +7,7 @@ use app\admin\validate\tools\GenerateTableValidate; use app\admin\logic\tools\GeneratorLogic; use app\common\logic\store_order\StoreOrderLogic; use app\common\model\store_branch_product\StoreBranchProduct; +use app\common\model\system_store\SystemStore; use app\common\service\pay\PayService; use app\common\service\wechat\WechatTemplate; use Exception; @@ -22,7 +23,7 @@ use Webman\RedisQueue\Redis; class IndexController extends BaseApiController { - public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street','village','brigade','config']; + public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config']; public function index() { @@ -173,7 +174,7 @@ class IndexController extends BaseApiController $list = Db::name('geo_village')->where('street_code', $area_code)->select()?->toArray(); return $this->success('ok', $list); } - /** + /** * @notes 获取队列表 */ public function brigade() @@ -182,14 +183,16 @@ class IndexController extends BaseApiController return $this->success('ok', $list); } - /** + /** * @notes 获取队列表 */ public function config() { - $list=[ - 'id'=>5, - 'store_name'=>'测试', + $store_id = getenv('STORE_ID') ?? 1; + $find = SystemStore::where('id', $store_id)->find(); + $list = [ + 'id' => $find['id'], + 'store_name' => $find['name'], ]; return $this->success('ok', $list); } From ea4e67a38feef66fbd303caff913d46eb5cb55df Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 18:25:08 +0800 Subject: [PATCH 132/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=80=BB=E8=BE=91=E5=92=8C=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 18 +++++++++++++++--- .../logic/store_order/StoreOrderLogic.php | 7 +++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 748971e67..d9041617f 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -306,13 +306,24 @@ class PayNotifyLogic extends BaseLogic if ($order['uid'] > 0) { // 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去 - $vipFrozenAmount = self::dealFrozenPrice($order['id']); - $order['pay_price'] = bcsub($order['pay_price'],$vipFrozenAmount,2); //用户下单该用户等级为1得时候才处理冻结金额 $user = User::where('id', $order['uid'])->find(); - if ($user['user_ship'] == 1) { + + //纯在分销关系的时候要去判断分销出来的用户的采购款的额度 + 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; + } + }elseif ($user['user_ship'] == 1){ + $vipFrozenAmount = self::dealFrozenPrice($order['id']); + //为1的时候要去减活动价 + $final_price = bcsub($order['pay_price'],$order['deduction_price'],2); + $order['pay_price'] = bcsub($final_price,$vipFrozenAmount,2); self::dealVipAmount($order, $order['pay_type']); } + + $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], @@ -325,6 +336,7 @@ class PayNotifyLogic extends BaseLogic 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) { diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 00f2c5150..851180901 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -110,8 +110,11 @@ class StoreOrderLogic extends BaseLogic self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - - $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + if ($user && $user['user_ship'] == 1) { + $pay_price = self::$pay_price; + }else{ + $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + } $vipPrice = 0; //成本价 收益 From 2e64e57488650cda9d2e5f5e8bffcf355b72c247 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 18:38:42 +0800 Subject: [PATCH 133/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=99=E9=A2=9D?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index d9041617f..30355e8a4 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -78,6 +78,12 @@ class PayNotifyLogic extends BaseLogic $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; + } + } $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price'],'',0,$order['store_id']); // self::afterPay($order); From f27eb18340755d83bfde9fca4f420dbe78eb3230 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 18 Jun 2024 19:06:24 +0800 Subject: [PATCH 134/145] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=A4=9A=E6=89=A3?= =?UTF-8?q?=E8=B4=B9=E4=B8=80=E6=AC=A1?= 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 30355e8a4..ec383da9b 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -324,12 +324,12 @@ class PayNotifyLogic extends BaseLogic }elseif ($user['user_ship'] == 1){ $vipFrozenAmount = self::dealFrozenPrice($order['id']); //为1的时候要去减活动价 - $final_price = bcsub($order['pay_price'],$order['deduction_price'],2); - $order['pay_price'] = bcsub($final_price,$vipFrozenAmount,2); +// $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']); } - $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], From d0b0dbb3b3cee23a174903ebb6fc2d923d2c4d34 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 19 Jun 2024 09:39:48 +0800 Subject: [PATCH 135/145] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=A0=87=E9=A2=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/statistics/controller/IndexController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/statistics/controller/IndexController.php b/app/statistics/controller/IndexController.php index a28a407b1..040fc8193 100644 --- a/app/statistics/controller/IndexController.php +++ b/app/statistics/controller/IndexController.php @@ -17,7 +17,7 @@ class IndexController extends BaseLikeController if (OrderLogic::hasError()) { return $this->fail(OrderLogic::getError()); //获取错误信息并返回错误信息 } - return $this->success('ok', ['dayPayPrice' => $res]); + return $this->success('ok', ['dayPayPrice' => $res,'title'=>'喻寺镇农(特)产品交易大数据']); } public function user() { From b1e1e39164dbb2e54b7205d0baf76faaeab3527e Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 10:07:26 +0800 Subject: [PATCH 136/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E5=90=8E=E7=94=A8=E6=88=B7=E7=9A=84=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/CapitalFlowLogic.php | 2 +- app/common/logic/PayNotifyLogic.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/common/logic/CapitalFlowLogic.php b/app/common/logic/CapitalFlowLogic.php index d2c7ab918..1b6aea9ba 100644 --- a/app/common/logic/CapitalFlowLogic.php +++ b/app/common/logic/CapitalFlowLogic.php @@ -57,7 +57,7 @@ class CapitalFlowLogic extends BaseLogic * @param $mark * @return mixed */ - public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0,$store_id=0,) + public function userExpense($category, $linkType, $linkId, $amount, $mark = '',$payType=0,$store_id=0) { $model = new CapitalFlow(); $model->uid = $this->user['id']; diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index ec383da9b..0502a2d61 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -314,12 +314,13 @@ class PayNotifyLogic extends BaseLogic // 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去 //用户下单该用户等级为1得时候才处理冻结金额 $user = User::where('id', $order['uid'])->find(); - //纯在分销关系的时候要去判断分销出来的用户的采购款的额度 - 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; + 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']) { + $order['pay_price'] = $oldUser['purchase_funds']; + } } }elseif ($user['user_ship'] == 1){ $vipFrozenAmount = self::dealFrozenPrice($order['id']); From 17a6b57673fa161d1393bcdc6b9fb7b44ea93e5d Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 10:24:11 +0800 Subject: [PATCH 137/145] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=86=E6=B6=A6=E9=80=BB=E8=BE=91=E5=8F=AA=E6=9C=89=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E6=8C=89=E7=85=A7=E9=87=87=E8=B4=AD=E6=AC=BE=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=8B=86=E5=88=86,=E5=85=B6=E4=BD=99=E7=9A=84?= =?UTF-8?q?=E5=88=86=E6=B6=A6=E8=BF=98=E6=98=AF=E6=8C=89=E7=85=A7=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E6=94=AF=E4=BB=98=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 0502a2d61..9b9a76d7b 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -309,20 +309,21 @@ class PayNotifyLogic extends BaseLogic { $financeLogic = new StoreFinanceFlowLogic(); $user_sing = new UserSign(); - + $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']) { - $order['pay_price'] = $oldUser['purchase_funds']; + $vipFen = $oldUser['purchase_funds']; } } - }elseif ($user['user_ship'] == 1){ + } + elseif ($user['user_ship'] == 1){ $vipFrozenAmount = self::dealFrozenPrice($order['id']); //为1的时候要去减活动价 // $final_price = bcsub($order['pay_price'],$order['deduction_price'],2); @@ -387,7 +388,11 @@ class PayNotifyLogic extends BaseLogic // if ($order['is_vip'] >= 1) { if ($order['spread_uid'] > 0) { $financeLogic->other_arr['vip_uid'] = $order['spread_uid']; - $fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2); + 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(); From 5b01a6ab491d38c9fb84ba3bfaf1f4373b4a4410 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 10:56:52 +0800 Subject: [PATCH 138/145] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=B6=E9=93=B6?= =?UTF-8?q?=E5=8F=B0=E6=9F=A5=E8=AF=A2=E7=9A=84=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/store_order/StoreOrderLists.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/store/lists/store_order/StoreOrderLists.php b/app/store/lists/store_order/StoreOrderLists.php index 12f7c7208..3c86ba983 100644 --- a/app/store/lists/store_order/StoreOrderLists.php +++ b/app/store/lists/store_order/StoreOrderLists.php @@ -46,13 +46,13 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface */ public function lists(): array { - $store_id = $this->adminInfo['store_id']; + $store_id = $this->adminInfo['store_id']??5; $this->searchWhere[] = ['store_id' ,'=',$store_id]; $is_sashier=$this->request->get('is_sashier'); if($is_sashier==1){//收银台订单 - $this->searchWhere[] = ['pay_type','in',[17,9,13]]; + $this->searchWhere[] = ['pay_type','in',[17,9,13,18]]; }elseif($is_sashier==2){//小程序订单 - $this->searchWhere[] = ['pay_type','in',[7,3]]; + $this->searchWhere[] = ['pay_type','in',[7,3,18]]; } return StoreOrder::where($this->searchWhere) ->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status','paid']) From 4112b6ffe3e4560d9bbda59c4443d59802a8d0c7 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 11:23:54 +0800 Subject: [PATCH 139/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=94=B6=E9=93=B6=E5=B1=95=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/store_order/StoreOrderLogic.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 851180901..972e4ebeb 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -112,8 +112,10 @@ class StoreOrderLogic extends BaseLogic } if ($user && $user['user_ship'] == 1) { $pay_price = self::$pay_price; + $activity_string = ''; }else{ $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + $activity_string = '减免'; } $vipPrice = 0; @@ -132,7 +134,7 @@ class StoreOrderLogic extends BaseLogic 'cart_id' => implode(',', $cartId), 'store_id' => $params['store_id'] ?? 0, 'shipping_type' =>3,//配送方式 1=快递 ,2=门店自提 - 'activity' =>'减免', + 'activity' =>$activity_string, 'activity_price' =>self::$activity_price,//活动优惠价 'activities' => self::$activity_price>0?1:0, 'default_delivery'=>1, From 204498937f3f2f7b11947cfcf6b24d3dea30e489 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 19 Jun 2024 11:56:47 +0800 Subject: [PATCH 140/145] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/user/UserLists.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php index e410ceec3..0a888bef6 100644 --- a/app/store/lists/user/UserLists.php +++ b/app/store/lists/user/UserLists.php @@ -21,7 +21,7 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface public function setSearch(): array { return [ - '=' => ['id'], + '=' => ['id','user_ship'], '%like%' => ['mobile'], ]; } From 8ac8d073f62e42e5d6405b8e6ddf5a03052a9ee5 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 13:52:15 +0800 Subject: [PATCH 141/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=B6=E9=93=B6?= =?UTF-8?q?=E5=8F=B0=E9=87=87=E8=B4=AD=E6=AC=BE=E6=94=AF=E4=BB=98=E5=90=8E?= =?UTF-8?q?=E8=B0=83=E7=94=A8=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/common/logic/PayNotifyLogic.php | 12 +++++++++++- .../controller/store_order/StoreOrderController.php | 5 ++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 9b9a76d7b..a7aa59456 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -2,6 +2,7 @@ namespace app\common\logic; +use app\api\logic\order\OrderLogic; use app\common\enum\OrderEnum; use app\common\enum\PayEnum; use app\common\enum\user\UserShipEnum; @@ -124,6 +125,15 @@ class PayNotifyLogic extends BaseLogic self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); } + 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::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' => '您有一笔新的订单']); @@ -252,10 +262,10 @@ class PayNotifyLogic extends BaseLogic $order->paid = 1; $order->pay_time = time(); $order->status = 2; - self::afterPay($order); if (!$order->save()) { throw new \Exception('订单保存出错'); } + self::afterPay($order); $cashFlowLogic = new CashFlowLogic(); $cashFlowLogic->insert($order['store_id'], $order['pay_price']); // Redis::send('push-platform-print', ['id' => $order['id']]); diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 70d8173e4..e69c4f048 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -146,7 +146,10 @@ class StoreOrderController extends BaseAdminController switch ($pay_type) { case PayEnum::PURCHASE_FUNDS: //采购款支付 - PayNotifyLogic::handle('purchase_funds', $order['order_id'], ['uid' => $uid]); + PayNotifyLogic::handle('purchase_funds', $order['order_id'], [ + 'uid' => $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 14d0f838fd80fa403462caf0e8caa54ce9dc8735 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 14:19:44 +0800 Subject: [PATCH 142/145] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=B8=BA=E4=BC=9A=E5=91=98=E7=AD=89=E7=BA=A71=E6=A0=87?= =?UTF-8?q?=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 3 ++- app/common/logic/store_order/StoreOrderLogic.php | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index e95c756ae..dcfa9efab 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -84,12 +84,13 @@ class OrderLogic extends BaseLogic $cart_select[$k]['cost'] = $find['cost']; $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 - + $cart_select[$k]['vip'] = 0; if ($user && $user['user_ship'] == 1) { //更新 会员为1的时候原价减去会员价 $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); $cart_select[$k]['deduction_price'] =$deduction_price_count; self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + $cart_select[$k]['vip'] =1; } if ($user && $user['user_ship'] == 4) { //更新 为4商户的时候减去商户价格 diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 972e4ebeb..b5e6bf98c 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -61,12 +61,13 @@ class StoreOrderLogic extends BaseLogic $cart_select[$k]['cost'] = $find['cost']; $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 - + $cart_select[$k]['vip'] = 0; if ($user && $user['user_ship'] == 1) { //更新 会员为1的时候原价减去会员价 $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); $cart_select[$k]['deduction_price'] =$deduction_price_count; self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + $cart_select[$k]['vip'] =1; } if ($user && $user['user_ship'] == 4) { @@ -223,6 +224,12 @@ class StoreOrderLogic extends BaseLogic $order['refund_type_name'] = OrderEnum::refundType($order['refund_type']) ?? ''; $order['pay_type_name'] =PayEnum::getPaySceneDesc($order['pay_type']) ?? ''; + $detail =StoreOrderCartInfo::where('oid',$order['id'])->find()->toArray(); + $vip =0; + if(isset($detail['cart_info']['vip']) && $detail['cart_info']['vip'] == 1){ + $vip = 1; + } + $order['vip'] = $vip; return $order->toArray(); } From 149d818157726294f193945759381b200e3a67a7 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 16:21:33 +0800 Subject: [PATCH 143/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E7=9A=84=E8=B4=A6=E5=8D=95=E8=AE=B0=E5=BD=95=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store_finance_flow/StoreFinanceFlowLists.php | 1 + .../controller/finance/StoreBillController.php | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php index 3dedf3c5a..fd996b83b 100644 --- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php +++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php @@ -33,6 +33,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt return [ '=' => ['store_id', 'user_id', 'create_time', 'staff_id'], 'between_time'=>'create_time', + '%pipe_like%' => ['keyword'=>'order_sn'], ]; } diff --git a/app/store/controller/finance/StoreBillController.php b/app/store/controller/finance/StoreBillController.php index 50c7fb34c..cbd7bc6be 100644 --- a/app/store/controller/finance/StoreBillController.php +++ b/app/store/controller/finance/StoreBillController.php @@ -2,7 +2,10 @@ namespace app\store\controller\finance; +use app\admin\lists\store_finance_flow\StoreFinanceFlowDayLists; use app\admin\lists\store_finance_flow\StoreFinanceFlowLists; +use app\admin\lists\store_finance_flow\StoreFinanceFlowMonthLists; +use app\admin\lists\store_finance_flow\StoreFinanceFlowWeekLists; use app\common\controller\Definitions; use app\common\lists\StoreBillLists; use app\store\controller\BaseAdminController; @@ -27,7 +30,15 @@ class StoreBillController extends BaseAdminController // ] public function lists() { - return $this->dataLists(new StoreBillLists()); + $type = $this->request->get('type'); + if($type == 1){ + return $this->dataLists(new StoreFinanceFlowDayLists()); + }else if($type == 2){ + return $this->dataLists(new StoreFinanceFlowWeekLists()); + }else{ + return $this->dataLists(new StoreFinanceFlowMonthLists()); + } +// return $this->dataLists(new StoreBillLists()); } // #[ From 7981e126f370b09ffe56443740a436aeb07067e2 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 16:58:38 +0800 Subject: [PATCH 144/145] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=B6=E9=93=B6?= =?UTF-8?q?=E6=9C=BA=E5=88=86=E7=B1=BB=E9=80=BB=E8=BE=91=E7=9B=B8=E5=85=B3?= 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, 5 insertions(+) diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php index cce4193a4..c5b70125e 100644 --- a/app/admin/lists/store_branch_product/StoreBranchProductLists.php +++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php @@ -57,6 +57,11 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI $where[]=['cate_id','in',array_merge($arr,$arr2)]; } } + if(empty($where) && $class_all){ + //2或者1 + $where[]=['cate_id','=',$class_all]; + } + return StoreBranchProduct::where($this->searchWhere)->where($where) ->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost','purchase', 'status']) ->when(!empty($this->adminInfo['store_id']), function ($query) { From 69ed8b332d24b81966b0f362b93f783fc1e39c82 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 19 Jun 2024 17:05:37 +0800 Subject: [PATCH 145/145] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=E5=BE=85=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/store_product/StoreProductLogic.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index cfd50ef30..6aee0d22b 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -154,7 +154,8 @@ class StoreProductLogic extends BaseLogic ]; StoreProduct::where('id', $params['id'])->update($data); - $old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id') + + /*$old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id') ->select(); // 获取分类ID foreach ($old_cate as $vv) { @@ -169,13 +170,13 @@ class StoreProductLogic extends BaseLogic //新增对应的分类 self::updateGoodsclass($params['cate_id'], $value['store_id']); } - } + }*/ //修改 StoreBranchProduct::where('product_id', $params['id'])->update([ 'price' => $params['price'], 'vip_price' => $params['vip_price'], - 'cost' => $params['cost'], 'cate_id' => $params['cate_id'], + 'cost' => $params['cost'], 'batch'=>$params['batch'],'store_name'=>$params['store_name'] ]);