mark 2 år sedan
förälder
incheckning
619e1910ab
3 ändrade filer med 37 tillägg och 0 borttagningar
  1. 10 0
      app/Http/Controllers/User/UserController.php
  2. 19 0
      app/Http/Logic/User/UserLogic.php
  3. 8 0
      public/swagger.json

+ 10 - 0
app/Http/Controllers/User/UserController.php

@@ -59,6 +59,16 @@ class UserController extends BaseController
      *                  property="user_fans_num",
      *                  type="string",
      *                  description="'用户粉丝数量"
+     *              ),
+     *              @SWG\Property(
+     *                  property="last_month_money",
+     *                  type="string",
+     *                  description="'上月预估收益"
+     *              ),
+     *              @SWG\Property(
+     *                  property="month_money",
+     *                  type="string",
+     *                  description="'本月预估收益"
      *              )
      *          )
      *     ),

+ 19 - 0
app/Http/Logic/User/UserLogic.php

@@ -33,6 +33,25 @@ class UserLogic extends BaseLogic
             ->where("user_id",$userId)
             ->where("commission_status",0)
             ->sum("order_commission");//带结算佣金
+        $last_start_time = date("Y-m-d",strtotime("-1 month"))." 00:00:00";
+        $last_end_time = date("Y-m")."-01 00:00:00";
+
+        $start_time = date("Y-m")."-01 00:00:00";
+        $end_time = date("Y-m-d H:i:s");
+
+        $user["last_month_money"] = UserOrderCommissionModel::query()
+            ->where("user_id",$userId)
+            ->whereIn("commission_status",[0,1])
+            ->where("created_at",">=",$last_start_time)
+            ->where("created_at","<=",$last_end_time)
+            ->sum("order_commission");
+
+        $user["month_money"] = UserOrderCommissionModel::query()
+            ->where("user_id",$userId)
+            ->whereIn("commission_status",[0,1])
+            ->where("created_at",">=",$start_time)
+            ->where("created_at","<=",$end_time)
+            ->sum("order_commission");
         return $user;
     }
 

+ 8 - 0
public/swagger.json

@@ -586,6 +586,14 @@
                                 "user_fans_num": {
                                     "description": "'\u7528\u6237\u7c89\u4e1d\u6570\u91cf",
                                     "type": "string"
+                                },
+                                "last_month_money": {
+                                    "description": "'\u4e0a\u6708\u9884\u4f30\u6536\u76ca",
+                                    "type": "string"
+                                },
+                                "month_money": {
+                                    "description": "'\u672c\u6708\u9884\u4f30\u6536\u76ca",
+                                    "type": "string"
                                 }
                             }
                         }