dzapp_haodai.func.php
5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
!defined('IN_DISCUZ') && exit('Access Denied');
function get_xindai_ad(){
global $client,$city;
for($i=1;$i<=3;$i++){
$xindai_ad = arrayCoding($client->get_xindai_ad($city), 'UTF-8', CHARSET);
if($xindai_ad['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $xindai_ad;
}
function get_article_dkgl_list($page = 1){
global $client,$city;
for($i=1;$i<=3;$i++){
$dkgl_article = arrayCoding($client->get_article_dkgl_list($city, FALSE, $page, 10), 'UTF-8', CHARSET);
if($dkgl_article['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $dkgl_article;
}
function get_article_dkzx_list($page = 1){
global $client,$city;
for($i=1;$i<=3;$i++){
$dkzx_article = arrayCoding($client->get_article_dkzx_list($city, FALSE, $page, 10), 'UTF-8', CHARSET);
if($dkzx_article['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $dkzx_article;
}
function get_article_jyfx_list($page = 1){
global $client,$city;
for($i=1;$i<=3;$i++){
$jyfx_article = arrayCoding($client->get_article_jyfx_list($city, FALSE, $page, 10), 'UTF-8', CHARSET);
if($jyfx_article['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $jyfx_article;
}
function get_article_cjwt_list($page = 1){
global $client,$city;
for($i=1;$i<=3;$i++){
$cjwt_article = arrayCoding($client->get_article_cjwt_list($city, FALSE, $page, 10), 'UTF-8', CHARSET);
if($cjwt_article['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $cjwt_article;
}
function get_hot_recommend(){
global $client,$city;
for($i=1;$i<=3;$i++){
$hot_recommend = arrayCoding($client->get_hot_recommend(), 'UTF-8', CHARSET);
if($hot_recommend['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $hot_recommend;
}
function get_xindai_filter($type = ''){
global $client,$_GET;
$type = !empty($type) ? $type : $_GET['xd_type'];
for($i=1;$i<=3;$i++){
$filter = arrayCoding($client->get_xindai_filter($type), 'UTF-8', CHARSET);
if($filter['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $filter;
}
function get_xindai_list($money, $month, $data, $page){
global $client,$_GET,$city;
for($i=1;$i<=3;$i++){
$result = arrayCoding($client->get_xindai_list($city, $_GET['xd_type'], $money, $month, $data, $page, 10), 'UTF-8', CHARSET);
if($result['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $result;
}
function get_xindai_detail($xd_id, $money, $month){
global $client,$city;
for($i=1;$i<=3;$i++){
$xd = arrayCoding($client->get_xindai_detail($city, $xd_id, $money, $month), 'UTF-8', CHARSET);
if($xd['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $xd;
}
function get_article_detail($id){
global $client,$_GET,$city;
for($i=1;$i<=3;$i++){
$result = arrayCoding($client->get_article_detail($id), 'UTF-8', CHARSET);
if($result['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $result;
}
function arrayCoding($array, $inCharset, $outCharset) {
if(is_array($array)){
$arr1 = array();
foreach($array as $key => $value){
$key = iconv($inCharset, $outCharset, $key);
$arr1[$key] = arrayCoding($value, $inCharset, $outCharset);
}
}else{
$arr1 = iconv($inCharset, $outCharset, $array);
}
return $arr1;
}
function url_implode($gets) {
$arr = array();
foreach ($gets as $key => $value) {
if($value) {
$arr[] = $key.'='.urlencode($value);
}
}
return implode('&', $arr);
}
function rewrite_index() {
global $_G;
if(!$_G['cache']['plugin']['dzapp_haodai']['rewrite']) return 'plugin.php?id=dzapp_haodai';
return 'haodai.html';
}
function rewrite_list($type, $page) {
global $_G;
if(!$_G['cache']['plugin']['dzapp_haodai']['rewrite']) return 'plugin.php?id=dzapp_haodai&action=list&type='.$type.'&page='.$page;
return 'haodai-list-'.$type.'-'.$page.'.html';
}
function rewrite_news($aid) {
global $_G;
if(!$_G['cache']['plugin']['dzapp_haodai']['rewrite']) return 'plugin.php?id=dzapp_haodai&action=news&aid='.$aid;
return 'haodai-news-'.$aid.'.html';
}
function rewrite_calc($type) {
global $_G;
if(!$_G['cache']['plugin']['dzapp_haodai']['rewrite']) return 'plugin.php?id=dzapp_haodai&action=calc&type='.$type;
return 'haodai-calculator-'.$type.'.html';
}
function rewrite_view_apply($type, $xd_id, $xd_type, $month, $money) {
global $_G;
if(!$_G['cache']['plugin']['dzapp_haodai']['rewrite']) return 'plugin.php?id=dzapp_haodai&action='.$type.'&xd_id='.$xd_id.'&xd_type='.$xd_type.'&month='.$month.'&money='.$money;
return 'haodai-'.$type.'-'.$xd_id.'-'.$xd_type.'-'.$month.'-'.$money.'.html';
}
function get_xindai_recommend($money, $month){
global $client,$_GET,$city;
for($i=1;$i<=3;$i++){
$result = arrayCoding($client->get_xindai_list($city, $_GET['xd_type'], $money, $month, array(), 1, 5), 'UTF-8', CHARSET);
if($result['rs_code'] == '1000') break;
}
if($i == 4) showmessage('dzapp_haodai:callback_error_user');
return $result;
}
?>