与线上文件进行对比,合并进差异,并升级版本到4.6.2
Showing
12 changed files
with
278 additions
and
5 deletions
1 | +<?php | ||
2 | + | ||
3 | +namespace WebPlugin\Pay\Unionpayweb\Func; | ||
4 | + | ||
5 | +class PhpLog | ||
6 | +{ | ||
7 | + const DEBUG = 1;// Most Verbose | ||
8 | + const INFO = 2;// ... | ||
9 | + const WARN = 3;// ... | ||
10 | + const ERROR = 4;// ... | ||
11 | + const FATAL = 5;// Least Verbose | ||
12 | + const OFF = 6;// Nothing at all. | ||
13 | + | ||
14 | + const LOG_OPEN = 1; | ||
15 | + const OPEN_FAILED = 2; | ||
16 | + const LOG_CLOSED = 3; | ||
17 | + | ||
18 | + /* Public members: Not so much of an example of encapsulation, but that's okay. */ | ||
19 | + public $Log_Status = PhpLog::LOG_CLOSED; | ||
20 | + public $DateFormat = "Y-m-d G:i:s"; | ||
21 | + public $MessageQueue; | ||
22 | + | ||
23 | + private $filename; | ||
24 | + private $log_file; | ||
25 | + private $priority = PhpLog::INFO; | ||
26 | + | ||
27 | + private $file_handle; | ||
28 | + | ||
29 | + /** | ||
30 | + * AUTHOR: gu_yongkang | ||
31 | + * DATA: 20110322 | ||
32 | + * Enter description here ... | ||
33 | + * @param $filepath | ||
34 | + * 文件存储的路径 | ||
35 | + * @param $timezone | ||
36 | + * 时间格式,此处设置为"PRC"(中国) | ||
37 | + * @param $priority | ||
38 | + * | ||
39 | + * 设置运行级别 | ||
40 | + */ | ||
41 | + | ||
42 | + public function __construct($filepath, $timezone, $priority) | ||
43 | + { | ||
44 | + if ($priority == PhpLog::OFF) return; | ||
45 | + | ||
46 | + $this->filename = date('Y-m-d', time()) . '.log'; //默认为以时间+.log的文件文件 | ||
47 | + $this->log_file = $this->createPath($filepath, $this->filename); | ||
48 | + $this->MessageQueue = array(); | ||
49 | + $this->priority = $priority; | ||
50 | + date_default_timezone_set($timezone); | ||
51 | + | ||
52 | + if (!file_exists($filepath)) //判断文件路径是否存在 | ||
53 | + { | ||
54 | + if (!empty($filepath)) //判断路径是否为空 | ||
55 | + { | ||
56 | + if (!($this->_createDir($filepath))) { | ||
57 | + die("创建目录失败!"); | ||
58 | + } | ||
59 | + if (!is_writable($this->log_file)) { | ||
60 | + $this->Log_Status = PhpLog::OPEN_FAILED; | ||
61 | + $this->MessageQueue[] = "The file exists, but could not be opened for writing. Check that appropriate permissions have been set."; | ||
62 | + return; | ||
63 | + } | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + if ($this->file_handle = fopen($this->log_file, "a+")) { | ||
68 | + $this->Log_Status = PhpLog::LOG_OPEN; | ||
69 | + $this->MessageQueue[] = "The log file was opened successfully."; | ||
70 | + } else { | ||
71 | + $this->Log_Status = PhpLog::OPEN_FAILED; | ||
72 | + $this->MessageQueue[] = "The file could not be opened. Check permissions."; | ||
73 | + } | ||
74 | + return; | ||
75 | + } | ||
76 | + | ||
77 | + public function __destruct() | ||
78 | + { | ||
79 | + if ($this->file_handle) | ||
80 | + fclose($this->file_handle); | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + *作用:创建目录 | ||
85 | + *输入:要创建的目录 | ||
86 | + *输出:true | false | ||
87 | + */ | ||
88 | + private function _createDir($dir) | ||
89 | + { | ||
90 | + return is_dir($dir) or (self::_createDir(dirname($dir)) and mkdir($dir, 0777)); | ||
91 | + } | ||
92 | + | ||
93 | + /** | ||
94 | + *作用:构建路径 | ||
95 | + *输入:文件的路径,要写入的文件名 | ||
96 | + *输出:构建好的路径字串 | ||
97 | + */ | ||
98 | + private function createPath($dir, $filename) | ||
99 | + { | ||
100 | + if (empty($dir)) { | ||
101 | + return $filename; | ||
102 | + } else { | ||
103 | + return $dir . "/" . $filename; | ||
104 | + } | ||
105 | + } | ||
106 | + | ||
107 | + public function LogInfo($line) | ||
108 | + { | ||
109 | + /** | ||
110 | + * AUTHOR : gu_yongkang | ||
111 | + * 增加打印函数和文件名的功能 | ||
112 | + */ | ||
113 | + $sAarray = array(); | ||
114 | + $sAarray = debug_backtrace(); | ||
115 | + $sGetFilePath = $sAarray[0]["file"]; | ||
116 | + $sGetFileLine = $sAarray[0]["line"]; | ||
117 | + $this->Log($line, PhpLog::INFO, $sGetFilePath, $sGetFileLine); | ||
118 | + unset($sAarray); | ||
119 | + unset($sGetFilePath); | ||
120 | + unset($sGetFileLine); | ||
121 | + } | ||
122 | + | ||
123 | + public function LogDebug($line) | ||
124 | + { | ||
125 | + /** | ||
126 | + * AUTHOR : gu_yongkang | ||
127 | + * 增加打印函数和文件名的功能 | ||
128 | + */ | ||
129 | + $sAarray = array(); | ||
130 | + $sAarray = debug_backtrace(); | ||
131 | + $sGetFilePath = $sAarray[0]["file"]; | ||
132 | + $sGetFileLine = $sAarray[0]["line"]; | ||
133 | + $this->Log($line, PhpLog::DEBUG, $sGetFilePath, $sGetFileLine); | ||
134 | + unset($sAarray); | ||
135 | + unset($sGetFilePath); | ||
136 | + unset($sGetFileLine); | ||
137 | + } | ||
138 | + | ||
139 | + public function LogWarn($line) | ||
140 | + { | ||
141 | + /** | ||
142 | + * AUTHOR : gu_yongkang | ||
143 | + * 增加打印函数和文件名的功能 | ||
144 | + */ | ||
145 | + $sAarray = array(); | ||
146 | + $sAarray = debug_backtrace(); | ||
147 | + $sGetFilePath = $sAarray[0]["file"]; | ||
148 | + $sGetFileLine = $sAarray[0]["line"]; | ||
149 | + $this->Log($line, PhpLog::WARN, $sGetFilePath, $sGetFileLine); | ||
150 | + unset($sAarray); | ||
151 | + unset($sGetFilePath); | ||
152 | + unset($sGetFileLine); | ||
153 | + } | ||
154 | + | ||
155 | + public function LogError($line) | ||
156 | + { | ||
157 | + /** | ||
158 | + * AUTHOR : gu_yongkang | ||
159 | + * 增加打印函数和文件名的功能 | ||
160 | + */ | ||
161 | + $sAarray = array(); | ||
162 | + $sAarray = debug_backtrace(); | ||
163 | + $sGetFilePath = $sAarray[0]["file"]; | ||
164 | + $sGetFileLine = $sAarray[0]["line"]; | ||
165 | + $this->Log($line, PhpLog::ERROR, $sGetFilePath, $sGetFileLine); | ||
166 | + unset($sAarray); | ||
167 | + unset($sGetFilePath); | ||
168 | + unset($sGetFileLine); | ||
169 | + } | ||
170 | + | ||
171 | + public function LogFatal($line) | ||
172 | + { | ||
173 | + /** | ||
174 | + * AUTHOR : gu_yongkang | ||
175 | + * 增加打印函数和文件名的功能 | ||
176 | + */ | ||
177 | + $sAarray = array(); | ||
178 | + $sAarray = debug_backtrace(); | ||
179 | + $sGetFilePath = $sAarray[0]["file"]; | ||
180 | + $sGetFileLine = $sAarray[0]["line"]; | ||
181 | + $this->Log($line, PhpLog::FATAL, $sGetFilePath, $sGetFileLine); | ||
182 | + unset($sAarray); | ||
183 | + unset($sGetFilePath); | ||
184 | + unset($sGetFileLine); | ||
185 | + } | ||
186 | + | ||
187 | + /** | ||
188 | + * Author : gu_yongkang | ||
189 | + * Enter description here ... | ||
190 | + * @param unknown_type $line | ||
191 | + * content 内容 | ||
192 | + * @param unknown_type $priority | ||
193 | + * 打印级别 | ||
194 | + * @param unknown_type $sFile | ||
195 | + * 调用打印日志的文件名 | ||
196 | + * @param unknown_type $iLine | ||
197 | + * 打印文件的位置(行数) | ||
198 | + */ | ||
199 | + public function Log($line, $priority, $sFile, $iLine) | ||
200 | + { | ||
201 | + if ($iLine > 0) { | ||
202 | +// $line = iconv('GBK', 'UTF-8', $line); | ||
203 | + if ($this->priority <= $priority) { | ||
204 | + $status = $this->getTimeLine($priority, $sFile, $iLine); | ||
205 | + $this->WriteFreeFormLine("$status $line \n"); | ||
206 | + } | ||
207 | + } else { | ||
208 | + /** | ||
209 | + * AUTHOR : gu_yongkang | ||
210 | + * 增加打印函数和文件名的功能 | ||
211 | + */ | ||
212 | + $sAarray = array(); | ||
213 | + $sAarray = debug_backtrace(); | ||
214 | + $sGetFilePath = $sAarray[0]["file"]; | ||
215 | + $sGetFileLine = $sAarray[0]["line"]; | ||
216 | + if ($this->priority <= $priority) { | ||
217 | + $status = $this->getTimeLine($priority, $sGetFilePath, $sGetFileLine); | ||
218 | + unset($sAarray); | ||
219 | + unset($sGetFilePath); | ||
220 | + unset($sGetFileLine); | ||
221 | + $this->WriteFreeFormLine("$status $line \n"); | ||
222 | + } | ||
223 | + } | ||
224 | + } | ||
225 | + | ||
226 | + // 支持输入多个参数 | ||
227 | + public function WriteFreeFormLine($line) | ||
228 | + { | ||
229 | + if ($this->Log_Status == PhpLog::LOG_OPEN && $this->priority != PhpLog::OFF) { | ||
230 | + if (fwrite($this->file_handle, $line) === false) { | ||
231 | + $this->MessageQueue[] = "The file could not be written to. Check that appropriate permissions have been set."; | ||
232 | + } | ||
233 | + } | ||
234 | + } | ||
235 | + | ||
236 | + private function getRemoteIP() | ||
237 | + { | ||
238 | + foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) { | ||
239 | + if (array_key_exists($key, $_SERVER) === true) { | ||
240 | + foreach (explode(',', $_SERVER[$key]) as $ip) { | ||
241 | + $ip = trim($ip); | ||
242 | + if (!empty($ip)) { | ||
243 | + return $ip; | ||
244 | + } | ||
245 | + } | ||
246 | + } | ||
247 | + } | ||
248 | + return "_NO_IP"; | ||
249 | + } | ||
250 | + | ||
251 | + | ||
252 | + private function getTimeLine($level, $FilePath, $FileLine) | ||
253 | + { | ||
254 | + $time = date($this->DateFormat); | ||
255 | + $ip = $this->getRemoteIP(); | ||
256 | + switch ($level) { | ||
257 | + case PhpLog::INFO: | ||
258 | + return "$time, " . "INFO, " . "$ip, " . "File[ $FilePath ], " . "Line[$FileLine]" . "------"; | ||
259 | + case PhpLog::WARN: | ||
260 | + return "$time, " . "WARN, " . "$ip, " . "File[ $FilePath ], " . "Line[$FileLine]" . "------"; | ||
261 | + case PhpLog::DEBUG: | ||
262 | + return "$time, " . "DEBUG, " . "$ip, " . "File[ $FilePath ], " . "Line[$FileLine]" . "------"; | ||
263 | + case PhpLog::ERROR: | ||
264 | + return "$time, " . "ERROR, " . "$ip, " . "File[ $FilePath ], " . "Line[$FileLine]" . "------"; | ||
265 | + case PhpLog::FATAL: | ||
266 | + return "$time, " . "FATAL, " . "$ip, " . "File[ $FilePath ], " . "Line[$FileLine]" . "------"; | ||
267 | + default: | ||
268 | + return "$time, " . "LOG, " . "$ip, " . "File[ $FilePath ], " . "Line[$FileLine]" . "------"; | ||
269 | + } | ||
270 | + } | ||
271 | +} | ||
272 | + | ||
273 | +?> |
web-static/img/download/intro-1.jpg
0 → 100644
73.7 KB
web-static/img/download/intro-2.jpg
0 → 100644
71.5 KB
web-static/img/download/intro-3.jpg
0 → 100644
52.1 KB
web-static/img/download/intro-4.jpg
0 → 100644
53.1 KB
web-static/img/order/save-sdfcbae16f2.png
0 → 100644
15.5 KB
web-static/img/passport/tip-saaf6d94c96.png
0 → 100644
1.4 KB
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" | @@ -50,7 +50,7 @@ application.template.ext = ".phtml" | ||
50 | application.assets.path = ROOT_PATH "/assets/web" | 50 | application.assets.path = ROOT_PATH "/assets/web" |
51 | 51 | ||
52 | ; 应用的版本号 | 52 | ; 应用的版本号 |
53 | -application.version = "4.6.0" | 53 | +application.version = "4.6.2" |
54 | 54 | ||
55 | ; 网站SEO信息 | 55 | ; 网站SEO信息 |
56 | application.seo.title = "YOHO!BUY 有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" | 56 | application.seo.title = "YOHO!BUY 有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" |
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" | @@ -50,7 +50,7 @@ application.template.ext = ".phtml" | ||
50 | application.assets.path = ROOT_PATH "/assets/web" | 50 | application.assets.path = ROOT_PATH "/assets/web" |
51 | 51 | ||
52 | ; 应用的版本号 | 52 | ; 应用的版本号 |
53 | -application.version = "4.6.0" | 53 | +application.version = "4.6.2" |
54 | 54 | ||
55 | ; 网站SEO信息 | 55 | ; 网站SEO信息 |
56 | application.seo.title = "YOHO!BUY 有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" | 56 | application.seo.title = "YOHO!BUY 有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" |
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" | @@ -50,7 +50,7 @@ application.template.ext = ".phtml" | ||
50 | application.assets.path = ROOT_PATH "/assets/web" | 50 | application.assets.path = ROOT_PATH "/assets/web" |
51 | 51 | ||
52 | ; 应用的版本号 | 52 | ; 应用的版本号 |
53 | -application.version = "4.6.0" | 53 | +application.version = "4.6.2" |
54 | 54 | ||
55 | ; 网站SEO信息 | 55 | ; 网站SEO信息 |
56 | application.seo.title = "YOHO!BUY 有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" | 56 | application.seo.title = "YOHO!BUY 有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" |
@@ -50,7 +50,7 @@ application.template.ext = ".phtml" | @@ -50,7 +50,7 @@ application.template.ext = ".phtml" | ||
50 | application.assets.path = ROOT_PATH "/assets/web" | 50 | application.assets.path = ROOT_PATH "/assets/web" |
51 | 51 | ||
52 | ; 应用的版本号 | 52 | ; 应用的版本号 |
53 | -application.version = "4.6.0" | 53 | +application.version = "4.6.2" |
54 | 54 | ||
55 | ; 网站SEO信息 | 55 | ; 网站SEO信息 |
56 | application.seo.title = "YOHO!BUY 有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" | 56 | application.seo.title = "YOHO!BUY 有货 | 年轻人潮流购物中心,中国潮流购物风向标,官方授权正品保证" |
-
Please register or login to post a comment