hrjy 2 years ago
parent
commit
44d27a678b

+ 4 - 1
app/admin/controller/Index.php

@@ -127,12 +127,15 @@ class Index extends AuthController
             'is_plus' => $now_order_info_c - $pre_order_info_c > 0 ? 1 : ($now_order_info_c - $pre_order_info_c == 0 ? -1 : 0)
         ];
         $second_line['order_info'] = $order_info;
-
+        $fertilizer = round(User::sum('white_integral'), 2);
+        $integral = round(User::sum('integral'), 2);
 
         $this->assign([
             'first_line' => $first_line,
             'second_line' => $second_line,
             'topData' => $topData,
+            'fertilizer' => $fertilizer,
+            'integral' => $integral
         ]);
         return $this->fetch();
     }

+ 1 - 1
app/admin/controller/order/StoreOrder.php

@@ -70,7 +70,7 @@ class StoreOrder extends AuthController
             ['pay_type', ''],
             ['order', '']
         ]);
-        return Json::successful(StoreOrderModel::getBadge($where));
+        return Json::successful(StoreOrderModel::getBadge($where, $this->adminInfo));
     }
 
     /**

+ 85 - 80
app/admin/model/order/StoreOrder.php

@@ -535,88 +535,93 @@ HTML;
         return $model;
     }
 
-    public static function getBadge($where)
+    public static function getBadge($where, $user)
     {
         $price = self::getOrderPrice($where);
-        return [
-            [
-                'name' => '订单数量',
-                'field' => '件',
-                'count' => $price['count_sum'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '售出商品',
-                'field' => '件',
-                'count' => $price['total_num'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '订单金额',
-                'field' => '元',
-                'count' => $price['pay_price'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '退款金额',
-                'field' => '元',
-                'count' => $price['refund_price'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '微信支付金额',
-                'field' => '元',
-                'count' => $price['pay_price_wx'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '余额支付金额',
-                'field' => '元',
-                'count' => $price['pay_price_yue'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '运费金额',
-                'field' => '元',
-                'count' => $price['pay_postage'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '分佣金额',
-                'field' => '元',
-                'count' => $price['brokerage'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '线下支付金额',
-                'field' => '元',
-                'count' => $price['pay_price_offline'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '积分抵扣',
-                'field' => '分',
-                'count' => $price['use_integral'] . '(抵扣金额:¥' . $price['deduction_price'] . ')',
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ],
-            [
-                'name' => '退回积分',
-                'field' => '元',
-                'count' => $price['back_integral'],
-                'background_color' => 'layui-bg-blue',
-                'col' => 2
-            ]
-        ];
+        if ($user['roles'] == 1){
+            return [
+                [
+                    'name' => '订单数量',
+                    'field' => '件',
+                    'count' => $price['count_sum'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '售出商品',
+                    'field' => '件',
+                    'count' => $price['total_num'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '订单金额',
+                    'field' => '元',
+                    'count' => $price['pay_price'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '退款金额',
+                    'field' => '元',
+                    'count' => $price['refund_price'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '微信支付金额',
+                    'field' => '元',
+                    'count' => $price['pay_price_wx'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '余额支付金额',
+                    'field' => '元',
+                    'count' => $price['pay_price_yue'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '运费金额',
+                    'field' => '元',
+                    'count' => $price['pay_postage'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '分佣金额',
+                    'field' => '元',
+                    'count' => $price['brokerage'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '线下支付金额',
+                    'field' => '元',
+                    'count' => $price['pay_price_offline'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '积分抵扣',
+                    'field' => '分',
+                    'count' => $price['use_integral'] . '(抵扣金额:¥' . $price['deduction_price'] . ')',
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ],
+                [
+                    'name' => '退回积分',
+                    'field' => '元',
+                    'count' => $price['back_integral'],
+                    'background_color' => 'layui-bg-blue',
+                    'col' => 2
+                ]
+            ];
+        }else{
+           return  [];
+        }
+
     }
 
     /**

+ 8 - 16
app/admin/view/index/main.php

@@ -90,32 +90,24 @@
         <div class="col-sm-3 ui-sortable">
             <div class="ibox float-e-margins">
                 <div class="ibox-title">
-                    <span class="label label-info pull-right"></span>
-                    <h5>粉丝</h5>
+                    <span class="label label-info pull-right"></span>
+                    <h5>肥料</h5>
                 </div>
                 <div class="ibox-content">
-                    <h1 class="no-margins">{$first_line.day.data}</h1>
-                    <div class="stat-percent font-bold text-info">
-                        {$first_line.day.percent}%
-                        {if condition='$first_line.day.is_plus egt 0'}<i class="fa {if condition='$first_line.day.is_plus eq 1'}fa-level-up{else /}fa-level-down{/if}"></i>{/if}
-                    </div>
-                    <small><a href="javascript:;" class="opFrames" data-name="会员管理" data-href="{:Url('user.user/index')}">今日新增粉丝</a></small>
+                    <h1 class="no-margins">{$fertilizer}</h1>
+                    <small><a href="javascript:;" class="opFrames" data-name="会员管理" data-href="{:Url('user.user/index')}">剩余肥料</a></small>
                 </div>
             </div>
         </div>
         <div class="col-sm-3 ui-sortable">
             <div class="ibox float-e-margins">
                 <div class="ibox-title">
-                    <span class="label label-info pull-right"></span>
-                    <h5>粉丝</h5>
+                    <span class="label label-info pull-right"></span>
+                    <h5>阳光</h5>
                 </div>
                 <div class="ibox-content">
-                    <h1 class="no-margins">{$first_line.month.data}</h1>
-                    <div class="stat-percent font-bold text-info">
-                        {$first_line.month.percent}%
-                        {if condition='$first_line.month.is_plus egt 0'}<i class="fa {if condition='$first_line.month.is_plus eq 1'}fa-level-up{else /}fa-level-down{/if}"></i>{/if}
-                    </div>
-                    <small><a href="javascript:;" class="opFrames" data-name="会员管理" data-href="{:Url('user.user/index')}">本月新增粉丝</a></small>
+                    <h1 class="no-margins">{$integral}</h1>
+                    <small><a href="javascript:;" class="opFrames" data-name="会员管理" data-href="{:Url('user.user/index')}">剩余阳光</a></small>
                 </div>
             </div>
         </div>

+ 0 - 3
app/api/controller/many/ManyController.php

@@ -199,7 +199,6 @@ class ManyController
                 if (!$data['name'])  return app('json')->fail('姓名不能为空');
                 $pay['payment'] = $data['payment'];
                 $pay['name'] = $data['name'];
-                $pay['phone'] = $data['phone'];
             }elseif ($data['type'] == 3){
                 // 银行卡收款方式
                 if (!$data['payment'])  return app('json')->fail('银行卡号不能为空');
@@ -225,8 +224,6 @@ class ManyController
                 // 支付宝收款方式
                 if (!$data['payment'])  return app('json')->fail('支付宝账号不能为空');
                 if (!$data['name'])  return app('json')->fail('姓名不能为空');
-                if (!$data['phone'])  return app('json')->fail('请填写手机号');
-
             }elseif ($data['type'] == 3){
                 // 银行卡收款方式
                 if (!$data['payment'])  return app('json')->fail('银行卡号不能为空');

+ 14 - 6
app/models/many/Many.php

@@ -71,16 +71,24 @@ class Many extends BaseModel
         $many = self::where('end_time', '<', time())->where('status', '=', 1)->select();//找到结束为完成的场次
         if ($many) {
             foreach ($many as $item) {
-                $stage = [$item['stage']];//指定期数
-                $stages = [$item['stage'] - 2, $item['stage'] - 1, $item['stage'] - 3];//指定期数
+                $stage = [$item['stage'],$item['stage'] - 3];//指定期数
+                $stages = [$item['stage'] - 2, $item['stage'] - 1];//指定期数
                 $many_order = ManyOrder::where('many_id', $item['id'])->where('status', '=', 0)->where('stage', 'in', $stage)->select();// 找到这期和三期前订单
                 $order = ManyOrder::where('many_id', '=', $item['id'])->where('status', '=', 0)->where('stage', 'in', $stages)->select()->toArray();// 找到这期和三期前中间两期订单
                 if ($many_order) {
                     foreach ($many_order as $value) {
-                        $user = User::where('uid', $value['uid'])->find();
-                        $user['white_integral'] += $value['price'] * 1.01;// 返还
-                        $user->save();
-                        UserBill::income('种树失败返还肥料', $value['uid'], 'white_integral', 'sbfh_white_integral', $value['price'] * 1.01, 0, $user['white_integral'], '种树失败返还' . $item['name'] . '-第' . $value['stage'] . '期肥料');
+                        if ($value['frozen'] > 0){
+                            $user = User::where('uid', $value['uid'])->find();
+                            $user['white_integral'] += $value['frozen'];// 返还
+                            $user->save();
+                            UserBill::income('种树失败返还肥料', $value['uid'], 'white_integral', 'sbfh_white_integral', $value['frozen'], 0, $user['white_integral'], '种树失败返还' . $item['name'] . '-第' . $value['stage'] . '期肥料');
+                        }else{
+                            $user = User::where('uid', $value['uid'])->find();
+                            $user['white_integral'] += $value['price'];// 返还
+                            $user->save();
+                            UserBill::income('种树失败返还肥料', $value['uid'], 'white_integral', 'sbfh_white_integral', $value['price'], 0, $user['white_integral'], '种树失败返还' . $item['name'] . '-第' . $value['stage'] . '期肥料');
+                        }
+
                     }
                     if ($order) {
                         foreach ($order as $value) {