|
|
@@ -160,6 +160,35 @@ class Common extends BaseController
|
|
160
|
160
|
*/
|
|
161
|
161
|
public function orderNum(StoreOrderRepository $repository)
|
|
162
|
162
|
{
|
|
|
163
|
+ $weekWhere = " 1=1";
|
|
|
164
|
+ $dayWhere = " 1=1";
|
|
|
165
|
+ // 获取今天的日期和时间
|
|
|
166
|
+ $today = new \DateTime();
|
|
|
167
|
+ // 格式化日期
|
|
|
168
|
+ $todayFormatted = $today->format('Y-m-d');
|
|
|
169
|
+ //今日时间条件
|
|
|
170
|
+ $dayWhere .= " and DATE(create_time) = '" . $todayFormatted . "'";
|
|
|
171
|
+
|
|
|
172
|
+ //线上订单
|
|
|
173
|
+ $todayShangCount = Db::name('store_order')->where($dayWhere)->where('paid', 1)->count();
|
|
|
174
|
+
|
|
|
175
|
+ //线下订单
|
|
|
176
|
+ $todayXiaCount = Db::name('order_merchant')->where($dayWhere)->where('paid', 1)->count();
|
|
|
177
|
+
|
|
|
178
|
+ //今日新增用户
|
|
|
179
|
+ $userDayCount = Db::name('user')->where($dayWhere)->count();
|
|
|
180
|
+
|
|
|
181
|
+ //今日新增会员
|
|
|
182
|
+ $dayWhereNew = str_replace("create_time", "identity_up_time", $dayWhere);
|
|
|
183
|
+ $userHyDayCount = Db::name('user')->where($dayWhereNew)->where('user_group', '>', 1)->count();
|
|
|
184
|
+
|
|
|
185
|
+ //游客数量
|
|
|
186
|
+ $todayXiaCount = Db::name('order_merchant')->where($dayWhere)->where('paid', 1)->where('uid', 0)->count();
|
|
|
187
|
+
|
|
|
188
|
+ //商户数量
|
|
|
189
|
+ $maker = Db::query("SELECT count(uid) as count FROM `rrx_merchant` where {$dayWhere}");
|
|
|
190
|
+ $merchantCount = $maker[0]['count'] ?? 0;
|
|
|
191
|
+
|
|
163
|
192
|
$orderNum = $repository->dayOrderNum('today');
|
|
164
|
193
|
$yesterdayNum = $repository->dayOrderNum('yesterday');
|
|
165
|
194
|
$today = $repository->dayOrderNumGroup('today')->toArray();
|
|
|
@@ -177,7 +206,11 @@ class Common extends BaseController
|
|
177
|
206
|
];
|
|
178
|
207
|
}
|
|
179
|
208
|
$today = $data;
|
|
180
|
|
- return app('json')->success(compact('orderNum', 'today', 'monthOrderNum', 'monthRate', 'orderRate'));
|
|
|
209
|
+
|
|
|
210
|
+ //贡献值排行
|
|
|
211
|
+ $gxz_users = Db::name('user')->order('contribute', 'desc')->field('uid,nickname,contribute')->limit(6)->select();
|
|
|
212
|
+
|
|
|
213
|
+ return app('json')->success(compact('today', 'todayShangCount', 'todayXiaCount', 'userDayCount', 'userHyDayCount', 'merchantCount', 'gxz_users'));
|
|
181
|
214
|
}
|
|
182
|
215
|
|
|
183
|
216
|
/**
|