dever 3 年之前
父節點
當前提交
39624c731e

+ 6 - 6
app/shop/lib/Sell.php

@@ -90,12 +90,12 @@ class Sell
         	$param['pay_msg'] = '';
         	$this->success($param);
 
-            if ($cart) {
+            if ($cart == 1) {
                 # 来自购物车,要清空一下
                 $this->dropCart($uid, $goods, $shop['id']);
-                # 使用优惠券
-                $this->useCoupon($coupon_id, $user_coupon_id);
             }
+            # 使用优惠券
+            $this->useCoupon($coupon_id, $user_coupon_id);
         	return 'ok';
         }
 
@@ -118,12 +118,12 @@ class Sell
         }
 
         $result = Dever::load('pay/api.pay', $param);
-        if ($cart) {
+        if ($cart == 1) {
             # 来自购物车,要清空一下
             $this->dropCart($uid, $goods, $shop['id']);
-            # 使用优惠券
-            $this->useCoupon($coupon_id, $user_coupon_id);
         }
+        # 使用优惠券
+        $this->useCoupon($coupon_id, $user_coupon_id);
         return $result;
     }
 

+ 3 - 0
app/shop/src/Buy.php

@@ -106,6 +106,8 @@ class Buy extends Core
         $where['uid'] = $this->uid;
         $where['shop_id'] = $this->shop_id;
         $where['id'] = Dever::input('cart_id');
+
+        $status = Dever::input('status', 1);
         $num = Dever::input('num');
 
         $info = Dever::db('shop/cart')->find($where);
@@ -117,6 +119,7 @@ class Buy extends Core
             if ($num <= 0) {
                 $state = Dever::db('shop/cart')->delete($where);
             } else {
+                $where['status'] = $status;
                 $where['num'] = $info['num'] + $num;
                 # 验证库存
                 Dever::load('shop/lib/info')->checkTotal($where['num'], $info['goods_id'], $this->shop_id, $info['sku_id'], 2);

+ 2 - 2
package/manage/config/plugin.php

@@ -1,10 +1,10 @@
 <?php
 # 注册插件
 
-$config['manage/console.data_api'] = array
+$config['manage/console.data'] = array
 (
 	# 直接覆盖旧的接口数据
-	'cover' => 'main',
+	'cover' => 'console.data',
 );
 
 

+ 76 - 0
package/manage/plugin/Console.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace Manage\Plugin;
+
+use Dever;
+
+class Console
+{
+    public function data()
+    {
+        $user = Dever::db('passport/user')->total();
+        $shop = Dever::db('shop/info')->total();
+        $factory = Dever::db('factory/info')->total();
+        $store = Dever::db('store/info')->total();
+
+        $total = 0;
+        $data[] = array
+        (
+            'name' => '当日销售额',
+            'num' => $total,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '销售订单量',
+            'num' => $total,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '采购额',
+            'num' => $total,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '采购订单量',
+            'num' => $total,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '当日用户新增',
+            'num' => $total,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '用户总量',
+            'num' => $user,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '门店数',
+            'num' => $shop,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '仓库数/工厂数',
+            'num' => $store . ' / ' . $factory,
+            'href' => '#',
+        );
+
+
+        return $data;
+    }
+}

+ 0 - 1
package/manage/plugin/main.php

@@ -1 +0,0 @@
-<?php