|
|
@@ -28,142 +28,217 @@ class FinanceRepository extends BaseRepository
|
|
28
|
28
|
*/
|
|
29
|
29
|
public function order_overview($mer_id = 0)
|
|
30
|
30
|
{
|
|
31
|
|
- // if ($mer_id) {
|
|
32
|
|
- // $where = "mer_id = " . $mer_id . " and paid = 1";
|
|
33
|
|
- // } else {
|
|
|
31
|
+ if ($mer_id) {
|
|
|
32
|
+ $where = "mer_id = " . $mer_id . " and paid = 1";
|
|
|
33
|
+ $type = input('type', 1);
|
|
|
34
|
+ $day = input('day', '');
|
|
|
35
|
+
|
|
|
36
|
+ if ($type == 1 and $day != '') {
|
|
|
37
|
+ $where .= " and DATE(pay_time) = '" . $day . "'";
|
|
|
38
|
+ }
|
|
|
39
|
+ if ($type == 2 and $day != '') {
|
|
|
40
|
+ $date = new \DateTime($day);
|
|
|
41
|
+ $year = $date->format('Y');
|
|
|
42
|
+ $month = $date->format('m');
|
|
|
43
|
+
|
|
|
44
|
+ $where .= " and YEAR(pay_time) = " . $year . " AND MONTH(pay_time) = " . $month;
|
|
|
45
|
+ }
|
|
|
46
|
+ $xianshangzhifu = Db::name('store_order')->where($where)->whereIn('pay_type', [0, 1])->sum('pay_price');
|
|
|
47
|
+ $xianshangzhifu_xuni = Db::name('store_order')->where($where)->where('pay_type', 0)->sum('pay_price');
|
|
|
48
|
+ $hongjifenxiaofei = Db::name('store_order')->where($where)->where("pay_type", 5)->sum('pay_price');
|
|
|
49
|
+
|
|
|
50
|
+ $chengjiaomoney = decimal2($xianshangzhifu + $hongjifenxiaofei);
|
|
|
51
|
+ $list1[] = ['count' => set_price_rtrim($xianshangzhifu), 'name' => '线上支付金额'];
|
|
|
52
|
+ if (!$mer_id) {
|
|
|
53
|
+ $list1[] = ['count' => set_price_rtrim($xianshangzhifu_xuni), 'name' => '虚拟支付金额'];
|
|
|
54
|
+ }
|
|
|
55
|
+ $list1[] = ['count' => 0, 'name' => '代付金额'];
|
|
|
56
|
+ $xianshangzhifunum = Db::name('store_order')->where($where)->whereIn('pay_type', [0, 1])->count();
|
|
|
57
|
+ $xianshangzhifunum_xuni = Db::name('store_order')->where($where)->where('pay_type', 0)->count();
|
|
|
58
|
+ $hongjifenxiaofeinum = Db::name('store_order')->where($where)->where("pay_type", 5)->count();
|
|
|
59
|
+
|
|
|
60
|
+ $chengjiaocount = $xianshangzhifunum + $hongjifenxiaofeinum;
|
|
|
61
|
+
|
|
|
62
|
+ $list2[] = ['count' => $xianshangzhifunum, 'name' => '线上支付订单量'];
|
|
|
63
|
+ if (!$mer_id) {
|
|
|
64
|
+ $list2[] = ['count' => $xianshangzhifunum_xuni, 'name' => '虚拟支付订单量'];
|
|
|
65
|
+ }
|
|
|
66
|
+ $list2[] = ['count' => 0, 'name' => '代付订单量'];
|
|
|
67
|
+ $xianshangzhifuren = Db::name('store_order')->where($where)->whereIn('pay_type', [0, 1])->group('uid')->count();
|
|
|
68
|
+ $xianshangzhifuren_xuni = Db::name('store_order')->where($where)->where('pay_type', 0)->group('uid')->count();
|
|
|
69
|
+ $hongjifenxiaofeiren = Db::name('store_order')->where($where)->where("pay_type", 5)->group('uid')->count();
|
|
|
70
|
+
|
|
|
71
|
+ $chengjiaoren = Db::name('store_order')->where($where)->whereIn('pay_type', [0, 1, 5])->group('uid')->count();
|
|
|
72
|
+ $list3[] = ['count' => set_price_rtrim($xianshangzhifuren), 'name' => '线上支付人数'];
|
|
|
73
|
+ if (!$mer_id) {
|
|
|
74
|
+ $list3[] = ['count' => set_price_rtrim($xianshangzhifuren_xuni), 'name' => '虚拟支付人数'];
|
|
|
75
|
+ }
|
|
|
76
|
+ $list3[] = ['count' => 0, 'name' => '代付人数'];
|
|
|
77
|
+
|
|
|
78
|
+
|
|
|
79
|
+ $xianshangtuikuan = Db::name('store_order')->where($where)->where('status', -1)->sum('pay_price');
|
|
|
80
|
+
|
|
|
81
|
+ $tuikuanmoney = $xianshangtuikuan;
|
|
|
82
|
+ $list4 = array(
|
|
|
83
|
+ array('count' => $xianshangtuikuan, 'name' => '线上支付退单'),
|
|
|
84
|
+ array('count' => 0, 'name' => '代付退单'),
|
|
|
85
|
+ );
|
|
|
86
|
+ $xianshangzhifutuinum = Db::name('store_order')->where($where)->where('status', -1)->count();
|
|
|
87
|
+
|
|
|
88
|
+ $tuikuancount = $xianshangzhifutuinum;
|
|
|
89
|
+ $list5 = array(
|
|
|
90
|
+ array('count' => set_price_rtrim($xianshangzhifutuinum), 'name' => '线上支付退单量'),
|
|
|
91
|
+ array('count' => 0, 'name' => '代付退单量'),
|
|
|
92
|
+ );
|
|
|
93
|
+ $xianshangzhifutuiremn = Db::name('store_order')->where($where)->where('status', -1)->group('uid')->count();
|
|
|
94
|
+
|
|
|
95
|
+ $tuikuanren = $xianshangzhifutuiremn;
|
|
|
96
|
+ $list6 = array(
|
|
|
97
|
+ array('count' => set_price_rtrim($xianshangzhifutuiremn), 'name' => '线上支付退单人数'),
|
|
|
98
|
+ array('count' => 0, 'name' => '代付退单数'),
|
|
|
99
|
+ );
|
|
|
100
|
+
|
|
|
101
|
+
|
|
|
102
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaomoney), 'name' => '成交金额', 'list' => $list1];
|
|
|
103
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaocount), 'name' => '成交订单量', 'list' => $list2];
|
|
|
104
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaoren), 'name' => '支付人数', 'list' => $list3];
|
|
|
105
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuanmoney), 'name' => '退款金额', 'list' => $list4];
|
|
|
106
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuancount), 'name' => '退款订单量', 'list' => $list5];
|
|
|
107
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuanren), 'name' => '退款人数', 'list' => $list6];
|
|
|
108
|
+ return $data;
|
|
|
109
|
+ } else {
|
|
34
|
110
|
$where = " paid = 1";
|
|
35
|
|
- // }
|
|
36
|
|
-
|
|
37
|
|
- $type = input('type', 1);
|
|
38
|
|
- $day = input('day', '');
|
|
39
|
|
- //天
|
|
40
|
|
- if ($type == 1 and $day != '') {
|
|
41
|
|
- $where .= " and DATE(create_time) = '" . $day . "'";
|
|
42
|
|
- }
|
|
43
|
|
- //月
|
|
44
|
|
- if ($type == 2 and $day != '') {
|
|
45
|
|
- $date = new \DateTime($day);
|
|
46
|
|
- $year = $date->format('Y');
|
|
47
|
|
- $month = $date->format('m');
|
|
48
|
|
- $where .= " and YEAR(create_time) = " . $year . " AND MONTH(create_time) = " . $month;
|
|
|
111
|
+ $type = input('type', 1);
|
|
|
112
|
+ $day = input('day', '');
|
|
|
113
|
+ //天
|
|
|
114
|
+ if ($type == 1 and $day != '') {
|
|
|
115
|
+ $where .= " and DATE(create_time) = '" . $day . "'";
|
|
|
116
|
+ }
|
|
|
117
|
+ //月
|
|
|
118
|
+ if ($type == 2 and $day != '') {
|
|
|
119
|
+ $date = new \DateTime($day);
|
|
|
120
|
+ $year = $date->format('Y');
|
|
|
121
|
+ $month = $date->format('m');
|
|
|
122
|
+ $where .= " and YEAR(create_time) = " . $year . " AND MONTH(create_time) = " . $month;
|
|
|
123
|
+ }
|
|
|
124
|
+
|
|
|
125
|
+ $weekWhere = " paid = 1";
|
|
|
126
|
+ $dayWhere = " paid = 1";
|
|
|
127
|
+ // 获取今天的日期和时间
|
|
|
128
|
+ $today = new \DateTime();
|
|
|
129
|
+ // 计算一周前的日期
|
|
|
130
|
+ $oneWeekAgo = clone $today; // 克隆一个对象,避免修改原始对象
|
|
|
131
|
+ $oneWeekAgo->sub(new \DateInterval('P1W')); // 减去一周
|
|
|
132
|
+
|
|
|
133
|
+ // 格式化日期
|
|
|
134
|
+ $todayFormatted = $today->format('Y-m-d');
|
|
|
135
|
+ $oneWeekAgoFormatted = $oneWeekAgo->format('Y-m-d');
|
|
|
136
|
+
|
|
|
137
|
+ //周时间条件
|
|
|
138
|
+ $weekWhere .= " and DATE(create_time) >= '" . $oneWeekAgoFormatted . "' and DATE(create_time) <= '" . $todayFormatted . "'";
|
|
|
139
|
+ //今日时间条件
|
|
|
140
|
+ $dayWhere .= " and DATE(create_time) = '" . $todayFormatted . "'";
|
|
|
141
|
+
|
|
|
142
|
+
|
|
|
143
|
+ // 会员专区订单总数
|
|
|
144
|
+ //总数
|
|
|
145
|
+ $chengjiaomoney = Db::name('store_order')->where($where)->where('mer_id', 496)->count();
|
|
|
146
|
+ $weekCount = Db::name('store_order')->where($weekWhere)->where('mer_id', 496)->count();
|
|
|
147
|
+ $todayCount = Db::name('store_order')->where($dayWhere)->where('mer_id', 496)->count();
|
|
|
148
|
+ $list1[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
|
149
|
+ $list1[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
|
150
|
+
|
|
|
151
|
+ //精彩生活区订单总数
|
|
|
152
|
+ //总数
|
|
|
153
|
+ $chengjiaocount = Db::name('store_order')->where($where)->where('mer_id', 439)->count();
|
|
|
154
|
+ $weekCount = Db::name('store_order')->where($weekWhere)->where('mer_id', 439)->count();
|
|
|
155
|
+ $todayCount = Db::name('store_order')->where($dayWhere)->where('mer_id', 439)->count();
|
|
|
156
|
+ $list2[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
|
157
|
+ $list2[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
|
158
|
+
|
|
|
159
|
+ //商贸区订单总数
|
|
|
160
|
+ //总数
|
|
|
161
|
+ $chengjiaoren = Db::name('store_order')->where($where)->whereNotIn('mer_id', [496, 439, 491])->count();
|
|
|
162
|
+ $weekCount = Db::name('store_order')->where($weekWhere)->whereNotIn('mer_id', [496, 439, 491])->count();
|
|
|
163
|
+ $todayCount = Db::name('store_order')->where($dayWhere)->whereNotIn('mer_id', [496, 439, 491])->count();
|
|
|
164
|
+ $list3[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
|
165
|
+ $list3[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
|
166
|
+
|
|
|
167
|
+ //复购区订单总数
|
|
|
168
|
+ //总数
|
|
|
169
|
+ $tuikuanmoney = Db::name('store_order')->where($where)->where('mer_id', 491)->count();
|
|
|
170
|
+ $weekCount = Db::name('store_order')->where($weekWhere)->where('mer_id', 491)->count();
|
|
|
171
|
+ $todayCount = Db::name('store_order')->where($dayWhere)->where('mer_id', 491)->count();
|
|
|
172
|
+ $list4[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
|
173
|
+ $list4[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
|
174
|
+
|
|
|
175
|
+ //三方平台订单总数
|
|
|
176
|
+ //总数
|
|
|
177
|
+
|
|
|
178
|
+ //话费
|
|
|
179
|
+ $whereNew = str_replace("paid", "status", $where);
|
|
|
180
|
+ $weekWhereNew = str_replace("paid", "status", $weekWhere);
|
|
|
181
|
+ $dayWhereNew = str_replace("paid", "status", $dayWhere);
|
|
|
182
|
+ $huafei = Db::name('order_huafei_hf')->where($whereNew)->count();
|
|
|
183
|
+ $huafei_week = Db::name('order_huafei_hf')->where($weekWhereNew)->count();
|
|
|
184
|
+ $huafei_today = Db::name('order_huafei_hf')->where($dayWhereNew)->count();
|
|
|
185
|
+
|
|
|
186
|
+
|
|
|
187
|
+ //京东
|
|
|
188
|
+ $whereNew = str_replace(" paid = 1", " status IN (16, 17)", $where);
|
|
|
189
|
+ $weekWhereNew = str_replace(" paid = 1", " status IN (16, 17)", $weekWhere);
|
|
|
190
|
+ $dayWhereNew = str_replace(" paid = 1", " status IN (16, 17)", $dayWhere);
|
|
|
191
|
+ $jd = Db::name('order_jd')->where($whereNew)->count();
|
|
|
192
|
+ $jd_week = Db::name('order_jd')->where($weekWhereNew)->count();
|
|
|
193
|
+ $jd_today = Db::name('order_jd')->where($dayWhereNew)->count();
|
|
|
194
|
+
|
|
|
195
|
+ //拼多多
|
|
|
196
|
+ $whereNew = str_replace(" paid = 1", " pin_order_status IN (0, 2, 3)", $where);
|
|
|
197
|
+ $weekWhereNew = str_replace(" paid = 1", " pin_order_status IN (0, 2, 3)", $weekWhere);
|
|
|
198
|
+ $dayWhereNew = str_replace(" paid = 1", " pin_order_status IN (0, 2, 3)", $dayWhere);
|
|
|
199
|
+ $pdd = Db::name('order_pdd')->where($whereNew)->count();
|
|
|
200
|
+ $pdd_week = Db::name('order_pdd')->where($weekWhereNew)->count();
|
|
|
201
|
+ $pdd_today = Db::name('order_pdd')->where($dayWhereNew)->count();
|
|
|
202
|
+
|
|
|
203
|
+ //淘宝
|
|
|
204
|
+ $whereNew = str_replace(" paid = 1", " tk_status IN (12, 3)", $where);
|
|
|
205
|
+ $weekWhereNew = str_replace(" paid = 1", " tk_status IN (12, 3)", $weekWhere);
|
|
|
206
|
+ $dayWhereNew = str_replace(" paid = 1", " tk_status IN (12, 3)", $dayWhere);
|
|
|
207
|
+ $tb = Db::name('order_tb')->where($whereNew)->count();
|
|
|
208
|
+ $tb_week = Db::name('order_tb')->where($weekWhereNew)->count();
|
|
|
209
|
+ $tb_today = Db::name('order_tb')->where($dayWhereNew)->count();
|
|
|
210
|
+
|
|
|
211
|
+ //电影票
|
|
|
212
|
+ $whereNew = str_replace(" paid = 1", " status IN (1, 4)", $where);
|
|
|
213
|
+ $weekWhereNew = str_replace(" paid = 1", " status IN (1, 4)", $weekWhere);
|
|
|
214
|
+ $dayWhereNew = str_replace(" paid = 1", " status IN (1, 4)", $dayWhere);
|
|
|
215
|
+ $movie = Db::name('order_movie')->where($whereNew)->count();
|
|
|
216
|
+ $movie_week = Db::name('order_movie')->where($weekWhereNew)->count();
|
|
|
217
|
+ $movie_today = Db::name('order_movie')->where($dayWhereNew)->count();
|
|
|
218
|
+
|
|
|
219
|
+ $tuikuancount = $huafei+$jd+$pdd+$tb+$movie;
|
|
|
220
|
+ $weekCount = $huafei_week+$jd_week+$pdd_week+$tb_week+$movie_week;
|
|
|
221
|
+ $todayCount = $huafei_today+$jd_today+$pdd_today+$tb_today+$movie_today;
|
|
|
222
|
+ $list5[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
|
223
|
+ $list5[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
|
224
|
+
|
|
|
225
|
+ //线下订单总数
|
|
|
226
|
+ //总数
|
|
|
227
|
+ $tuikuanren = Db::name('order_merchant')->where($where)->count();
|
|
|
228
|
+ $weekCount = Db::name('order_merchant')->where($weekWhere)->count();
|
|
|
229
|
+ $todayCount = Db::name('order_merchant')->where($dayWhere)->count();
|
|
|
230
|
+ $list6[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
|
231
|
+ $list6[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
|
232
|
+
|
|
|
233
|
+
|
|
|
234
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaomoney), 'name' => '会员专区订单总数', 'list' => $list1];
|
|
|
235
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaocount), 'name' => '精彩生活区订单总数', 'list' => $list2];
|
|
|
236
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaoren), 'name' => '商贸区订单总数', 'list' => $list3];
|
|
|
237
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuanmoney), 'name' => '复购区订单总数', 'list' => $list4];
|
|
|
238
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuancount), 'name' => '三方平台订单总数', 'list' => $list5];
|
|
|
239
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuanren), 'name' => '线下订单总数', 'list' => $list6];
|
|
|
240
|
+ return $data;
|
|
49
|
241
|
}
|
|
50
|
|
-
|
|
51
|
|
- $weekWhere = " paid = 1";
|
|
52
|
|
- $dayWhere = " paid = 1";
|
|
53
|
|
- // 获取今天的日期和时间
|
|
54
|
|
- $today = new \DateTime();
|
|
55
|
|
- // 计算一周前的日期
|
|
56
|
|
- $oneWeekAgo = clone $today; // 克隆一个对象,避免修改原始对象
|
|
57
|
|
- $oneWeekAgo->sub(new \DateInterval('P1W')); // 减去一周
|
|
58
|
|
-
|
|
59
|
|
- // 格式化日期
|
|
60
|
|
- $todayFormatted = $today->format('Y-m-d');
|
|
61
|
|
- $oneWeekAgoFormatted = $oneWeekAgo->format('Y-m-d');
|
|
62
|
|
-
|
|
63
|
|
- //周时间条件
|
|
64
|
|
- $weekWhere .= " and DATE(create_time) >= '" . $oneWeekAgoFormatted . "' and DATE(create_time) <= '" . $todayFormatted . "'";
|
|
65
|
|
- //今日时间条件
|
|
66
|
|
- $dayWhere .= " and DATE(create_time) = '" . $todayFormatted . "'";
|
|
67
|
|
-
|
|
68
|
|
-
|
|
69
|
|
- // 会员专区订单总数
|
|
70
|
|
- //总数
|
|
71
|
|
- $chengjiaomoney = Db::name('store_order')->where($where)->where('mer_id', 496)->count();
|
|
72
|
|
- $weekCount = Db::name('store_order')->where($weekWhere)->where('mer_id', 496)->count();
|
|
73
|
|
- $todayCount = Db::name('store_order')->where($dayWhere)->where('mer_id', 496)->count();
|
|
74
|
|
- $list1[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
75
|
|
- $list1[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
76
|
|
-
|
|
77
|
|
- //精彩生活区订单总数
|
|
78
|
|
- //总数
|
|
79
|
|
- $chengjiaocount = Db::name('store_order')->where($where)->where('mer_id', 439)->count();
|
|
80
|
|
- $weekCount = Db::name('store_order')->where($weekWhere)->where('mer_id', 439)->count();
|
|
81
|
|
- $todayCount = Db::name('store_order')->where($dayWhere)->where('mer_id', 439)->count();
|
|
82
|
|
- $list2[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
83
|
|
- $list2[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
84
|
|
-
|
|
85
|
|
- //商贸区订单总数
|
|
86
|
|
- //总数
|
|
87
|
|
- $chengjiaoren = Db::name('store_order')->where($where)->whereNotIn('mer_id', [496, 439, 491])->count();
|
|
88
|
|
- $weekCount = Db::name('store_order')->where($weekWhere)->whereNotIn('mer_id', [496, 439, 491])->count();
|
|
89
|
|
- $todayCount = Db::name('store_order')->where($dayWhere)->whereNotIn('mer_id', [496, 439, 491])->count();
|
|
90
|
|
- $list3[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
91
|
|
- $list3[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
92
|
|
-
|
|
93
|
|
- //复购区订单总数
|
|
94
|
|
- //总数
|
|
95
|
|
- $tuikuanmoney = Db::name('store_order')->where($where)->where('mer_id', 491)->count();
|
|
96
|
|
- $weekCount = Db::name('store_order')->where($weekWhere)->where('mer_id', 491)->count();
|
|
97
|
|
- $todayCount = Db::name('store_order')->where($dayWhere)->where('mer_id', 491)->count();
|
|
98
|
|
- $list4[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
99
|
|
- $list4[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
100
|
|
-
|
|
101
|
|
- //三方平台订单总数
|
|
102
|
|
- //总数
|
|
103
|
|
-
|
|
104
|
|
- //话费
|
|
105
|
|
- $whereNew = str_replace("paid", "status", $where);
|
|
106
|
|
- $weekWhereNew = str_replace("paid", "status", $weekWhere);
|
|
107
|
|
- $dayWhereNew = str_replace("paid", "status", $dayWhere);
|
|
108
|
|
- $huafei = Db::name('order_huafei_hf')->where($whereNew)->count();
|
|
109
|
|
- $huafei_week = Db::name('order_huafei_hf')->where($weekWhereNew)->count();
|
|
110
|
|
- $huafei_today = Db::name('order_huafei_hf')->where($dayWhereNew)->count();
|
|
111
|
|
-
|
|
112
|
|
-
|
|
113
|
|
- //京东
|
|
114
|
|
- $whereNew = str_replace(" paid = 1", " status IN (16, 17)", $where);
|
|
115
|
|
- $weekWhereNew = str_replace(" paid = 1", " status IN (16, 17)", $weekWhere);
|
|
116
|
|
- $dayWhereNew = str_replace(" paid = 1", " status IN (16, 17)", $dayWhere);
|
|
117
|
|
- $jd = Db::name('order_jd')->where($whereNew)->count();
|
|
118
|
|
- $jd_week = Db::name('order_jd')->where($weekWhereNew)->count();
|
|
119
|
|
- $jd_today = Db::name('order_jd')->where($dayWhereNew)->count();
|
|
120
|
|
-
|
|
121
|
|
- //拼多多
|
|
122
|
|
- $whereNew = str_replace(" paid = 1", " pin_order_status IN (0, 2, 3)", $where);
|
|
123
|
|
- $weekWhereNew = str_replace(" paid = 1", " pin_order_status IN (0, 2, 3)", $weekWhere);
|
|
124
|
|
- $dayWhereNew = str_replace(" paid = 1", " pin_order_status IN (0, 2, 3)", $dayWhere);
|
|
125
|
|
- $pdd = Db::name('order_pdd')->where($whereNew)->count();
|
|
126
|
|
- $pdd_week = Db::name('order_pdd')->where($weekWhereNew)->count();
|
|
127
|
|
- $pdd_today = Db::name('order_pdd')->where($dayWhereNew)->count();
|
|
128
|
|
-
|
|
129
|
|
- //淘宝
|
|
130
|
|
- $whereNew = str_replace(" paid = 1", " tk_status IN (12, 3)", $where);
|
|
131
|
|
- $weekWhereNew = str_replace(" paid = 1", " tk_status IN (12, 3)", $weekWhere);
|
|
132
|
|
- $dayWhereNew = str_replace(" paid = 1", " tk_status IN (12, 3)", $dayWhere);
|
|
133
|
|
- $tb = Db::name('order_tb')->where($whereNew)->count();
|
|
134
|
|
- $tb_week = Db::name('order_tb')->where($weekWhereNew)->count();
|
|
135
|
|
- $tb_today = Db::name('order_tb')->where($dayWhereNew)->count();
|
|
136
|
|
-
|
|
137
|
|
- //电影票
|
|
138
|
|
- $whereNew = str_replace(" paid = 1", " status IN (1, 4)", $where);
|
|
139
|
|
- $weekWhereNew = str_replace(" paid = 1", " status IN (1, 4)", $weekWhere);
|
|
140
|
|
- $dayWhereNew = str_replace(" paid = 1", " status IN (1, 4)", $dayWhere);
|
|
141
|
|
- $movie = Db::name('order_movie')->where($whereNew)->count();
|
|
142
|
|
- $movie_week = Db::name('order_movie')->where($weekWhereNew)->count();
|
|
143
|
|
- $movie_today = Db::name('order_movie')->where($dayWhereNew)->count();
|
|
144
|
|
-
|
|
145
|
|
- $tuikuancount = $huafei+$jd+$pdd+$tb+$movie;
|
|
146
|
|
- $weekCount = $huafei_week+$jd_week+$pdd_week+$tb_week+$movie_week;
|
|
147
|
|
- $todayCount = $huafei_today+$jd_today+$pdd_today+$tb_today+$movie_today;
|
|
148
|
|
- $list5[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
149
|
|
- $list5[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
150
|
|
-
|
|
151
|
|
- //线下订单总数
|
|
152
|
|
- //总数
|
|
153
|
|
- $tuikuanren = Db::name('order_merchant')->where($where)->count();
|
|
154
|
|
- $weekCount = Db::name('order_merchant')->where($weekWhere)->count();
|
|
155
|
|
- $todayCount = Db::name('order_merchant')->where($dayWhere)->count();
|
|
156
|
|
- $list6[] = ['count' => $weekCount, 'name' => '周订单总数'];
|
|
157
|
|
- $list6[] = ['count' => $todayCount, 'name' => '日订单总数'];
|
|
158
|
|
-
|
|
159
|
|
-
|
|
160
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaomoney), 'name' => '会员专区订单总数', 'list' => $list1];
|
|
161
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaocount), 'name' => '精彩生活区订单总数', 'list' => $list2];
|
|
162
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($chengjiaoren), 'name' => '商贸区订单总数', 'list' => $list3];
|
|
163
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuanmoney), 'name' => '复购区订单总数', 'list' => $list4];
|
|
164
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuancount), 'name' => '三方平台订单总数', 'list' => $list5];
|
|
165
|
|
- $data[] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($tuikuanren), 'name' => '线下订单总数', 'list' => $list6];
|
|
166
|
|
- return $data;
|
|
167
|
242
|
}
|
|
168
|
243
|
|
|
169
|
244
|
/**
|
|
|
@@ -184,43 +259,97 @@ class FinanceRepository extends BaseRepository
|
|
184
|
259
|
$chilid_userids_string = implode(',',$chilid_userids);
|
|
185
|
260
|
}
|
|
186
|
261
|
$where .= "and uid in ({$chilid_userids_string})";
|
|
187
|
|
- }
|
|
188
|
|
- $type = input('type', 1);
|
|
189
|
|
- $day = input('day', '');
|
|
190
|
262
|
|
|
191
|
|
- if ($type == 1 and $day != '') {
|
|
192
|
|
- $where .= " and DATE(create_time) = '" . $day . "'";
|
|
193
|
|
- }
|
|
194
|
|
- if ($type == 2 and $day != '') {
|
|
195
|
|
- $date = new \DateTime($day);
|
|
196
|
|
- $year = $date->format('Y');
|
|
197
|
|
- $month = $date->format('m');
|
|
198
|
|
- $where .= " and YEAR(create_time) = " . $year . " AND MONTH(create_time) = " . $month;
|
|
|
263
|
+ $where = "1=1 ";
|
|
|
264
|
+ if ($mer_id) {
|
|
|
265
|
+ $mer_uid = Db::name('merchant')->where('mer_id', $mer_id)->value('uid');
|
|
|
266
|
+ $userRepository = app()->make(UserRepository::class);
|
|
|
267
|
+ $chilid_userids = $userRepository->getSpreadUidBreak($mer_uid);
|
|
|
268
|
+ $chilid_userids_string = "1";
|
|
|
269
|
+ if (!empty($chilid_userids)) {
|
|
|
270
|
+ $chilid_userids_string = implode(',',$chilid_userids);
|
|
|
271
|
+ }
|
|
|
272
|
+ $where .= "and uid in ({$chilid_userids_string})";
|
|
|
273
|
+ }
|
|
|
274
|
+ $type = input('type', 1);
|
|
|
275
|
+ $day = input('day', '');
|
|
|
276
|
+
|
|
|
277
|
+ if ($type == 1 and $day != '') {
|
|
|
278
|
+ $where .= " and DATE(create_time) = '" . $day . "'";
|
|
|
279
|
+ }
|
|
|
280
|
+ if ($type == 2 and $day != '') {
|
|
|
281
|
+ $date = new \DateTime($day);
|
|
|
282
|
+ $year = $date->format('Y');
|
|
|
283
|
+ $month = $date->format('m');
|
|
|
284
|
+ $where .= " and YEAR(create_time) = " . $year . " AND MONTH(create_time) = " . $month;
|
|
|
285
|
+ }
|
|
|
286
|
+ $dataQuery = Db::query("SELECT user_group,count(uid) count FROM `rrx_user` where {$where} group by user_group");
|
|
|
287
|
+ $dataQuery = array_column($dataQuery, 'count', 'user_group');
|
|
|
288
|
+ $shopPartnerCount = Db::query("SELECT user_group,count(uid) count FROM `rrx_user` where mer_id={$mer_id} and is_shop_partner=1 group by user_group");
|
|
|
289
|
+
|
|
|
290
|
+ $maker = Db::query("SELECT CONCAT(`user_group`, '-',`is_show`) as k, count(uid) count FROM `rrx_user` where {$where} group by user_group,is_show");
|
|
|
291
|
+ $maker = array_column($maker, 'count', 'k');
|
|
|
292
|
+
|
|
|
293
|
+ $userByCodeCount = Db::query("SELECT 'temp' as `temp1`, count(*) count FROM `rrx_user` where {$where} and user_group =4 and is_show = 3");
|
|
|
294
|
+ $userByCodeCount = array_column($userByCodeCount, 'count', 'temp1');
|
|
|
295
|
+
|
|
|
296
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[1] ?? 0), 'name' => '消费者'];
|
|
|
297
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[2] ?? 0), 'name' => '业务员'];
|
|
|
298
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[3] ?? 0), 'name' => '业务经理'];
|
|
|
299
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[5] ?? 0), 'name' => '初级合伙人'];
|
|
|
300
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[6] ?? 0), 'name' => '中级合伙人'];
|
|
|
301
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[7] ?? 0), 'name' => '高级合伙人'];
|
|
|
302
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[8] ?? 0), 'name' => '董事'];
|
|
|
303
|
+ $list1 = array(
|
|
|
304
|
+ array('className' => 'el-icon-s-goods', 'count' => intval($maker['4-2'] ?? 0), 'name' => '集团会员'),//is_show=2
|
|
|
305
|
+ array('className' => 'el-icon-s-goods', 'count' => intval($maker['4-1'] ?? 0), 'name' => '电商创客'),
|
|
|
306
|
+ array('className' => 'el-icon-s-goods', 'count' => intval($userByCodeCount['temp'] ?? 0), 'name' => '激活创客'),
|
|
|
307
|
+ );
|
|
|
308
|
+
|
|
|
309
|
+ if ($mer_id) {
|
|
|
310
|
+ $data[] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[4] ?? 0), 'name' => '创客'];
|
|
|
311
|
+ }
|
|
|
312
|
+ $res['left'][] = $data;
|
|
|
313
|
+ $res['right'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim(intval($maker['4-2'] ?? 0) + intval($maker['4-1'] ?? 0) + intval($userByCodeCount['temp'] ?? 0)), 'name' => '创客'];
|
|
|
314
|
+ }else{
|
|
|
315
|
+ $type = input('type', 1);
|
|
|
316
|
+ $day = input('day', '');
|
|
|
317
|
+
|
|
|
318
|
+ if ($type == 1 and $day != '') {
|
|
|
319
|
+ $where .= " and DATE(create_time) = '" . $day . "'";
|
|
|
320
|
+ }
|
|
|
321
|
+ if ($type == 2 and $day != '') {
|
|
|
322
|
+ $date = new \DateTime($day);
|
|
|
323
|
+ $year = $date->format('Y');
|
|
|
324
|
+ $month = $date->format('m');
|
|
|
325
|
+ $where .= " and YEAR(create_time) = " . $year . " AND MONTH(create_time) = " . $month;
|
|
|
326
|
+ }
|
|
|
327
|
+ $dataQuery = Db::query("SELECT user_group,count(uid) count FROM `rrx_user` where {$where} group by user_group");
|
|
|
328
|
+ $dataQuery = array_column($dataQuery, 'count', 'user_group');
|
|
|
329
|
+
|
|
|
330
|
+ $maker = Db::query("SELECT CONCAT(`user_group`, '-',`is_show`) as k, count(uid) count FROM `rrx_user` where {$where} group by user_group,is_show");
|
|
|
331
|
+ $maker = array_column($maker, 'count', 'k');
|
|
|
332
|
+
|
|
|
333
|
+
|
|
|
334
|
+ $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[1] ?? 0), 'name' => '消费者'];
|
|
|
335
|
+ $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[2] ?? 0), 'name' => '业务员'];
|
|
|
336
|
+ $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[3] ?? 0), 'name' => '业务经理'];
|
|
|
337
|
+ $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[5] ?? 0), 'name' => '初级合伙人'];
|
|
|
338
|
+ $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[6] ?? 0), 'name' => '中级合伙人'];
|
|
|
339
|
+
|
|
|
340
|
+ $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[7] ?? 0), 'name' => '高级合伙人'];
|
|
|
341
|
+ $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[8] ?? 0), 'name' => '董事'];
|
|
|
342
|
+ $maker = Db::query("SELECT count(uid) as count FROM `rrx_user` where {$where} and originator_id_old > 0");
|
|
|
343
|
+ $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($maker[0]['count'] ?? 0), 'name' => '联创'];
|
|
|
344
|
+
|
|
|
345
|
+ $whereTow = str_replace("uid", "user_id", $where);
|
|
|
346
|
+ $maker = Db::query("SELECT count(user_id) as count FROM `rrx_old_user_stock` where {$whereTow}");
|
|
|
347
|
+
|
|
|
348
|
+ $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($maker[0]['count'] ?? 0), 'name' => '股权'];
|
|
|
349
|
+ $maker = Db::query("SELECT count(uid) as count FROM `rrx_merchant` where {$where}");
|
|
|
350
|
+ $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($maker[0]['count'] ?? 0), 'name' => '商户'];
|
|
|
351
|
+ $res['left'] = $data;
|
|
199
|
352
|
}
|
|
200
|
|
- $dataQuery = Db::query("SELECT user_group,count(uid) count FROM `rrx_user` where {$where} group by user_group");
|
|
201
|
|
- $dataQuery = array_column($dataQuery, 'count', 'user_group');
|
|
202
|
|
-
|
|
203
|
|
- $maker = Db::query("SELECT CONCAT(`user_group`, '-',`is_show`) as k, count(uid) count FROM `rrx_user` where {$where} group by user_group,is_show");
|
|
204
|
|
- $maker = array_column($maker, 'count', 'k');
|
|
205
|
|
-
|
|
206
|
|
-
|
|
207
|
|
- $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[1] ?? 0), 'name' => '消费者'];
|
|
208
|
|
- $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[2] ?? 0), 'name' => '业务员'];
|
|
209
|
|
- $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[3] ?? 0), 'name' => '业务经理'];
|
|
210
|
|
- $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[5] ?? 0), 'name' => '初级合伙人'];
|
|
211
|
|
- $data['one'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[6] ?? 0), 'name' => '中级合伙人'];
|
|
212
|
|
-
|
|
213
|
|
- $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[7] ?? 0), 'name' => '高级合伙人'];
|
|
214
|
|
- $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => (int)($dataQuery[8] ?? 0), 'name' => '董事'];
|
|
215
|
|
- $maker = Db::query("SELECT count(uid) as count FROM `rrx_user` where {$where} and originator_id_old > 0");
|
|
216
|
|
- $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($maker[0]['count'] ?? 0), 'name' => '联创'];
|
|
217
|
|
- $maker = Db::query("SELECT count(user_id) as count FROM `rrx_old_user_stock` where {$where}");
|
|
218
|
|
- $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($maker[0]['count'] ?? 0), 'name' => '股权'];
|
|
219
|
|
- $maker = Db::query("SELECT count(uid) as count FROM `rrx_merchant` where {$where}");
|
|
220
|
|
- $data['tow'][] = ['className' => 'el-icon-s-goods', 'count' => set_price_rtrim($maker[0]['count'] ?? 0), 'name' => '商户'];
|
|
221
|
|
-
|
|
222
|
|
- $res['left'] = $data;
|
|
223
|
|
-
|
|
224
|
353
|
return $res;
|
|
225
|
354
|
}
|
|
226
|
355
|
|