Răsfoiți Sursa

商城客户下单余额增加

shish 5 ani în urmă
părinte
comite
8e09c8d10e

+ 31 - 0
app-ghs/controllers/ShopYeChangeController.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace ghs\controllers;
+
+use biz\shop\classes\ShopYeChangeClass;
+use common\components\dict;
+use common\components\util;
+use Yii;
+
+class ShopYeChangeController extends BaseController
+{
+
+    public $guestAccess = [];
+
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $status = $get['status'] ?? 0;
+        $ptStyle = $get['ptStyle'] ?? dict::getDict('ptStyle', 'hd');
+        $tx = $get['tx'] ?? dict::getDict('yeTx', 'canNot');
+        $where = [];
+        if (!empty($status)) {
+            $where['status'] = $status;
+        }
+        $where['ptStyle'] = $ptStyle;
+        $where['tx'] = $tx;
+        $list = ShopYeChangeClass::getChangeList($where);
+        util::success($list);
+    }
+
+}

+ 30 - 0
app-hd/controllers/ShopYeChangeController.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace hd\controllers;
+
+use biz\shop\classes\ShopYeChangeClass;
+use common\components\dict;
+use common\components\util;
+use Yii;
+
+class ShopYeChangeController extends BaseController
+{
+
+    public $guestAccess = [];
+
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $status = $get['status'] ?? 0;
+        $tx = $get['tx'] ?? dict::getDict('yeTx', 'canNot');
+        $where = [];
+        if (!empty($status)) {
+            $where['status'] = $status;
+        }
+        $where['shopId'] = $this->shopId;
+        $where['tx'] = $tx;
+        $list = ShopYeChangeClass::getChangeList($where);
+        util::success($list);
+    }
+
+}

+ 5 - 0
app-pt/controllers/PtYeChangeController.php

@@ -3,6 +3,7 @@
 namespace pt\controllers;
 
 use biz\pt\classes\PtYeChangeClass;
+use common\components\dict;
 use common\components\util;
 use Yii;
 
@@ -15,10 +16,14 @@ class PtYeChangeController extends BaseController
     {
         $get = Yii::$app->request->get();
         $status = $get['status'] ?? 0;
+        $ptStyle = $get['ptStyle'] ?? dict::getDict('ptStyle', 'hd');
+        $tx = $get['tx'] ?? dict::getDict('yeTx', 'canNot');
         $where = [];
         if (!empty($status)) {
             $where['status'] = $status;
         }
+        $where['ptStyle'] = $ptStyle;
+        $where['tx'] = $tx;
         $list = PtYeChangeClass::getChangeList($where);
         util::success($list);
     }

+ 5 - 0
app-pt/controllers/RechargeController.php

@@ -31,6 +31,11 @@ class RechargeController extends BaseController
         if (empty($shop)) {
             util::fail('请先择门店!');
         }
+        if (getenv('YII_ENV', 'local') == 'production') {
+            if ($staff->mobile != '15280215347') {
+                util::fail('线上只有超管才能发起充值');
+            }
+        }
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {

+ 27 - 0
app-pt/controllers/ShopYeChangeController.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace pt\controllers;
+
+use biz\shop\classes\ShopYeChangeClass;
+use common\components\dict;
+use common\components\util;
+use Yii;
+
+class ShopYeChangeController extends BaseController
+{
+
+    public $guestAccess = [];
+
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $shopId = $get['shopId'] ?? 0;
+        $tx = $get['tx'] ?? dict::getDict('yeTx', 'canNot');
+        $where = [];
+        $where['shopId'] = $shopId;
+        $where['tx'] = $tx;
+        $list = ShopYeChangeClass::getChangeList($where);
+        util::success($list);
+    }
+
+}

+ 26 - 10
biz-hd/order/classes/OrderClass.php

@@ -5,6 +5,7 @@ namespace bizHd\order\classes;
 use biz\goods\classes\GoodsClass;
 use biz\goods\models\Goods;
 use biz\shop\classes\ShopAdminClass;
+use biz\shop\classes\ShopClass;
 use biz\shop\models\Shop;
 use biz\stat\classes\StatOrderCountClass;
 use bizGhs\stat\classes\StatYjClass;
@@ -160,11 +161,11 @@ class OrderClass extends BaseClass
         }
         $date = date("Y-m-d H:i:s");
         $order->payTime = $date;
-        if($order->fromtType == dict::getDict("fromType","shop")){
+        if ($order->fromtType == dict::getDict("fromType", "shop")) {
             $shopAdminIds = \bizGhs\shop\classes\ShopAdminClass::getRemindAdminIdsByShopId($order->shopId);
-            if($shopAdminIds){
-                foreach ($shopAdminIds as $v){
-                    WsService::arrivalNotice($v,$order->actPrice);
+            if ($shopAdminIds) {
+                foreach ($shopAdminIds as $v) {
+                    WsService::arrivalNotice($v, $order->actPrice);
                 }
             }
         }
@@ -206,7 +207,7 @@ class OrderClass extends BaseClass
         OrderSendClass::placeOrder(['orderId' => $orderId, 'payTime' => $current, 'orderSn' => $orderSn]);
 
         $shopId = $order->shopId;
-        $shop = Shop::findBySql('select * from ' . Shop::tableName() . ' where id = :id for update', ['id' => $shopId])->one();
+        $shop = ShopClass::getLockById($shopId);
         $shop->unSendOrder += 1;
         $shop->unPayOrder -= 1;
         $shop->save();
@@ -219,14 +220,29 @@ class OrderClass extends BaseClass
             self::updateGoodsActualSold($orderGoods);
         }
 
-        if (isset($order->shopAdminId) && !empty($order->shopAdminId)) {
+        if (isset($order->shopAdminId) == false) {
+            util::fail('没有员工信息');
+        }
+        if (isset($order->fromType) == false) {
+            util::fail('没有来源信息');
+        }
+
+        if (!empty($order->shopAdminId)) {
             //员工开单,自取订单,直接完成
             if ($order->sendType == self::SEND_TYPE_NO) {
                 OrderSendClass::withoutSend($order);
             }
         } else {
+
+            //客户微信支付
+            if ($payWay == dict::getDict('payWay', 'wxPay')) {
+                $capitalType = dict::getDict('capitalType', 'xhOrder');
+                $amount = $order->actPrice;
+                ShopClass::customCreateOrderAddBalance($shop, $amount, $order, $capitalType);
+            }
+
             //门店和朋友圈订单并且没有填写收花人的直接将订单置为自取并且是完成状态
-            if (isset($order->fromType) && in_array($order->fromType, [0, 2])) {
+            if (in_array($order->fromType, [dict::getDict("fromType", "shop"), dict::getDict("fromType", "friend")])) {
                 if (isset($order->receiveMobile) && isset($order->address)) {
                     if (empty($order->receiveMobile) && empty($order->address)) {
                         OrderSendClass::withoutSend($order);
@@ -236,10 +252,10 @@ class OrderClass extends BaseClass
         };
 
         //下单通知,来自mall linqh 2021.5.19
-        if($order->fromtType == dict::getDict("fromType","mall")){
+        if ($order->fromtType == dict::getDict("fromType", "mall")) {
             $shopIdAdminIds = \bizGhs\shop\classes\ShopAdminClass::getRemindAdminIdsByShopId($shopId);
-            if($shopIdAdminIds){
-                foreach ($shopIdAdminIds as $v){
+            if ($shopIdAdminIds) {
+                foreach ($shopIdAdminIds as $v) {
                     WsService::newOrderNotice($v);
                 }
             }

+ 7 - 1
biz/pt/classes/PtAssetClass.php

@@ -53,7 +53,9 @@ class PtAssetClass extends BaseClass
             'sjId' => $order->merchantId,
             'shopId' => $order->shopId,
             'tx' => $tx,
-            'ptStyle' => $ptStyle
+            'ptStyle' => $ptStyle,
+            'shopName' => $shop->shopName,
+            'sjName' => $shop->merchantName,
         ];
         PtYeChangeClass::addChange($change, true);
     }
@@ -105,6 +107,8 @@ class PtAssetClass extends BaseClass
             'shopId' => $order->shopId,
             'tx' => $tx,
             'ptStyle' => $ptStyle,
+            'shopName' => $shop->shopName,
+            'sjName' => $shop->merchantName,
         ];
         PtYeChangeClass::addChange($change, true);
     }
@@ -158,6 +162,8 @@ class PtAssetClass extends BaseClass
             'shopId' => $order->shopId,
             'tx' => $tx,
             'ptStyle' => $ptStyle,
+            'shopName' => $shop->shopName,
+            'sjName' => $shop->merchantName,
         ];
         PtYeChangeClass::addChange($change, true);
     }

+ 6 - 0
biz/shop/classes/ShopYeChangeClass.php

@@ -14,4 +14,10 @@ class ShopYeChangeClass extends BaseClass
         return self::add($change, $returnObj);
     }
 
+    public static function getChangeList($where)
+    {
+        $data = self::getList('*', $where, 'addTime DESC');
+        return $data;
+    }
+
 }

+ 3 - 1
sql.sql

@@ -2642,4 +2642,6 @@ ALTER TABLE xhCash ADD remark VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '备注'
 ALTER TABLE xhCash ADD `cashName` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '收款人姓名' AFTER `thirdOrderSn`;
 ALTER TABLE xhCash ADD `cashAccount` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '收款人账号' AFTER `cashName`;
 ALTER TABLE xhPtYeChange CHANGE `style` `ptStyle` TINYINT NOT NULL DEFAULT 1 COMMENT '平台类型 查看dict.php表';
-ALTER TABLE xhShopYeChange ADD `ptStyle` TINYINT NOT NULL DEFAULT 1 COMMENT '平台类型 查看dict.php表' AFTER `relateId`;
+ALTER TABLE xhShopYeChange ADD `ptStyle` TINYINT NOT NULL DEFAULT 1 COMMENT '平台类型 查看dict.php表' AFTER `relateId`;
+ALTER TABLE xhPtYeChange ADD shopName VARCHAR(50) NOT NULL DEFAULT '' COMMENT '门店名称' AFTER `shopId`;
+ALTER TABLE xhPtYeChange ADD sjName VARCHAR(50) NOT NULL DEFAULT '' COMMENT '商家名称' AFTER `shopId`;