質問編集履歴
3
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
php
|
1
|
+
phpプルダウン作成
|
test
CHANGED
@@ -1,265 +1,3 @@
|
|
1
|
-
|
1
|
+
どうしたらいいでしょうか?
|
2
2
|
|
3
|
-
データベースの中にあるもので
|
4
|
-
|
5
|
-
テーブル作成
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
形的に
|
10
|
-
|
11
|
-
ユーザーID名前総額景品総額差額%に表示させてます
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
その上にプルダウン式で 登録した日付と課金有無を選択できるようにしてます
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
プルダウンで選択して集計後
|
20
|
-
|
21
|
-
|
3
|
+
色々な詳しいサイトなどありましたらお願いします
|
22
|
-
|
23
|
-
その二つの書き方がいまいち分かりません
|
24
|
-
|
25
|
-
uselテーブルのpay_flgが課金有無
|
26
|
-
|
27
|
-
尚未課金者は0課金者は1以上です
|
28
|
-
|
29
|
-
日付はuselテーブルのreg_dateです
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
一つ目のファイル
|
34
|
-
|
35
|
-
<html>
|
36
|
-
|
37
|
-
<head>
|
38
|
-
|
39
|
-
<meta http-equiv="content-type" content="text/html;charset=UTF8;" />
|
40
|
-
|
41
|
-
<head>
|
42
|
-
|
43
|
-
<body>
|
44
|
-
|
45
|
-
<form action="/admin_dice/data/pro" method="post">
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<table border="1" width="700" cellspacing="0" cellpadding="3">
|
50
|
-
|
51
|
-
<tr>
|
52
|
-
|
53
|
-
<td width="80" align="center">登録日範囲指定</td>
|
54
|
-
|
55
|
-
<td width="350">
|
56
|
-
|
57
|
-
<input type="date" name="start" size="15" maxlength="10">-
|
58
|
-
|
59
|
-
<input type="date" name="end" size="15" maxlength="10"><br></td>
|
60
|
-
|
61
|
-
<td width="80" align="center">課金情報</td>
|
62
|
-
|
63
|
-
<td width="350">
|
64
|
-
|
65
|
-
課金有無:
|
66
|
-
|
67
|
-
<select name="code">
|
68
|
-
|
69
|
-
<option value="">-----</option>
|
70
|
-
|
71
|
-
<option value="無課金者">無課金者</option>
|
72
|
-
|
73
|
-
<option value="課金者">課金者</option>
|
74
|
-
|
75
|
-
</select><br />
|
76
|
-
|
77
|
-
</td>
|
78
|
-
|
79
|
-
</tr>
|
80
|
-
|
81
|
-
<tr>
|
82
|
-
|
83
|
-
<td align="center" colspan="4"><input type="submit" name="sum" value="集計 "></td>
|
84
|
-
|
85
|
-
</tr>
|
86
|
-
|
87
|
-
</table>
|
88
|
-
|
89
|
-
</form>
|
90
|
-
|
91
|
-
<br />
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
{if $total_list}
|
98
|
-
|
99
|
-
<table border="1" cellpadding="3" cellspacing="0">
|
100
|
-
|
101
|
-
<tr>
|
102
|
-
|
103
|
-
<td width="100" align="center">ユーザID</td>
|
104
|
-
|
105
|
-
<td width="150" align="center">名前</td>
|
106
|
-
|
107
|
-
<td width="100" align="center">課金総額</td>
|
108
|
-
|
109
|
-
<td width="100" align="center">景品交換総額</td>
|
110
|
-
|
111
|
-
<td width="100" align="center">差額分</td>
|
112
|
-
|
113
|
-
<td width="100" align="center">ペイアウト</td>
|
114
|
-
|
115
|
-
<td width="100" align="center">登録日</td>
|
116
|
-
|
117
|
-
</tr>
|
118
|
-
|
119
|
-
{foreach from=$total_list item=list key=key}
|
120
|
-
|
121
|
-
<tr>
|
122
|
-
|
123
|
-
<td width="100"><a href="//dice-online.jp/admin/user/detail/?id={$list.user_id}" target="_blank">{$list.user_id}</a> {if $list.withdraw}(退会済){/if}</td>
|
124
|
-
|
125
|
-
<td width="150">{if $list.name}{$list.name}{else}未課金のため名前未記入{/if}</td>
|
126
|
-
|
127
|
-
<td width="100" align="right">\ {$list.pay_total|number_format}</td>
|
128
|
-
|
129
|
-
<td width="100" align="right">\ {$list.ex_total|number_format}</td>
|
130
|
-
|
131
|
-
<td width="100" align="right">\ {$list.result|number_format}</td>
|
132
|
-
|
133
|
-
<td width="100" align="right">{if $list.pay_total}{$list.ex_total/$list.pay_total*100|number_format:1} %{else}---{/if}</td>
|
134
|
-
|
135
|
-
<td width="100">{$list.reg_date}</td>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
</tr>
|
142
|
-
|
143
|
-
{/foreach}
|
144
|
-
|
145
|
-
</table>
|
146
|
-
|
147
|
-
{elseif !$total_list}
|
148
|
-
|
149
|
-
<div>選択したデータはありません</div>
|
150
|
-
|
151
|
-
{/if}
|
152
|
-
|
153
|
-
</body>
|
154
|
-
|
155
|
-
</head>
|
156
|
-
|
157
|
-
二つ目のファイル「sql」
|
158
|
-
|
159
|
-
<?php
|
160
|
-
|
161
|
-
$vars = getValues();
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
$pay_user_list = getSalesByUserList("user");
|
166
|
-
|
167
|
-
$pay_withdraw_list = getSalesByUserList("withdraw") ;
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
$exchange_list = getExchangeByUserList();
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
foreach ($exchange_list as $k => $v) {
|
178
|
-
|
179
|
-
$total_list[$k]['ex_total'] = $v['ex_total'];
|
180
|
-
|
181
|
-
$total_list[$k]['user_id'] = $k;
|
182
|
-
|
183
|
-
if ($pay_user_list[$k]['name']) {
|
184
|
-
|
185
|
-
$total_list[$k]['result'] = $pay_user_list[$k]['pay_total'] - $v['ex_total'];
|
186
|
-
|
187
|
-
$total_list[$k]['pay_total'] = $pay_user_list[$k]['pay_total'];
|
188
|
-
|
189
|
-
$total_list[$k]['name'] = $pay_user_list[$k]['name'];
|
190
|
-
|
191
|
-
} else {
|
192
|
-
|
193
|
-
$total_list[$k]['result'] = $pay_withdraw_list[$k]['pay_total'] - $v['ex_total'];
|
194
|
-
|
195
|
-
$total_list[$k]['pay_total'] = $pay_withdraw_list[$k]['pay_total'];
|
196
|
-
|
197
|
-
$total_list[$k]['name'] = $pay_withdraw_list[$k]['name'];
|
198
|
-
|
199
|
-
$total_list[$k]['withdraw'] = 1;
|
200
|
-
|
201
|
-
}
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
foreach ($total_list as $k => $v) {
|
208
|
-
|
209
|
-
$sort[$k] = $v['result'];
|
210
|
-
|
211
|
-
}
|
212
|
-
|
213
|
-
array_multisort($sort, SORT_ASC, $total_list);
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
$smarty->assign('total_list', $total_list);
|
218
|
-
|
219
|
-
$smarty->assign('vars', $vars);
|
220
|
-
|
221
|
-
$smarty->display(TMP_DIR.'admin_dice/data/test.php');
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
function getExchangeByUserList () {
|
226
|
-
|
227
|
-
$adodb = getDbDice();
|
228
|
-
|
229
|
-
$query = "SELECT user_id, amount, price, f_price, SUM(amount * f_price) AS ex_total ".
|
230
|
-
|
231
|
-
"FROM `log_exchange` LEFT JOIN `premium` ON premium_id = `premium`.id ".
|
232
|
-
|
233
|
-
"WHERE STATUS=2 ".
|
234
|
-
|
235
|
-
"GROUP BY user_id ".
|
236
|
-
|
237
|
-
"ORDER BY ex_total DESC ";
|
238
|
-
|
239
|
-
if($result = $adodb->GetAssoc($query)) return $result;
|
240
|
-
|
241
|
-
}
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
function getSalesByUserList ($table) {
|
246
|
-
|
247
|
-
$adodb = getDbDice();
|
248
|
-
|
249
|
-
$query = "SELECT user_id, name, SUM(payment) AS pay_total ".
|
250
|
-
|
251
|
-
"FROM `sales` LEFT JOIN `{$table}` ON user_id=`{$table}`.id ".
|
252
|
-
|
253
|
-
"WHERE pay_flg > 0 ".
|
254
|
-
|
255
|
-
"GROUP BY user_id ".
|
256
|
-
|
257
|
-
"ORDER BY pay_total DESC ";
|
258
|
-
|
259
|
-
if($result = $adodb->GetAssoc($query)) return $result;
|
260
|
-
|
261
|
-
}
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
?>
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
データの
|
1
|
+
データのテーブル作成に関してです
|
2
2
|
|
3
3
|
データベースの中にあるもので
|
4
4
|
|
5
|
-
|
5
|
+
テーブル作成
|
6
6
|
|
7
7
|
|
8
8
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,14 @@
|
|
22
22
|
|
23
23
|
その二つの書き方がいまいち分かりません
|
24
24
|
|
25
|
+
uselテーブルのpay_flgが課金有無
|
26
|
+
|
27
|
+
尚未課金者は0課金者は1以上です
|
28
|
+
|
29
|
+
日付はuselテーブルのreg_dateです
|
30
|
+
|
31
|
+
|
32
|
+
|
25
33
|
一つ目のファイル
|
26
34
|
|
27
35
|
<html>
|