浏览代码

创建订单

shish 5 年之前
父节点
当前提交
c1d1fb9be4

+ 1 - 1
app/ghs/controllers/OrderController.php

@@ -113,7 +113,7 @@ class OrderController extends BaseController
             'goodsStyleId' => $goodsStyleId,
             'createTime' => date("Y-m-d H:i:s"),
         ];
-        OrderGoodsService::add($data);//创建订单商品列表
+        //OrderGoodsService::add($data);//创建订单商品列表
         util::success(['orderSn' => $orderSn, 'totalPrice' => $actPrice, 'couponId' => $couponId]);
     }
 

+ 2 - 0
biz-ghs/order/classes/OrderClass.php

@@ -2,6 +2,8 @@
 
 namespace bizGhs\order\classes;
 
+use biz\merchant\classes\MerchantAssetClass;
+use bizGhs\stat\classes\StatOrderCountClass;
 use common\components\stringUtil;
 use Yii;
 use bizGhs\base\classes\BaseClass;

+ 26 - 0
biz-ghs/stat/classes/StatOrderCountClass.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace bizGhs\stat\classes;
+
+use Yii;
+use bizGhs\base\classes\BaseClass;
+
+class StatOrderCountClass extends BaseClass
+{
+
+    public static $baseFile = '\bizGhs\stat\models\StatOrderCount';
+
+    public static function addOrder($month, $ghsId)
+    {
+        $count = self::getByCondition(['ghsId' => $ghsId, 'time' => $month], true);
+        if (empty($count)) {
+            $data = ['time' => $month, 'riseNum' => 0, 'totalNum' => 0, 'ghsId' => $ghsId];
+            $count = self::add($data, true);
+        }
+        $count->riseNum += 1;
+        $count->totalNum += 1;
+        $count->save();
+        return $count->riseNum;
+    }
+
+}

+ 15 - 0
biz-ghs/stat/models/StatOrderCount.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace bizGhs\stat\models;
+
+use bizGhs\base\models\Base;
+
+class StatOrderCount extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhGhsStatOrderCount';
+    }
+
+}

+ 14 - 0
biz-ghs/stat/services/StatOrderCountService.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace bizGhs\stat\services;
+
+use bizGhs\base\services\BaseService;
+use bizGhs\stat\classes\StatOrderClass;
+use Yii;
+
+class StatOrderCountService extends BaseService
+{
+
+    public static $baseFile = '\bizGhs\stat\classes\StatOrderCountClass';
+
+}

+ 1 - 1
sql.sql

@@ -515,4 +515,4 @@ CREATE TABLE `xhGhsStatOrderCount` (
   `shopId` INT(11) NOT NULL DEFAULT '0' COMMENT '门店id',
   PRIMARY KEY (`id`),
   KEY `ghs` (`ghsId`,`time`)
-) COMMENT='供货商月订单量,包括未付款'
+) COMMENT='供货商月订单量,包括未付款';