Răsfoiți Sursa

课程报名

shish 5 ani în urmă
părinte
comite
7614260fbd

+ 10 - 1
app-ghs/controllers/AuthController.php

@@ -207,6 +207,8 @@ class AuthController extends PublicController
             $admin = AdminService::replaceAdmin($adminInfo, $userSource);
         }
         $adminId = $admin['id'];
+        //1没有开店 2已申请待审核 3已开店
+        $openShop = $admin['openShop'] ?? 1;
         $currentShopId = $admin['currentShopId'] ?? 0;
         //员工id
         $shopAdminId = 0;
@@ -218,7 +220,14 @@ class AuthController extends PublicController
         }
         $admin['avatar'] = imgUtil::getPrefix() . '/retail/default-img.png';
         $token = jwt::getNewToken($adminId);
-        util::success(['token' => $token, 'admin' => $admin, 'shopAdminId' => $shopAdminId, 'shopId' => $currentShopId, 'super' => $super]);
+        util::success([
+            'token' => $token,
+            'admin' => $admin,
+            'shopAdminId' => $shopAdminId,
+            'shopId' => $currentShopId,
+            'super' => $super,
+            'openShop' => $openShop,
+        ]);
     }
 
 }

+ 39 - 39
app-mall/controllers/PxApplyController.php

@@ -18,50 +18,50 @@ use bizMall\promote\services\CouponService;
 class PxApplyController extends BaseController
 {
 
-	//报名申请 ssh 2021.3.17
-	public function actionAdd()
-	{
-		$get = Yii::$app->request->get();
-		$classId = $get['classId'] ?? 0;
-		$info = PxClassClass::getClassInfo($classId);
-		PxClassClass::valid($info, $this->sjId);
-
-		$customId = $this->customId;
-		if (!empty($customId)) {
-			$custom = CustomClass::getCustomInfo($customId);
-			CustomClass::valid($custom, $this->sjId);
-		}
-		$get['sjId'] = $this->sjId;
-		$get['prePrice'] = $info['tuition'];
-		$get['actPrice'] = $info['tuition'];
-		$get['shopId'] = $this->shopId;
-		$get['shopAdminId'] = 0;
-		$get['customId'] = $this->customId;
-		$get['className'] = $info['name'] ?? '';
-		$get['classCover'] = $info['cover'] ?? '';
-		$get['applyTime'] = date("Y-m-d H:i:s");
-		$get['status'] = PxApplyClass::STATUS_UN_CONFIRM;
-
-		PxApplyClass::addApply($get, $this->shop);
-		util::complete();
-	}
-
-	//新学员 学员管理 ssh 2021.3.17
-	public function actionList()
-	{
-		$where = ['shopId' => $this->shopId];
-		$respond = PxApplyClass::getApplyList($where);
-		util::success($respond);
-	}
-
-	public function actionWxPay()
+    //报名申请 ssh 2021.3.17
+    public function actionAdd()
+    {
+        $get = Yii::$app->request->get();
+        $classId = $get['classId'] ?? 0;
+        $info = PxClassClass::getClassInfo($classId);
+        PxClassClass::valid($info, $this->sjId);
+
+        $customId = $this->customId;
+        if (!empty($customId)) {
+            $custom = CustomClass::getCustomInfo($customId);
+            CustomClass::valid($custom, $this->sjId);
+        }
+        $get['sjId'] = $this->sjId;
+        $get['prePrice'] = $info['tuition'];
+        $get['actPrice'] = $info['tuition'];
+        $get['shopId'] = $this->shopId;
+        $get['shopAdminId'] = 0;
+        $get['customId'] = $this->customId;
+        $get['className'] = $info['name'] ?? '';
+        $get['classCover'] = $info['cover'] ?? '';
+        $get['applyTime'] = date("Y-m-d H:i:s");
+        $get['status'] = PxApplyClass::STATUS_UN_CONFIRM;
+
+        $respond = PxApplyClass::addApply($get, $this->shop);
+        util::success($respond);
+    }
+
+    //新学员 学员管理 ssh 2021.3.17
+    public function actionList()
+    {
+        $where = ['shopId' => $this->shopId];
+        $respond = PxApplyClass::getApplyList($where);
+        util::success($respond);
+    }
+
+    public function actionWxPay()
     {
         ini_set('date.timezone', 'Asia/Shanghai');
         $post = Yii::$app->request->post();
         $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
         $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
 
-        $order = PxApplyClass::getByCondition(['customId'=> $this->customId,'orderSn' => $orderSn,'status'=>PxApplyClass::STATUS_UN_CONFIRM]);
+        $order = PxApplyClass::getByCondition(['customId' => $this->customId, 'orderSn' => $orderSn, 'status' => PxApplyClass::STATUS_UN_CONFIRM]);
         if (empty($order)) {
             util::fail('订单号无效');
         }
@@ -118,7 +118,7 @@ class PxApplyController extends BaseController
         $tools = new \JsApiPay();
         $jsApiParameters = $tools->GetJsApiParameters($wxOrder, $sjExtend);
         $newParams = json_decode($jsApiParameters, true);
-        
+
         $current = date("Y-m-d H:i:s");
         $updateData = ['deadline' => $current, 'changePrice' => 2];
         // PurchaseClass::updateById($id, $updateData);

+ 1 - 1
biz-ghs/admin/classes/AdminClass.php

@@ -85,7 +85,7 @@ class AdminClass extends BaseClass
                     'mobile' => $mobile,
                     'currentShopId' => $shopId,
                     'super' => 1,
-                    'apply' => 2,
+                    'openShop' => 3,
                 ];
                 self::updateById($adminId, $adminData);
                 $shopData = [

+ 12 - 18
biz-ghs/order/classes/OrderClass.php

@@ -74,7 +74,6 @@ class OrderClass extends BaseClass
     public static function addOrder($data, $shop, $customOrder = false)
     {
         $sjId = $data['merchantId'] ?? 0;
-        $shopId = $shop['id'] ?? 0;
         $month = date("Ym");
         $orderSn = orderSn::getGhsOrderSn();
         $data['orderSn'] = $orderSn;
@@ -106,21 +105,9 @@ class OrderClass extends BaseClass
         }
         $data['weight'] = $weight;
 
-        //价格和数据
-
         $return = self::add($data);
 
-        //总订单和待付款订单增加
-        $shop['totalOrder']++;
-        $shop['unPayOrder']++;
-        ShopClass::updateById($shopId, ['totalOrder' => $shop['totalOrder'], 'unPayOrder' => $shop['unPayOrder']]);
-        $sjAsset = MerchantAssetClass::getByMerchantId($sjId);
-        $sjAsset['totalOrder']++;
-        $sjAsset['unPayOrder']++;
-        MerchantAssetClass::updateByCondition(['merchantId' => $sjId], ['totalOrder' => $sjAsset['totalOrder'], 'unPayOrder' => $sjAsset['unPayOrder']]);
-
         if ($customOrder == false) {
-
             //0正常订单 1欠款
             $debt = $data['debt'] ?? 0;
             if ($debt == 1) {
@@ -130,7 +117,6 @@ class OrderClass extends BaseClass
                 //已收款
                 self::payOk($return, 2, $shop);
             }
-
             //扣库存 2021.2.23 linqh
             foreach ($product as $key => $val) {
                 ProductClass::decreaseStock($val['productId'], $val['bigNum'], $val['smallNum']);
@@ -140,8 +126,17 @@ class OrderClass extends BaseClass
                 OrderClass::withoutSend($return);
             }
         }
-        //统计
-        self::updateStatBySell($return);
+
+        //当天收入,当月收入,总收入,总订单+1
+//        StatIncomeClass::updateOrInsert($return['merchantId'],$return['shopId'],$return['actPrice']);
+//        StatIncomeMonthClass::updateOrInsert($return['merchantId'],$return['shopId'],$return['actPrice']);
+//        ShopService::updateTotalIncome($return['shopId'],$return['actPrice']);
+//        ShopService::totalOrderPlus($return['shopId']);
+//        //今日订单+1
+//        StatOrderClass::updateOrInsert($return['merchantId'],$return['shopId']);
+//        //本月订单+1
+//        StatOrderMonthClass::updateOrInsert($return['merchantId'],$return['shopId']);
+
         return $return;
     }
 
@@ -322,9 +317,8 @@ class OrderClass extends BaseClass
                 }
             }
             $list[$key]['expressProgress'] = $expressProgress;
-
             $list[$key]['customAvatarUrl'] = imgUtil::groupImg($val['customAvatar']);
-
+            $list[$key]['customName'] = isset($val['customId']) && !empty($val['customId']) ? $val['customName'] : '散客';
         }
         return $list;
     }

+ 0 - 14
biz-ghs/order/traits/OrderTrait.php

@@ -125,20 +125,6 @@ trait OrderTrait
         ShopService::updateTotalExpend($order['shopId'],$order['orderPrice']);
     }
 
-    //开单时更新统计
-    public static function updateStatBySell($order)
-    {
-        //当天收入,当月收入,总收入,总订单+1
-        StatIncomeClass::updateOrInsert($order['merchantId'],$order['shopId'],$order['actPrice']);
-        StatIncomeMonthClass::updateOrInsert($order['merchantId'],$order['shopId'],$order['actPrice']);
-        ShopService::updateTotalIncome($order['shopId'],$order['actPrice']);
-        ShopService::totalOrderPlus($order['shopId']);
-        //今日订单+1
-        StatOrderClass::updateOrInsert($order['merchantId'],$order['shopId']);
-        //本月订单+1
-        StatOrderMonthClass::updateOrInsert($order['merchantId'],$order['shopId']);
-    }
-
     //出库时更新统计
     public static function updateStatByStockOut($order)
     {

+ 1 - 1
biz-hd/admin/classes/AdminClass.php

@@ -60,7 +60,7 @@ class AdminClass extends BaseClass
                     'payPassword' => password_hash($mobile, PASSWORD_BCRYPT),
                     'mobile' => $mobile,
                     'super' => 1,
-                    'apply' => 2,
+                    'openShop' => 3,
                 ];
                 AdminClass::updateById($adminId, $adminData);
                 $shopData = [

+ 9 - 2
biz-hd/saas/services/ApplyService.php

@@ -130,7 +130,11 @@ class ApplyService extends BaseService
         if (in_array($from, [ApplyClass::FROM_GHS, ApplyClass::FROM_RETAIL]) == false) {
             util::fail('请填写来源');
         }
-        return ApplyClass::addRetail($data);
+        $respond = ApplyClass::addRetail($data);
+        //已提交开店申请,待审核
+        \biz\admin\classes\AdminClass::updateById($adminId, ['openShop' => 2]);
+
+        return $respond;
     }
 
     //供货商申请开店 ssh 2021.01.28
@@ -157,7 +161,6 @@ class ApplyService extends BaseService
         if (!empty($has)) {
             util::fail('您已经申请过');
         }
-
         //引荐的员工
         $shopAdminId = $data['shopAdminId'] ?? 0;
         if (!empty($shopAdminId)) {
@@ -177,6 +180,10 @@ class ApplyService extends BaseService
         $address = $data['address'] ?? '';
         $data['fullAddress'] = $prefix . $dist . $address . $floor;
         $respond = ApplyClass::addGhs($data);
+
+        //已提交开店申请,待审核
+        \biz\admin\classes\AdminClass::updateById($adminId, ['openShop' => 2]);
+
         return $respond;
     }
 

+ 3 - 0
biz/sj/services/MerchantService.php

@@ -73,6 +73,9 @@ class MerchantService extends BaseService
         $applyData['address'] = $applyData['address'] ?? '';
         $applyData['agentLevel'] = 1;
         $applyData['parentId'] = $applyData['introSjId'] ?? 0;
+        //15天免费试用
+        $deadline = time() + 15 * 86400;
+        $applyData['deadline'] = date("Y-m-d H:i:s", $deadline);
         $sj = self::add($applyData);
         $sjId = $sj['id'];
         $mobile = $applyData['mobile'] ?? '';

+ 2 - 1
sql.sql

@@ -2125,4 +2125,5 @@ ADD INDEX `idx_shopId` (`shopId`) ;
 ALTER TABLE xhStatIncomeMonth DROP INDEX `income`;
 ALTER TABLE xhStatIncome DROP INDEX `income`;
 ALTER TABLE xhAdmin ADD apply TINYINT NOT NULL DEFAULT 1 COMMENT '是否已申请开店 1没有 2有' AFTER `super`;
-ALTER TABLE xhAdmin MODIFY `apply` TINYINT NOT NULL DEFAULT 1 COMMENT '申请开店 1没有 2有申请,待审核 3有申请,已审核通过';
+ALTER TABLE xhAdmin MODIFY `apply` TINYINT NOT NULL DEFAULT 1 COMMENT '申请开店 1没有 2有申请,待审核 3有申请,已审核通过';
+ALTER TABLE `xhAdmin` CHANGE `apply` `openShop` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '申请开店 1没有 2有申请,待审核 3有申请,已审核通过';