MODULE_NAME), 'mid');
$moduleid = empty($moduleid) ? '000000' : sprintf("%06d", $moduleid);
$uniontid = date('YmdHis') . $moduleid . random(8, 1);
//生成商户订单号
return $uniontid;
}
/**
* model类实例函数
*
* @access public
* @name m
* @param $filename 文件夹/文件名
* @return 对象
*/
function m($filename = '') {
static $_modules = array();
if (strpos($filename, '/') > -1) {
[$file, $name] = explode('/', $filename);
} else {
die('文件结构不正确,正确结构(文件夹名/文件名)');
}
if (isset($_modules[$file][$name]))
return $_modules[$file][$name];
$model = PATH_CORE . "library/" . $file . "/" . $name . '.lib.php';
if (!is_file($model)) {
die('Library Class ' . $filename . ' Not Found!');
}
require $model;
$class_name = ucfirst($name);
//调用该类
$_modules[$file][$name] = new $class_name();
return $_modules[$file][$name];
}
/**
* Comment: 判断 当前模块权限
* Author: zzw
* Date: 2020/11/16 11:24
* @param string $name
* @return bool
*/
function p($name = '') {
global $_W;
//默认拥有当前模块权限
$status = true;
//判断文件是否存在 不存在则无权限
$model = PATH_PLUGIN . strtolower($name) . '/config.xml';
if (!is_file($model)) $status = false;
return $status;
}
/**
* Comment: 判断 当前公众号是否有此权限
* Author: wlf
* Date: 2021/09/26 14:36
* @param string $name
* @return bool
*/
function uniacid_p($name = '') {
global $_W;
$status = 1;
$pp = p($name);
if($pp){
$plugin = pdo_getcolumn(PDO_NAME.'perm_account',array('uniacid'=>$_W['uniacid']),'plugins');
$plugin = unserialize($plugin);
if(!empty($plugin)){
if(!in_array($name,$plugin)){
$status = 0;
}
}
}else{
$status = 0;
}
return $status;
}
/**
* Comment: 判断 当前代理是否有此权限
* Author: wlf
* Date: 2021/09/26 15:06
* @param string $name
* @return bool
*/
function agent_p($name = ''){
global $_W;
$status = 1;
$up = uniacid_p($name);
if($up > 0){
//获取代理分组权限信息
if($_W['aid'] > 0){
$groupid = pdo_getcolumn(PDO_NAME.'agentusers',array('id'=>$_W['aid']),'groupid');
if($groupid > 0){
$plugin = pdo_getcolumn(PDO_NAME.'agentusers_group',array('id'=>$groupid),'package');
$plugin = unserialize($plugin);
if(!empty($plugin)){
if(!in_array($name,$plugin)){
$status = 0;
}
}
}
}
}else{
$status = 0;
}
return $status;
}
/**
* Comment: 判断 当前商户是否有此权限
* Author: wlf
* Date: 2021/09/26 15:19
* @param string $name
* @return bool
*/
function store_p($name = '',$sid){
global $_W;
$status = 1;
$ap = agent_p($name);
if($ap > 0){
$groupid = pdo_getcolumn(PDO_NAME.'merchantdata',array('id'=>$sid),'groupid');
if($groupid > 0){
$plugin = pdo_getcolumn(PDO_NAME.'chargelist',array('id'=>$groupid),'authority');
$plugin = unserialize($plugin);
if(!empty($plugin)){
if(!in_array($name,$plugin)){
$status = 0;
}
}
}
}else{
$status = 0;
}
return $status;
}
/**
* Comment: 判断当前模块是否存在权限
* Author: zzw
* Date: 2020/11/16 19:45
* @param $name
* @return bool
*/
function j($name){
//TODO 当前权限判断功能需要优化 请求内容和判断内容过多 导致加载缓慢 当时为了方便直接使用的其他方法的返回结果在重新判断 可以重写判断不适用其他方法返回结果进行重新判断
//默认拥有当前模块权限
$status = true;
//判断是否存在权限
if(is_agent()) $wholePlugin = App::get_apps(0, 'agent');//全部插件
else if(is_store()) $wholePlugin = App::get_apps(0, 'store');//全部插件
else $wholePlugin = App::get_apps(0, 'account');//全部插件
$wholeIdents = array_column($wholePlugin,'ident');//插件昵称
$plugins = App::get_cate_plugins('agent');//当前代理商户拥有权限的插件
$channel = array_column($plugins['channel']['plugins'],'ident');
$market = array_column($plugins['market']['plugins'],'ident');
$interact = array_column($plugins['interact']['plugins'],'ident');
$expand = array_column($plugins['expand']['plugins'],'ident');
$help = array_column($plugins['help']['plugins'],'ident');
$idents = array_merge((array)$channel, (array)$market, (array)$interact, (array)$expand, (array)$help);
//当前插件存在权限处理 当前代理无当前权限
if(is_agent() || is_store()) {
if(!in_array($name,$wholeIdents) || !in_array($name,$idents)) $status = false;
}else{
if(!in_array($name,$wholeIdents)) $status = false;
}
return $status;
}
/**
* 权限检测函数
*
* @access public
* @name checkLimit
* @param $roleid 角色id
* @param $arr 检测位置
* @return false|true
*/
function checkLimit($roleid, $arr = array()) {
$allPerms = Perms::allParms();
if (empty($allPerms[$arr['p']][$arr['ac']][$arr['do']]))
return true;
$limits = Perms::getRolePerms($roleid);
if (empty($limits) || empty($arr))
return false;
if (empty($limits[$arr['p']][$arr['ac']][$arr['do']]))
return false;
return true;
}
if ((!function_exists('url') && defined('IN_UNIAPP')) || !function_exists('url') && defined('IS_INDEPENDENT')) {
function url($segment, $params = array(), $noredirect = false) {
return murl($segment, $params, $noredirect);
}
}
/**
* web地址生成
*
* @access public
* @name getUrlByWeb
* @param $segment do/ac/op
* @param $params 参数
* @return string
*/
function web_url($segment, $params = array()) {
global $_W;
[$p, $ac, $do] = explode('/', $segment);
if (is_store()) {
$url = $_W['siteroot'] . 'web/citystore.php?';
} else if (is_agent()) {
$url = $_W['siteroot'] . 'web/cityagent.php?';
} else if (is_staff()) {
$url = $_W['siteroot'] . 'web/citysys.php?';
} else {
$url = $_W['siteroot'] . 'web/index.php?c=site&a=entry&m=' . MODULE_NAME . '&';
}
if (!empty($p)) {
$url .= "p={$p}&";
}
if (!empty($ac)) {
$url .= "ac={$ac}&";
}
$do = !empty($do) ? $do : 'index';
if (!empty($do)) {
$url .= "do={$do}&";
}
if (!empty($params)) {
$queryString = http_build_query($params, '', '&');
$url .= $queryString;
}
return $url;
}
/**
* APP地址生成
*
* @access public
* @name app_url
* @param $segment do/ac/op
* @param $params 参数
* @return string
*/
function app_url($segment, $params = array(), $addhost = TRUE) {
global $_W;
[$p, $ac, $do] = explode('/', $segment);
if ($addhost == TRUE) {
$_W['siteroot'] = str_replace(array('/addons/' . MODULE_NAME,'/addons/weliam_smartcity','/core/common', '/addons/bm_payms'), '', $_W['siteroot']);
$url = $_W['siteroot'] . 'app/index.php?i=' . $_W['uniacid'] . '&c=entry&m=' . MODULE_NAME . '&';
} else {
$url = './index.php?i=' . $_W['uniacid'] . '&c=entry&m=' . MODULE_NAME . '&';
}
if (!empty($p)) {
$url .= "p={$p}&";
}
if (!empty($ac)) {
$url .= "ac={$ac}&";
}
$do = !empty($do) ? $do : 'index';
if (!empty($do)) {
$url .= "do={$do}&";
}
if (!empty($params)) {
$queryString = http_build_query($params, '', '&');
$url .= $queryString;
}
if (substr($url, -1) == '&') {
$url = substr($url, 0, strlen($url) - 1);
}
return $url;
}
/**
* Comment: H5链接地址生成 强制生成为https链接
* Author: zzw
* Date: 2019/7/2 16:37
* @param string $page
* @param array $params
* @param $addhost
* @return bool|string
*/
function h5_url($page, $params = array(), $catalog = 'h5',$aid=0) {
global $_W;
$_W['siteroot'] = str_replace(array('/addons/' . MODULE_NAME,'/addons/weliam_smartcity','/plugin/pftapimod','/core/common', '/addons/bm_payms','/addons/weliam_smartcity/payment','/addons/'.MODULE_NAME.'/payment','/payment'), '', $_W['siteroot']);
$_W['siteroot'] = str_replace(':19080','',$_W['siteroot']);
$is_have = strpos($page, '?');
if ($is_have) {
$info = explode('?', $page);
$page = $info[0];
$paramStr = $info[1];
//判断参数是否存在i 存在则删除
foreach (explode('&', $paramStr) as $key => $value) {
if ($value{0} == 'i' && $value{1} == '=') {
$paramStr = str_replace($value . '&', '', $paramStr);
break;
}
}
}
if(empty($aid)){
$aid = $_W['aid'];
}
if(empty($catalog)){
$catalog = 'h5';
}
$url = $_W['siteroot'] . 'addons/' . MODULE_NAME . '/' . $catalog . '/#/' . $page . "?i=" . $_W['uniacid'] . '&aid=' .$aid. '&' . $paramStr;
$url = trim($url, "&");
if (!empty($params)) {
$queryString = http_build_query($params, '', '&');
$url .= '&' . trim($queryString, "&");
}
$domain = Cloud::wl_syssetting_read('jumpadmin');
if(!empty($domain['targetDmain'])){
foreach($domain['targetDmain'] as $tar){
$url = str_replace($tar,$domain['endDmain'],$url);
}
}
return $url;
}
function is_store() {
if (defined('IN_STORE')) {
return true;
}
return false;
}
function is_agent() {
if (defined('IN_WEB')) {
return true;
}
return false;
}
function is_staff() {
if (defined('IN_STAFF')) {
return true;
}
return false;
}
if (!function_exists('is_wxapp')) {
function is_wxapp() {
global $_W;
if (!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'miniProgram')) {
return true;
}
return false;
}
}
if (!function_exists('is_weixin')) {
function is_weixin() {
global $_W;
if (empty($_SERVER['HTTP_USER_AGENT']) || ((strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === false) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Windows Phone') === false))) {
return false;
}
return true;
}
}
if (!function_exists('is_h5app')) {
function is_h5app() {
if (!empty($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'CK 2.0')) {
return true;
}
return false;
}
}
if (!function_exists('is_ios')) {
function is_ios() {
if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
return true;
}
return false;
}
}
if (!function_exists('is_mobile')) {
function is_mobile() {
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i', substr($useragent, 0, 4))) {
return true;
}
return false;
}
}
function ifilter_url($params) {
return wl_filter_url($params);
}
function wl_setcookie($key, $value, $expire = 0, $httponly = false) {
global $_W;
$expire = $expire != 0 ? (TIMESTAMP + $expire) : 0;
$secure = $_SERVER['SERVER_PORT'] == 443 ? 1 : 0;
$value = is_array($value) ? base64_encode(json_encode($value)) : $value;
return setcookie('weliam_' . $key, $value, $expire, $_W['config']['cookie']['path'], $_W['config']['cookie']['domain'], $secure, $httponly);
}
function wl_getcookie($key) {
$sting = $_COOKIE['weliam_' . $key];
$data = json_decode(base64_decode($sting), true);
return is_array($data) ? $data : $sting;
}
//2019.9.4 默认:1=失败,0=成功
function wl_json($errno = 0, $message = '', $data = '') {
exit(json_encode(array('errno' => $errno, 'message' => $message, 'data' => $data)));
}
function wl_new_method($plugin, $controller, $method, $catalog = 'app') {
global $_W;
$dir = IA_ROOT . '/addons/' . MODULE_NAME . '/';
$file = $dir . $catalog . '/controller/' . $plugin . '/' . $controller . '.ctrl.php';
if (!is_file($file)) {
$file = $dir . 'plugin/' . $plugin . '/' . $catalog . '/controller/' . $controller . '.ctrl.php';
}
if (($catalog == 'web' || $catalog == 'sys') && !is_file($file)) {
$_W['catalog'] = $catalog = ($catalog == 'web') ? 'sys' : 'web';
$file = $dir . $catalog . '/controller/' . $plugin . '/' . $controller . '.ctrl.php';
if (!is_file($file)) {
$file = $dir . 'plugin/' . $plugin . '/' . $catalog . '/controller/' . $controller . '.ctrl.php';
}
}
if (is_file($file)) {
require_once $file;
} else {
trigger_error("访问的模块 {$plugin} 不存在.", E_USER_WARNING);
}
$class = ucfirst($controller) . '_WeliamController';
if (class_exists($class, false)) {
$instance = new $class();
} else {
$instance = new $controller();
}
if ($catalog == 'app') {
$instance->inMobile = TRUE;
}
if (!method_exists($instance, $method)) {
trigger_error('控制器 ' . $controller . ' 方法 ' . $method . ' 未找到!');
}
$instance->$method();
exit();
}
/**
* html文件引入,生成缓存
*
* @access public
* @name wl_template
* @param $filename 文件
* @return string
*/
function wl_template($filename, $flag = '') {
global $_W;
$name = MODULE_NAME;
$catalog = strstr($filename, 'common/') ? 'web' : $_W['catalog'] ? : 'web';
$source = IA_ROOT . "/addons/{$name}/{$catalog}/view/default/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/{$catalog}/{$name}/{$_W['plugin']}/{$catalog}/view/default/{$filename}.tpl.php";
if (!is_file($source)) $source = IA_ROOT . "/addons/{$name}/plugin/{$_W['plugin']}/{$catalog}/view/default/{$filename}.html";
if (!is_file($source)) exit("Error: template source '{$filename}' is not exist!!!");
if (!is_file($compile) || filemtime($source) > filemtime($compile)) Template::wl_template_compile($source, $compile, true);
if ($flag == TEMPLATE_FETCH) {
extract($GLOBALS, EXTR_SKIP);
ob_end_flush();
ob_clean();
ob_start();
include $compile;
$contents = ob_get_contents();
ob_clean();
return $contents;
} else if ($flag == 'template') {
extract($GLOBALS, EXTR_SKIP);
return $compile;
} else {
return $compile;
}
/* $name = MODULE_NAME;
if (defined('IN_SYS') || defined('IN_WEB')) {
$catalog = strstr($filename, 'common/') ? 'web' : $_W['catalog'];
$source = IA_ROOT . "/addons/{$name}/{$catalog}/view/default/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/{$catalog}/{$name}/{$catalog}/view/default/{$filename}.tpl.php";
if (!is_file($source)) {
$source = IA_ROOT . "/addons/{$name}/plugin/{$_W['plugin']}/{$catalog}/view/default/{$filename}.html";
}
}
if (defined('IN_APP')) {
$template = "default";
if (!empty($_W['wlsetting']['templat']['appview'])) {
$template = $_W['wlsetting']['templat']['appview'];
}
$source = IA_ROOT . "/addons/{$name}/app/view/{$template}/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/app/{$name}/app/view/{$template}/{$filename}.tpl.php";
if (!is_file($source)) {
$source = IA_ROOT . "/addons/{$name}/app/view/default/{$filename}.html";
}
if (!is_file($source)) {
$source = IA_ROOT . "/addons/{$name}/plugin/{$_W['plugin']}/app/view/{$template}/{$filename}.html";
}
if (!is_file($source)) {
$source = IA_ROOT . "/addons/{$name}/plugin/{$_W['plugin']}/app/view/default/{$filename}.html";
}
if (!is_file($source)) {
$filenames = explode("/", $filename);
$source = IA_ROOT . "/addons/{$name}/plugin/{$filenames[0]}/app/view/default/{$filename}.html";
}
if (!empty($_W['wlsetting']['trade']['credittext']) || !empty($_W['wlsetting']['trade']['moneytext'])) {
$compile = IA_ROOT . "/data/tpl/app/{$name}/{$_W['uniacid']}/app/view/{$template}/{$filename}.tpl.php";
}
if (!empty($_W['wlsetting']['halfcard']['text']['halfcardtext']) || !empty($_W['wlsetting']['halfcard']['text']['privilege'])) {
$compile = IA_ROOT . "/data/tpl/app/{$name}/{$_W['uniacid']}/app/view/{$template}/{$filename}.tpl.php";
}
}
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!!!");
}
if (!is_file($compile) || filemtime($source) > filemtime($compile)) {
Template::wl_template_compile($source, $compile, true);
}
if ($flag == TEMPLATE_FETCH) {
extract($GLOBALS, EXTR_SKIP);
ob_end_flush();
ob_clean();
ob_start();
include $compile;
$contents = ob_get_contents();
ob_clean();
return $contents;
} else if ($flag == 'template') {
extract($GLOBALS, EXTR_SKIP);
return $compile;
} else {
return $compile;
}*/
}
function wl_message($msg, $redirect = '', $type = '') {
global $_W, $_GPC;
if ($redirect == 'refresh') {
$redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING'];
}
if ($redirect == 'referer') {
$redirect = referer();
}
if ($redirect == 'close') {
$redirect = 'wx.closeWindow()';
$close = 1;
}
if ($redirect == '') {
$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql', 'fixed')) ? $type : 'info';
} else {
$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql', 'fixed')) ? $type : 'success';
}
if (IN_WXAPP == 'wxapp') {
die(json_encode(array('errno' => $type == 'success' ? 0 : 1, 'message' => $msg, 'data' => $redirect)));
}
if ($_W['isajax'] || !empty($_GET['isajax']) || $type == 'ajax') {
if ($type != 'ajax' && !empty($_GPC['target'])) {
exit("
");
} else {
//ajaxsubmit兼容方案
if ($_W['isajax'] && !empty($_GPC['token'])) {
$ret = array('status' => $type == 'success' ? 1 : 0, 'result' => $type == 'success' ? array('url' => $redirect ? $redirect : referer()) : array());
$ret['result']['message'] = $msg;
exit(json_encode($ret));
} else {
$vars = array();
if (is_array($msg)) {
$vars['errno'] = $msg['errno'];
$vars['message'] = $msg['message'];
die(json_encode($vars));
} else {
$vars['message'] = $msg;
}
$vars['redirect'] = $redirect;
$vars['type'] = $type;
die(json_encode($vars));
}
}
} elseif (is_array($msg)) {
$msg = $msg['message'];
}
if (empty($msg) && !empty($redirect)) {
header('location: ' . $redirect);
}
$label = $type;
if ($type == 'error') {
$label = 'danger';
}
if ($type == 'ajax' || $type == 'sql') {
$label = 'warning';
}
include wl_template('common/message', TEMPLATE_INCLUDEPATH);
exit();
}
/**
* debug打印
*
* @access public
* @name wl_debug
* @param $value 需要打印的参数
*/
function wl_debug($value) {
echo "
";
print_r($value);
echo "";
exit;
}
/**
* Comment: 自有的debug模式 只有指定人员访问才会debug,其他人员访问不debug。
* Author: zzw
* Date: 2019/11/12 9:27
* @param array | string | int $value debug的内容
* @param int $mid 用户id
* @param bool $status 是否强制打印
*/
function private_debug($value,$mid = 0,$status = false){
global $_W;
if($status || ($_W['mid'] == $mid || $_REQUEST['debug'])){
echo "";
print_r($value);
echo "";
exit;
}
}
/**
* 日志文件打印
*
* @access public
* @name wl_log
* @param $filename 文件名
* @param $title 打印标题
* @param $data 需要打印内容
* @return array
*/
function wl_log($filename, $title, $data) {
global $_W;
if ($uniacid != '') {
$_W['uniacid'] = $uniacid;
}
$url_log = PATH_DATA . "log/" . date('Y-m-d', time()) . "/" . $filename . ".log";
$url_dir = PATH_DATA . "log/" . date('Y-m-d', time());
Util::mkDirs($url_dir);
file_put_contents($url_log, var_export('/=======' . date('Y-m-d H:i:s', time()) . '【' . $title . '】=======/', true) . PHP_EOL, FILE_APPEND);
file_put_contents($url_log, var_export($data, true) . PHP_EOL, FILE_APPEND);
}
function wl_filter_url($params) {
global $_W;
if (empty($params)) {
return '';
}
$query_arr = array();
$parse = parse_url($_W['siteurl']);
if (!empty($parse['query'])) {
$query = $parse['query'];
parse_str($query, $query_arr);
}
$params = explode(',', $params);
foreach ($params as $val) {
if (!empty($val)) {
$data = explode(':', $val);
$query_arr[$data[0]] = trim($data[1]);
}
}
$query_arr['page'] = 1;
$query = http_build_query($query_arr);
if(defined('IN_WEB')){
return './cityagent.php?' . $query;
}else if(defined('IN_STORE')){
return './citystore.php?' . $query;
}else if(defined('IN_STAFF')){
return './citysys.php?' . $query;
}else{
return './index.php?' . $query;
}
}
function wl_get_module_name(){
return MODULE_NAME;
}
function wl_tpl_form_field_member($value = array()) {
$s = '';
$s = '
';
$s .= '