root пре 5 година
комит
9a0ca018a8
100 измењених фајлова са 9160 додато и 0 уклоњено
  1. 8 0
      .gitignore
  2. 1 0
      .htaccess
  3. 1 0
      .well-known/pki-validation/fileauth.txt
  4. 1 0
      .well-known/pki-validation/v.9026.com.html
  5. 26 0
      404.html
  6. 96 0
      addons/zh_jdgjb/SignatureHelper.php
  7. 121 0
      addons/zh_jdgjb/admin/common/attachurl.php
  8. 290 0
      addons/zh_jdgjb/admin/common/bootstrap.sys.inc.php
  9. 401 0
      addons/zh_jdgjb/admin/common/common.func.php
  10. 93 0
      addons/zh_jdgjb/admin/common/template.func.php
  11. 163 0
      addons/zh_jdgjb/admin/index.php
  12. 101 0
      addons/zh_jdgjb/admin/source/site/entry.ctrl.php
  13. 116 0
      addons/zh_jdgjb/admin/source/user/login.ctrl.php
  14. 12 0
      addons/zh_jdgjb/admin/source/user/logout.ctrl.php
  15. 7 0
      addons/zh_jdgjb/admin/source/utility/__init.php
  16. 8 0
      addons/zh_jdgjb/admin/themes/default/common/footer-base.html
  17. 33 0
      addons/zh_jdgjb/admin/themes/default/common/footer-cms.html
  18. 54 0
      addons/zh_jdgjb/admin/themes/default/common/footer-gw.html
  19. 6 0
      addons/zh_jdgjb/admin/themes/default/common/footer.html
  20. 46 0
      addons/zh_jdgjb/admin/themes/default/common/header-base.html
  21. 136 0
      addons/zh_jdgjb/admin/themes/default/common/header-cms.html
  22. 147 0
      addons/zh_jdgjb/admin/themes/default/common/header-gw.html
  23. 219 0
      addons/zh_jdgjb/admin/themes/default/common/header.html
  24. 8 0
      addons/zh_jdgjb/admin/themes/default/common/message.html
  25. 181 0
      addons/zh_jdgjb/admin/themes/default/user/login.html
  26. 25 0
      addons/zh_jdgjb/baiduSdk/AipContentCensor.php
  27. 530 0
      addons/zh_jdgjb/baiduSdk/AipFace.php
  28. 211 0
      addons/zh_jdgjb/baiduSdk/AipImageCensor.php
  29. 273 0
      addons/zh_jdgjb/baiduSdk/AipImageClassify.php
  30. 324 0
      addons/zh_jdgjb/baiduSdk/AipImageSearch.php
  31. 189 0
      addons/zh_jdgjb/baiduSdk/AipKg.php
  32. 327 0
      addons/zh_jdgjb/baiduSdk/AipNlp.php
  33. 782 0
      addons/zh_jdgjb/baiduSdk/AipOcr.php
  34. 138 0
      addons/zh_jdgjb/baiduSdk/AipSpeech.php
  35. 367 0
      addons/zh_jdgjb/baiduSdk/lib/AipBCEUtil.php
  36. 395 0
      addons/zh_jdgjb/baiduSdk/lib/AipBase.php
  37. 214 0
      addons/zh_jdgjb/baiduSdk/lib/AipHttpClient.php
  38. 174 0
      addons/zh_jdgjb/cert/WxPay.Api.php
  39. 703 0
      addons/zh_jdgjb/cert/WxPay.Data.php
  40. 13 0
      addons/zh_jdgjb/cert/WxPay.Exception.php
  41. 85 0
      addons/zh_jdgjb/cert/WxPay.Notify.php
  42. 26 0
      addons/zh_jdgjb/cert/apiclient_cert_64.pem
  43. 28 0
      addons/zh_jdgjb/cert/apiclient_key_64.pem
  44. 19 0
      addons/zh_jdgjb/cert/rootca.pem
  45. 1 0
      addons/zh_jdgjb/developer.cer
  46. 47 0
      addons/zh_jdgjb/distance/config.php
  47. 168 0
      addons/zh_jdgjb/distance/distance.php
  48. 23 0
      addons/zh_jdgjb/errorCode.php
  49. BIN
      addons/zh_jdgjb/icon.jpg
  50. BIN
      addons/zh_jdgjb/img/5.jpeg
  51. BIN
      addons/zh_jdgjb/img/6.jpg
  52. BIN
      addons/zh_jdgjb/img/7.jpg
  53. BIN
      addons/zh_jdgjb/img/hl.jpg
  54. 1078 0
      addons/zh_jdgjb/inc/func/core.php
  55. 1 0
      addons/zh_jdgjb/inc/upload/tcsj.jpeg
  56. 1 0
      addons/zh_jdgjb/inc/upload/tcsj19.jpeg
  57. 1 0
      addons/zh_jdgjb/inc/upload/tcsj20.jpeg
  58. 1 0
      addons/zh_jdgjb/inc/upload/tcsj21.jpeg
  59. 1 0
      addons/zh_jdgjb/inc/upload/tcsj32..jpeg
  60. 1 0
      addons/zh_jdgjb/inc/upload/tcsj32.jpeg
  61. 1 0
      addons/zh_jdgjb/inc/upload/tcsj33.jpeg
  62. 1 0
      addons/zh_jdgjb/inc/upload/tcsj34.jpeg
  63. 1 0
      addons/zh_jdgjb/inc/upload/tcsj35.jpeg
  64. 1 0
      addons/zh_jdgjb/inc/upload/tcsj36.jpeg
  65. 1 0
      addons/zh_jdgjb/inc/upload/tcsj37.jpeg
  66. 1 0
      addons/zh_jdgjb/inc/upload/tcsj39.jpeg
  67. 1 0
      addons/zh_jdgjb/inc/upload/tcsj41.jpeg
  68. 1 0
      addons/zh_jdgjb/inc/upload/tcsj44.jpeg
  69. 1 0
      addons/zh_jdgjb/inc/upload/tcsj58.jpeg
  70. 1 0
      addons/zh_jdgjb/inc/upload/tcsj59.jpeg
  71. 1 0
      addons/zh_jdgjb/inc/upload/tcsj60.jpeg
  72. 1 0
      addons/zh_jdgjb/inc/upload/tcsj62.jpeg
  73. 1 0
      addons/zh_jdgjb/inc/upload/tcsj63.jpeg
  74. 1 0
      addons/zh_jdgjb/inc/upload/tcsj64.jpeg
  75. 1 0
      addons/zh_jdgjb/inc/upload/tcsj65.jpeg
  76. 1 0
      addons/zh_jdgjb/inc/upload/tcsj66.jpeg
  77. 1 0
      addons/zh_jdgjb/inc/upload/tcsj68.jpeg
  78. 1 0
      addons/zh_jdgjb/inc/upload/tcsj70.jpeg
  79. 1 0
      addons/zh_jdgjb/inc/upload/tcsj71.jpeg
  80. 1 0
      addons/zh_jdgjb/inc/upload/tcsj72.jpeg
  81. 1 0
      addons/zh_jdgjb/inc/upload/tcsj74.jpeg
  82. 1 0
      addons/zh_jdgjb/inc/upload/tcsj75.jpeg
  83. 1 0
      addons/zh_jdgjb/inc/upload/tcsj79.jpeg
  84. 1 0
      addons/zh_jdgjb/inc/upload/tcsj80.jpeg
  85. 31 0
      addons/zh_jdgjb/inc/web/account.inc.php
  86. 28 0
      addons/zh_jdgjb/inc/web/ad.inc.php
  87. 115 0
      addons/zh_jdgjb/inc/web/addaccount.inc.php
  88. 50 0
      addons/zh_jdgjb/inc/web/addad.inc.php
  89. 32 0
      addons/zh_jdgjb/inc/web/addcoupon.inc.php
  90. 100 0
      addons/zh_jdgjb/inc/web/addhotel.inc.php
  91. 38 0
      addons/zh_jdgjb/inc/web/addjfgoods.inc.php
  92. 26 0
      addons/zh_jdgjb/inc/web/addjftype.inc.php
  93. 29 0
      addons/zh_jdgjb/inc/web/addmemberlevel.inc.php
  94. 48 0
      addons/zh_jdgjb/inc/web/addnav.inc.php
  95. 61 0
      addons/zh_jdgjb/inc/web/addroom.inc.php
  96. 38 0
      addons/zh_jdgjb/inc/web/assess.inc.php
  97. 39 0
      addons/zh_jdgjb/inc/web/assessinfo.inc.php
  98. 54 0
      addons/zh_jdgjb/inc/web/auditorhotel.inc.php
  99. 21 0
      addons/zh_jdgjb/inc/web/auditorhotelinfo.inc.php
  100. 5 0
      addons/zh_jdgjb/inc/web/chongzhi.inc.php

+ 8 - 0
.gitignore

xqd
@@ -0,0 +1,8 @@
+.idea/*
+.DS_Store
+attachment/**/*
+!attachment/images/global/**/*
+.idea/
+data/config.php
+data/tpl/*
+runtime/*

+ 1 - 0
.htaccess

xqd
@@ -0,0 +1 @@
+ 

+ 1 - 0
.well-known/pki-validation/fileauth.txt

xqd
@@ -0,0 +1 @@
+201812020000004irpl9kqkz4hau6js4n5km92zklz1qzesene20943pxomof7iu

+ 1 - 0
.well-known/pki-validation/v.9026.com.html

xqd
@@ -0,0 +1 @@
+UWy25hiAbCRZI2GcZTpXvtL95bAQSEoJFnzdEY88Nso

+ 26 - 0
404.html

xqd
@@ -0,0 +1,26 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+<title>404</title>
+<style>
+	body{
+		background-color:#444;
+		font-size:14px;
+	}
+	h3{
+		font-size:60px;
+		color:#eee;
+		text-align:center;
+		padding-top:30px;
+		font-weight:normal;
+	}
+</style>
+</head>
+
+<body>
+<h3>404,您请求的文件不存在!</h3>
+</body>
+</html>

+ 96 - 0
addons/zh_jdgjb/SignatureHelper.php

xqd
@@ -0,0 +1,96 @@
+<?php
+
+
+/**
+ * 签名助手 2017/11/19
+ *
+ * Class SignatureHelper
+ */
+class SignatureHelper {
+
+    /**
+     * 生成签名并发起请求
+     *
+     * @param $accessKeyId string AccessKeyId (https://ak-console.aliyun.com/)
+     * @param $accessKeySecret string AccessKeySecret
+     * @param $domain string API接口所在域名
+     * @param $params array API具体参数
+     * @param $security boolean 使用https
+     * @param $method boolean 使用GET或POST方法请求,VPC仅支持POST
+     * @return bool|\stdClass 返回API接口调用结果,当发生错误时返回false
+     */
+    public function request($accessKeyId, $accessKeySecret, $domain, $params, $security=false, $method='POST') {
+        $apiParams = array_merge(array (
+            "SignatureMethod" => "HMAC-SHA1",
+            "SignatureNonce" => uniqid(mt_rand(0,0xffff), true),
+            "SignatureVersion" => "1.0",
+            "AccessKeyId" => $accessKeyId,
+            "Timestamp" => gmdate("Y-m-d\TH:i:s\Z"),
+            "Format" => "JSON",
+        ), $params);
+        ksort($apiParams);
+
+        $sortedQueryStringTmp = "";
+        foreach ($apiParams as $key => $value) {
+            $sortedQueryStringTmp .= "&" . $this->encode($key) . "=" . $this->encode($value);
+        }
+
+        $stringToSign = "${method}&%2F&" . $this->encode(substr($sortedQueryStringTmp, 1));
+
+        $sign = base64_encode(hash_hmac("sha1", $stringToSign, $accessKeySecret . "&",true));
+
+        $signature = $this->encode($sign);
+
+        $url = ($security ? 'https' : 'http')."://{$domain}/";
+
+        try {
+            $content = $this->fetchContent($url, $method, "Signature={$signature}{$sortedQueryStringTmp}");
+            return json_decode($content);
+        } catch( \Exception $e) {
+            return false;
+        }
+    }
+
+    private function encode($str)
+    {
+        $res = urlencode($str);
+        $res = preg_replace("/\+/", "%20", $res);
+        $res = preg_replace("/\*/", "%2A", $res);
+        $res = preg_replace("/%7E/", "~", $res);
+        return $res;
+    }
+
+    private function fetchContent($url, $method, $body) {
+        $ch = curl_init();
+
+        if($method == 'POST') {
+            curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
+            curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
+        } else {
+            $url .= '?'.$body;
+        }
+
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+            "x-sdk-client" => "php/2.0.0"
+        ));
+
+        if(substr($url, 0,5) == 'https') {
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+        }
+
+        $rtn = curl_exec($ch);
+
+        if($rtn === false) {
+            // 大多由设置等原因引起,一般无法保障后续逻辑正常执行,
+            // 所以这里触发的是E_USER_ERROR,会终止脚本执行,无法被try...catch捕获,需要用户排查环境、网络等故障
+            trigger_error("[CURL_" . curl_errno($ch) . "]: " . curl_error($ch), E_USER_ERROR);
+        }
+        curl_close($ch);
+
+        return $rtn;
+    }
+}

+ 121 - 0
addons/zh_jdgjb/admin/common/attachurl.php

xqd
@@ -0,0 +1,121 @@
+<?php
+
+/**
+
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
+
+ */
+
+defined('IN_IA') or exit('Access Denied');
+
+
+
+//load()->web('common');
+
+//load()->web('template');
+
+//load()->func('file');
+
+//load()->func('tpl');
+
+//load()->model('account');
+
+//load()->model('setting');
+
+//load()->model('user');
+
+//load()->model('permission');
+
+load()->model('attachment');
+
+//load()->classs('oauth2/oauth2client');
+
+
+
+$_W['token'] = token();
+
+/*$session = json_decode(authcode($_GPC['__session']), true);
+
+if (is_array($session)) {
+
+	$user = user_single(array('uid'=>$session['uid']));
+
+	if (is_array($user) && $session['hash'] === md5($user['password'] . $user['salt'])) {
+
+		$_W['uid'] = $user['uid'];
+
+		$_W['username'] = $user['username'];
+
+		$user['currentvisit'] = $user['lastvisit'];
+
+		$user['currentip'] = $user['lastip'];
+
+		$user['lastvisit'] = $session['lastvisit'];
+
+		$user['lastip'] = $session['lastip'];
+
+		$_W['user'] = $user;
+
+		$_W['isfounder'] = user_is_founder($_W['uid']);
+
+		unset($founders);
+
+	} else {
+
+		isetcookie('__session', false, -100);
+
+	}
+
+	unset($user);
+
+}
+
+unset($session);
+
+
+
+if (!empty($_GPC['__uniacid'])) {
+
+	$_W['uniacid'] = intval($_GPC['__uniacid']);
+
+} else {
+
+	$_W['uniacid'] = uni_account_last_switch();
+
+}
+
+
+
+if (!empty($_W['uniacid'])) {
+
+	$_W['uniaccount'] = $_W['account'] = uni_fetch($_W['uniacid']);
+
+	if (empty($_W['account'])) {
+
+		unset($_W['uniacid']);
+
+	}
+
+	$_W['acid'] = $_W['account']['acid'];
+
+	$_W['weid'] = $_W['uniacid'];
+
+}
+
+
+
+if (!empty($_W['uid'])) {
+
+	$_W['highest_role'] = permission_account_user_role($_W['uid']);
+
+	$_W['role'] = permission_account_user_role($_W['uid'], $_W['uniacid']);
+
+}
+
+$_W['template'] = !empty($_W['setting']['basic']['template']) ? $_W['setting']['basic']['template'] : 'default';
+*/
+$_W['attachurl'] = attachment_set_attach_url();
+
+//load()->func('compat.biz');

+ 290 - 0
addons/zh_jdgjb/admin/common/bootstrap.sys.inc.php

xqd
@@ -0,0 +1,290 @@
+<?php
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
+ */
+load()->model('user');
+load()->func('tpl');
+if (file_exists(IA_ROOT . '/framework/model/permission.mod.php')) {
+	load()->model('permission');
+} else {
+
+	function permission_build() {
+		global $_W;
+		$we7_file_permission = require IA_ROOT . '/web/common/permission.inc.php';
+		$permission_frames = require IA_ROOT . '/web/common/frames.inc.php';
+		if (!in_array($_W['role'], array(ACCOUNT_MANAGE_NAME_OPERATOR, ACCOUNT_MANAGE_NAME_MANAGER)) || empty($_W['uniacid'])) {
+			return $we7_file_permission;
+		}
+
+		$cachekey = cache_system_key("permission:{$_W['uniacid']}:{$_W['uid']}");
+		$cache = cache_load($cachekey);
+		if (!empty($cache)) {
+			return $cache;
+		}
+		$permission_exist = permission_account_user_permission_exist($_W['uid'], $_W['uniacid']);
+		if (empty($permission_exist)) {
+			$we7_file_permission['platform'][$_W['role']] = array('platform*');
+			$we7_file_permission['site'][$_W['role']] = array('site*');
+			$we7_file_permission['mc'][$_W['role']] = array('mc*');
+			$we7_file_permission['profile'][$_W['role']] = array('profile*');
+			$we7_file_permission['module'][$_W['role']] = array('manage-account', 'display');
+			$we7_file_permission['wxapp'][$_W['role']] = array('display', 'payment', 'post', 'version');
+			cache_write($cachekey, $we7_file_permission);
+			return $we7_file_permission;
+		}
+		$user_account_permission = permission_account_user_menu($_W['uid'], $_W['uniacid'], PERMISSION_ACCOUNT);
+		$user_wxapp_permission = permission_account_user_menu($_W['uid'], $_W['uniacid'], PERMISSION_WXAPP);
+		$user_permission = array_merge($user_account_permission, $user_wxapp_permission);
+
+		$permission_contain = array('account', 'wxapp', 'system');
+		$section = array();
+		$permission_result = array();
+		foreach ($permission_frames as $key => $frames) {
+			if (!in_array($key, $permission_contain) || empty($frames['section'])) {
+				continue;
+			}
+			foreach ($frames['section'] as $frame_key => $frame) {
+				if (empty($frame['menu'])) {
+					continue;
+				}
+				$section[$key][$frame_key] = $frame['menu'];
+			}
+		}
+		$account = permission_get_nameandurl($section[$permission_contain[0]]);
+		$wxapp = permission_get_nameandurl($section[$permission_contain[1]]);
+		$system = permission_get_nameandurl($section[$permission_contain[2]]);
+		$permission_result = array_merge($account, $wxapp, $system);
+
+		foreach ($permission_result as $permission_val) {
+			if (in_array($permission_val['permission_name'], $user_permission)) {
+				$we7_file_permission[$permission_val['controller']][$_W['role']][] = $permission_val['action'];
+			}
+		}
+		cache_write($cachekey, $we7_file_permission);
+		return $we7_file_permission;
+	}
+
+	function permission_account_user_role($uid = 0, $uniacid = 0) {
+		global $_W;
+		load()->model('user');
+		$role = '';
+		$uid = empty($uid) ? $_W['uid'] : intval($uid);
+
+		if (user_is_founder($uid) && !user_is_vice_founder($uid)) {
+			return ACCOUNT_MANAGE_NAME_FOUNDER;
+		}
+
+		if (user_is_vice_founder($uid)) {
+			return ACCOUNT_MANAGE_NAME_VICE_FOUNDER;
+		}
+
+		if (!empty($uniacid)) {
+			$role = pdo_getcolumn('uni_account_users', array('uid' => $uid, 'uniacid' => $uniacid), 'role');
+			if ($role == ACCOUNT_MANAGE_NAME_OWNER) {
+				$role = ACCOUNT_MANAGE_NAME_OWNER;
+			} elseif ($role == ACCOUNT_MANAGE_NAME_VICE_FOUNDER) {
+				$role = ACCOUNT_MANAGE_NAME_VICE_FOUNDER;
+			} elseif ($role == ACCOUNT_MANAGE_NAME_MANAGER) {
+				$role = ACCOUNT_MANAGE_NAME_MANAGER;
+			} elseif ($role == ACCOUNT_MANAGE_NAME_OPERATOR) {
+				$role = ACCOUNT_MANAGE_NAME_OPERATOR;
+			} elseif ($role == ACCOUNT_MANAGE_NAME_CLERK) {
+				$role = ACCOUNT_MANAGE_NAME_CLERK;
+			}
+		} else {
+			$roles = pdo_getall('uni_account_users', array('uid' => $uid), array('role'), 'role');
+			$roles = array_keys($roles);
+			if (in_array(ACCOUNT_MANAGE_NAME_VICE_FOUNDER, $roles)) {
+				$role = ACCOUNT_MANAGE_NAME_VICE_FOUNDER;
+			} elseif (in_array(ACCOUNT_MANAGE_NAME_OWNER, $roles)) {
+				$role = ACCOUNT_MANAGE_NAME_OWNER;
+			} elseif (in_array(ACCOUNT_MANAGE_NAME_MANAGER, $roles)) {
+				$role = ACCOUNT_MANAGE_NAME_MANAGER;
+			} elseif (in_array(ACCOUNT_MANAGE_NAME_OPERATOR, $roles)) {
+				$role = ACCOUNT_MANAGE_NAME_OPERATOR;
+			} elseif (in_array(ACCOUNT_MANAGE_NAME_CLERK, $roles)) {
+				$role = ACCOUNT_MANAGE_NAME_CLERK;
+			}
+		}
+		$role = empty($role) ? ACCOUNT_MANAGE_NAME_OPERATOR : $role;
+		return $role;
+	}
+
+
+	function permission_account_user_permission_exist($uid = 0, $uniacid = 0) {
+		global $_W;
+		load()->model('user');
+		$uid = intval($uid) > 0 ? $uid : $_W['uid'];
+		$uniacid = intval($uniacid) > 0 ? $uniacid : $_W['uniacid'];
+		if (user_is_founder($uid)) {
+			return false;
+		}
+		if (FRAME == 'system') {
+			return true;
+		}
+		$is_exist = pdo_get('users_permission', array('uid' => $uid, 'uniacid' => $uniacid), array('id'));
+		if(empty($is_exist)) {
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+
+	function permission_account_user($type = 'system') {
+		global $_W;
+		$user_permission = pdo_getcolumn('users_permission', array('uid' => $_W['uid'], 'uniacid' => $_W['uniacid'], 'type' => $type), 'permission');
+		if (!empty($user_permission)) {
+			$user_permission = explode('|', $user_permission);
+		} else {
+			$user_permission = array('account*', 'wxapp*');
+		}
+		$permission_append = frames_menu_append();
+		if (!empty($permission_append[$_W['role']])) {
+			$user_permission = array_merge($user_permission, $permission_append[$_W['role']]);
+		}
+		if (empty($_W['role']) && empty($_W['uniacid'])) {
+			$user_permission = array_merge($user_permission, $permission_append['operator']);
+		}
+		return (array)$user_permission;
+	}
+
+
+	function permission_account_user_menu($uid, $uniacid, $type) {
+		$user_menu_permission = array();
+
+		$uid = intval($uid);
+		$uniacid = intval($uniacid);
+		$type = trim($type);
+		if (empty($uid) || empty($uniacid) || empty($type)) {
+			return error(-1, '参数错误!');
+		}
+		$permission_exist = permission_account_user_permission_exist($uid, $uniacid);
+		if (empty($permission_exist)) {
+			return array('all');
+		}
+		if ($type == 'modules') {
+			$user_menu_permission = pdo_fetchall("SELECT * FROM " . tablename('users_permission') . " WHERE uniacid = :uniacid AND uid  = :uid AND type != '" . PERMISSION_ACCOUNT . "' AND type != '" . PERMISSION_WXAPP . "'", array(':uniacid' => $uniacid, ':uid' => $uid), 'type');
+		} else {
+			$module = uni_modules_by_uniacid($uniacid);
+			$module = array_keys($module);
+			if (in_array($type, $module) || in_array($type, array(PERMISSION_ACCOUNT, PERMISSION_WXAPP, PERMISSION_SYSTEM))) {
+				$menu_permission = pdo_getcolumn('users_permission', array('uniacid' => $uniacid, 'uid' => $uid, 'type' => $type), 'permission');
+				if (!empty($menu_permission)) {
+					$user_menu_permission = explode('|', $menu_permission);
+				}
+			}
+		}
+
+		return $user_menu_permission;
+	}
+
+
+	function permission_menu_name() {
+		load()->model('system');
+		$menu_permission = array();
+
+		$menu_list = system_menu_permission_list();
+		$middle_menu = array();
+		$middle_sub_menu = array();
+		if (!empty($menu_list)) {
+			foreach ($menu_list as $nav_id => $section) {
+				foreach ($section['section'] as $section_id => $section) {
+					if (!empty($section['menu'])) {
+						$middle_menu[] = $section['menu'];
+					}
+				}
+			}
+		}
+
+		if (!empty($middle_menu)) {
+			foreach ($middle_menu as $menu) {
+				foreach ($menu as $menu_val) {
+					$menu_permission[] = $menu_val['permission_name'];
+					if (!empty($menu_val['sub_permission'])) {
+						$middle_sub_menu[] = $menu_val['sub_permission'];
+					}
+				}
+			}
+		}
+
+		if (!empty($middle_sub_menu)) {
+			foreach ($middle_sub_menu as $sub_menu) {
+				foreach ($sub_menu as $sub_menu_val) {
+					$menu_permission[] = $sub_menu_val['permission_name'];
+				}
+			}
+		}
+		return $menu_permission;
+	}
+}
+if (!function_exists('uni_permission')) {
+function uni_permission($uid = 0, $uniacid = 0) {
+	global $_W;
+	$role = '';
+	$uid = empty($uid) ? $_W['uid'] : intval($uid);
+
+	$founders = explode(',', $_W['config']['setting']['founder']);
+	if (in_array($uid, $founders)) {
+		return ACCOUNT_MANAGE_NAME_FOUNDER;
+	}
+	if (!empty($uniacid)) {
+		$role = pdo_getcolumn('uni_account_users', array('uid' => $uid, 'uniacid' => $uniacid), 'role');
+		if ($role == ACCOUNT_MANAGE_NAME_OWNER) {
+			$role = ACCOUNT_MANAGE_NAME_OWNER;
+		} elseif ($role == ACCOUNT_MANAGE_NAME_MANAGER) {
+			$role = ACCOUNT_MANAGE_NAME_MANAGER;
+		} elseif ($role == ACCOUNT_MANAGE_NAME_OPERATOR) {
+			$role = ACCOUNT_MANAGE_NAME_OPERATOR;
+		}
+	} else {
+		$roles = pdo_getall('uni_account_users', array('uid' => $uid), array('role'), 'role');
+		$roles = array_keys($roles);
+		if (in_array(ACCOUNT_MANAGE_NAME_OWNER, $roles)) {
+			$role = ACCOUNT_MANAGE_NAME_OWNER;
+		} elseif (in_array(ACCOUNT_MANAGE_NAME_MANAGER, $roles)) {
+			$role = ACCOUNT_MANAGE_NAME_MANAGER;
+		} elseif (in_array(ACCOUNT_MANAGE_NAME_OPERATOR, $roles)) {
+			$role = ACCOUNT_MANAGE_NAME_OPERATOR;
+		}
+	}
+	return $role;
+}
+}
+$_W['token'] = token();
+$session = json_decode(base64_decode($_GPC['__session']), true);
+if(is_array($session)) {
+	$user = user_single(array('uid'=>$session['uid']));
+	if(is_array($user) && $session['hash'] == md5($user['password'] . $user['salt'])) {
+		$_W['uid'] = $user['uid'];
+		$_W['username'] = $user['username'];
+		$user['currentvisit'] = $user['lastvisit'];
+		$user['currentip'] = $user['lastip'];
+		$user['lastvisit'] = $session['lastvisit'];
+		$user['lastip'] = $session['lastip'];
+		$_W['user'] = $user;
+		$founders = explode(',', $_W['config']['setting']['founder']);
+		$_W['isfounder'] = in_array($_W['uid'], $founders);
+		unset($founders);
+	} else {
+		isetcookie('__session', false, -100);
+	}
+	unset($user);
+}
+unset($session);
+
+if(!empty($_GPC['__uniacid'])) {
+	$_W['uniacid'] = intval($_GPC['__uniacid']);
+	$_W['uniaccount'] = $_W['account'] = uni_fetch($_W['uniacid']);
+	$_W['acid'] = $_W['account']['acid'];
+	$_W['weid'] = $_W['uniacid'];
+	if(!empty($_W['uid'])) {
+		$_W['role'] = uni_permission($_W['uid'], $_W['uniacid']);
+	}
+}
+$_W['template'] = 'default';
+if(!empty($_W['setting']['basic']['template'])) {
+	$_W['template'] = $_W['setting']['basic']['template'];
+}
+load()->func('compat.biz');

+ 401 - 0
addons/zh_jdgjb/admin/common/common.func.php

xqd
@@ -0,0 +1,401 @@
+<?php
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+
+
+function url($segment, $params = array()) {
+
+	list($controller, $action, $do) = explode('/', $segment);
+	$url = './zhjd.php?';
+	if(!empty($controller)) {
+		$url .= "c={$controller}&";
+	}
+	if(!empty($action)) {
+		$url .= "a={$action}&";
+	}
+	if(!empty($do)) {
+		$url .= "do={$do}&";
+		
+	}
+	if(!empty($params)) {
+		$queryString = http_build_query($params, '', '&');
+		$url .= $queryString;
+	}
+	//echo $url;die;
+	return $url;
+
+//	return wurl($segment, $params);
+}
+
+function message($msg, $redirect = '', $type = '') {
+
+	global $_W, $_GPC;
+	if($redirect == 'refresh') {
+		$redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING'];
+	}
+	if($redirect == 'referer') {
+		$redirect = referer();
+	}
+	if($redirect == '') {
+		$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'info';
+	} else {
+		$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'success';
+	}
+	if ($_W['isajax'] || !empty($_GET['isajax']) || $type == 'ajax') {
+
+
+		if($type != 'ajax' && !empty($_GPC['target'])) {
+			exit("
+<script type=\"text/javascript\">
+parent.require(['jquery', 'util'], function($, util){
+	var url = ".(!empty($redirect) ? 'parent.location.href' : "''").";
+	var modalobj = util.message('".$msg."', '', '".$type."');
+	if (url) {
+		modalobj.on('hide.bs.modal', function(){\$('.modal').each(function(){if(\$(this).attr('id') != 'modal-message') {\$(this).modal('hide');}});top.location.reload()});
+	}
+});
+</script>");
+		} else {
+			$vars = array();
+			$vars['message'] = $msg;
+			$vars['redirect'] = $redirect;
+			$vars['type'] = $type;
+			exit(json_encode($vars));
+		}
+	}
+	if (empty($msg) && !empty($redirect)) {
+		header('location: '.$redirect);
+	}
+	$label = $type;
+	if($type == 'error') {
+		$label = 'danger';
+	}
+	if($type == 'ajax' || $type == 'sql') {
+		$label = 'warning';
+	}
+	include template('common/message', TEMPLATE_INCLUDEPATH);
+	exit();
+}
+
+
+function checklogin() {
+	global $_W;
+	if (empty($_W['uid'])) {
+		$url = url('user/login');
+		header('location:' . $url);
+	} else {
+		$account = pdo_fetch("SELECT * FROM " . tablename("zh_jdgjb_account") . " WHERE status=2 AND uid=:uid ORDER BY id DESC LIMIT 1", array(':uid' => $_W['uid']));
+		if (empty($account)) {
+			$url = url('user/login');
+			header('location:' . $url);
+
+		}
+	}
+	return true;
+}
+
+
+function checkaccount() {
+	global $_W;
+	if (empty($_W['uniacid'])) {
+		message('这项功能需要你选择特定公众号才能使用!', url('account/display'), 'info');
+	}
+}
+
+function url_params($url) {
+	$result = array();
+	if (empty($url)) {
+		return $result;
+	}
+	$components = parse_url($url);
+	$params = explode('&',$components['query']);
+	foreach ($params as $param) {
+		if (!empty($param)) {
+			$param_array = explode('=',$param);
+			$result[$param_array[0]] = $param_array[1];
+		}
+	}
+	return $result;
+}
+
+function buildframes($frame = array('platform')){
+	global $_W, $_GPC;
+	if($_W['role'] == 'clerk') {
+		return false;
+	}
+	$GLOBALS['top_nav'] = pdo_fetchall('SELECT name, title, append_title FROM ' . tablename('core_menu') . ' WHERE pid = 0 AND is_display = 1 ORDER BY displayorder DESC');
+	$ms = cache_load('system_frame');
+	if(empty($ms)) {
+		cache_build_frame_menu();
+		$ms = cache_load('system_frame');
+	}
+	load()->model('module');
+	$frames = array();
+	$modules = uni_modules(false);
+	$modules_temp = array_keys($modules);
+	$status = uni_user_permission_exist();
+	if(is_error($status)) {
+		$modules_temp = pdo_fetchall('SELECT type FROM ' . tablename('users_permission') . ' WHERE uniacid = :uniacid AND uid = :uid AND type != :type', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['uid'], ':type' => 'system'), 'type');
+		if(!empty($modules_temp)) {
+			$modules_temp = array_keys($modules_temp);
+		} else {
+			$modules = array();
+		}
+	}
+	if(!empty($modules)) {
+		$sysmods = system_modules();
+		foreach($modules as $m) {
+			if (empty($m['isdisplay'])) {
+				continue;
+			}
+			if(in_array($m['name'], $sysmods)) {
+				$_W['setting']['permurls']['modules'][] = $m['name'];
+				continue;
+			}
+			if(in_array($m['name'], $modules_temp)) {
+				if($m['enabled']) {
+					$frames[$m['type']][] = $m;
+				}
+				$_W['setting']['permurls']['modules'][] = $m['name'];
+			}
+		}
+	}
+	if(is_error($status)) {
+		$system = array();
+		$system = uni_user_permission('system');
+		if (!empty($system) || !empty($modules_temp)) {
+						foreach ($ms as $name => $section) {
+				$hassection = false;
+				foreach ($section as $i => $menus) {
+					$hasitems = false;
+					if(empty($menus['items'])) continue;
+					foreach ($menus['items'] as $j => $menu) {
+						if (!in_array($menu['permission_name'], $system)) {
+							unset($ms[$name][$i]['items'][$j]);
+						} else {
+							$hasitems = true;
+							$hassection = true;
+						}
+					}
+					if (!$hasitems) {
+						unset($ms[$name][$i]);
+					}
+				}
+				if (!$hassection) {
+					unset($ms[$name]);
+				} else {
+					$_W['setting']['permurls']['sections'][] = $name;
+				}
+			}
+		}
+	}
+	$types = module_types();
+	if(!empty($frames)) {
+		foreach($frames as $type => $fs) {
+			$items = array();
+			if(!empty($fs)) {
+				foreach($fs as $m) {
+					$items[] = array(
+						'title' => $m['title'],
+						'url' => url('home/welcome/ext', array('m' => $m['name']))
+					);
+				}
+			}
+			$ms['ext'][] = array(
+				'title' => $types[$type]['title'],
+				'items' => $items
+			);
+		}
+		if(is_error($status)) {
+			$_W['setting']['permurls']['sections'][] = 'ext';
+		}
+	}
+	$GLOBALS['ext_type'] = 0;
+	$m = trim($_GPC['m']);
+	$eid = intval($_GPC['eid']);
+	if(FRAME == 'ext' && (!empty($m) || !empty($eid)) && $GLOBALS['ext_type'] != 2) {
+		if(empty($_COOKIE['ext_type'])) {
+			setcookie('ext_type', 1, TIMESTAMP + 8640000, "/");
+			$_COOKIE['ext_type'] = 1;
+		}
+		$GLOBALS['ext_type'] = $_COOKIE['ext_type'];
+		if(empty($m)) {
+			$m = pdo_fetchcolumn('SELECT module FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid));
+		}
+		$module = module_fetch($m);
+		$entries = module_entries($m);
+		if(is_error($status)) {
+			$permission = uni_user_permission($m);
+			if($permission[0] != 'all') {
+				if(!in_array($m.'_rule', $permission)) {
+					unset($module['isrulefields']);
+				}
+				if(!in_array($m.'_settings', $permission)) {
+					unset($module['settings']);
+				}
+				if(!in_array($m.'_home', $permission)) {
+					unset($entries['home']);
+				}
+				if(!in_array($m.'_profile', $permission)) {
+					unset($entries['profile']);
+				}
+				if(!in_array($m.'_shortcut', $permission)) {
+					unset($entries['shortcut']);
+				}
+				if(!empty($entries['cover'])) {
+					foreach($entries['cover'] as $k => $row) {
+						if(!in_array($m.'_cover_'.$row['do'], $permission)) {
+							unset($entries['cover'][$k]);
+						}
+					}
+				}
+				if(!empty($entries['menu'])) {
+					foreach($entries['menu'] as $k => $row) {
+						if(!in_array($m.'_menu_'.$row['do'], $permission)) {
+							unset($entries['menu'][$k]);
+						}
+					}
+				}
+			}
+		}
+		$entries_filter = array_elements(array('cover', 'menu', 'mine'), $entries);
+		$navs = array(
+			array(
+				'title' => "模块列表",
+				'items' => array(
+					array(
+						'title' => "<i class='fa fa-reply-all'></i> &nbsp;&nbsp;返回模块列表",
+						'url' => url('home/welcome/ext', array('a' => 0)),
+					),
+					array(
+						'title' => "<i class='fa fa-reply-all'></i> &nbsp;&nbsp;返回{$module['title']}",
+						'url' => url('home/welcome/ext', array('m' => $m, 't' => 1)),
+					),
+				),
+			),
+		);
+		if($module['isrulefields'] || $module['settings']) {
+			$navs['rule'] = array(
+				'title' => "回复规则",
+			);
+			if($module['isrulefields']) {
+				$navs['rule']['items'][] = array(
+					'title' => "<i class='fa fa-comments'></i> &nbsp;&nbsp;回复规则列表",
+					'url' => url('platform/reply', array('m' => $m)),
+				);
+			}
+			if($module['settings']) {
+				$navs['rule']['items'][] = array(
+					'title' => "<i class='fa fa-cog'></i> &nbsp;&nbsp;参数设置",
+					'url' => url('profile/module/setting', array('m' => $m)),
+				);
+			}
+		}
+		if($entries['home'] || $entries['profile'] || $entries['shortcut']) {
+			$navs['nav'] = array(
+				'title' => "导航菜单",
+			);
+			if($entries['home']) {
+				$navs['nav']['items'][] = array(
+					'title' => "<i class='fa fa-home'></i> &nbsp;&nbsp;微站首页导航",
+					'url' => url('site/nav/home', array('m' => $m)),
+				);
+			}
+			if($entries['profile']) {
+				$navs['nav']['items'][] = array(
+					'title' => "<i class='fa fa-user'></i> &nbsp;&nbsp;个人中心导航",
+					'url' => url('site/nav/profile', array('m' => $m)),
+				);
+			}
+			if($entries['shortcut']) {
+				$navs['nav']['items'][] = array(
+					'title' => "<i class='fa fa-plane'></i> &nbsp;&nbsp;快捷菜单",
+					'url' => url('site/nav/shortcut', array('m' => $m)),
+				);
+			}
+		}
+		$menus = array(
+			'menu' => "业务菜单",
+			'cover' => "封面入口",
+			'mine' => "自定义菜单",
+		);
+
+		foreach($entries_filter as $key => $row) {
+			if(empty($row)) continue;
+			if(!isset($navs[$key])) {
+
+				$navs[$key] = array(
+					'title' => $menus[$key],
+				);
+			}
+			foreach($row as $li) {
+				$navs[$key]['items'][] = array(
+					'title' => "<i class='{$li["icon"]}'></i> &nbsp;&nbsp;{$li['title']}",
+					'url' => $li['url']
+				);
+			}
+		}
+	}
+	if($GLOBALS['ext_type'] == 1) {
+		$ms['ext'] = $navs;
+	} elseif($GLOBALS['ext_type'] == 3) {
+		$ms['ext'] = array_merge($navs, $ms['ext']);
+	}
+	return $ms;
+}
+
+function system_modules() {
+	return array(
+		'basic', 'news', 'music', 'userapi', 'recharge', 
+		'custom', 'images', 'video', 'voice', 'chats', 'wxcard', 'paycenter'
+	);
+}
+
+
+function 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);
+	return './index.php?' . $query;
+}
+
+
+function site_profile_perfect_tips(){
+	global $_W;
+	
+	if ($_W['isfounder'] && (empty($_W['setting']['site']) || empty($_W['setting']['site']['profile_perfect']))) {
+		if (!defined('SITE_PROFILE_PERFECT_TIPS')) {
+			$url = url('cloud/profile');
+			return <<<EOF
+$(function() {
+	var html = 
+		'<div id="siteinfo-tips" class="upgrade-tips">'+
+			'<a href="{$url}" target="_blank">请尽快完善您在微擎云服务平台的站点注册信息。</a>'+
+		'</div>';
+	$('body').prepend(html);
+});
+EOF;
+			define('SITE_PROFILE_PERFECT_TIPS', true);
+		}
+	}
+	return '';
+}

+ 93 - 0
addons/zh_jdgjb/admin/common/template.func.php

xqd
@@ -0,0 +1,93 @@
+<?php
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+
+
+function template($filename, $flag = TEMPLATE_DISPLAY)
+{
+    global $_W;
+
+    $source = IA_ROOT . "/addons/zh_jdgjb/admin/themes/default/{$filename}.html";
+    $compile = IA_ROOT . "/data/tpl/web/zh_jdgjb/default/{$filename}.tpl.php";
+
+    if (!is_file($source)) {
+        exit("Error: template source '{$filename}' is not exist!");
+    }
+    if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
+        template_compile($source, $compile);
+    }
+    switch ($flag) {
+        case TEMPLATE_DISPLAY:
+        default:
+            extract($GLOBALS, EXTR_SKIP);
+            include $compile;
+            break;
+        case TEMPLATE_FETCH:
+            extract($GLOBALS, EXTR_SKIP);
+            ob_flush();
+            ob_clean();
+            ob_start();
+            include $compile;
+            $contents = ob_get_contents();
+            ob_clean();
+            return $contents;
+            break;
+        case TEMPLATE_INCLUDEPATH:
+            return $compile;
+            break;
+    }
+}
+
+
+function template_compile($from, $to, $inmodule = false)
+{
+    $path = dirname($to);
+    if (!is_dir($path)) {
+        load()->func('file');
+        mkdirs($path);
+    }
+    $content = template_parse(file_get_contents($from), $inmodule);
+    if (IMS_FAMILY == 'x' && !preg_match('/(footer|header|account\/welcome|login|register)+/', $from)) {
+        $content = str_replace('餐饮', '系统', $content);
+    }
+    file_put_contents($to, $content);
+}
+
+
+function template_parse($str, $inmodule = false)
+{
+    $str = preg_replace('/<!--{(.+?)}-->/s', '{$1}', $str);
+    $str = preg_replace('/{template\s+(.+?)}/', '<?php (!empty($this) && $this instanceof WeModuleSite || ' . intval($inmodule) . ') ? (include $this->template($1, TEMPLATE_INCLUDEPATH)) : (include template($1, TEMPLATE_INCLUDEPATH));?>', $str);
+    $str = preg_replace('/{php\s+(.+?)}/', '<?php $1?>', $str);
+    $str = preg_replace('/{if\s+(.+?)}/', '<?php if($1) { ?>', $str);
+    $str = preg_replace('/{else}/', '<?php } else { ?>', $str);
+    $str = preg_replace('/{else ?if\s+(.+?)}/', '<?php } else if($1) { ?>', $str);
+    $str = preg_replace('/{\/if}/', '<?php } ?>', $str);
+    $str = preg_replace('/{loop\s+(\S+)\s+(\S+)}/', '<?php if(is_array($1)) { foreach($1 as $2) { ?>', $str);
+    $str = preg_replace('/{loop\s+(\S+)\s+(\S+)\s+(\S+)}/', '<?php if(is_array($1)) { foreach($1 as $2 => $3) { ?>', $str);
+    $str = preg_replace('/{\/loop}/', '<?php } } ?>', $str);
+    $str = preg_replace('/{(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)}/', '<?php echo $1;?>', $str);
+    $str = preg_replace('/{(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\[\]\'\"\$]*)}/', '<?php echo $1;?>', $str);
+    $str = preg_replace('/{url\s+(\S+)}/', '<?php echo url($1);?>', $str);
+    $str = preg_replace('/{url\s+(\S+)\s+(array\(.+?\))}/', '<?php echo url($1, $2);?>', $str);
+    $str = preg_replace('/{media\s+(\S+)}/', '<?php echo tomedia($1);?>', $str);
+    $str = preg_replace_callback('/<\?php([^\?]+)\?>/s', "template_addquote", $str);
+    $str = preg_replace('/{([A-Z_\x7f-\xff][A-Z0-9_\x7f-\xff]*)}/s', '<?php echo $1;?>', $str);
+    $str = str_replace('{##', '{', $str);
+    $str = str_replace('##}', '}', $str);
+    if (!empty($GLOBALS['_W']['setting']['remote']['type'])) {
+        $str = str_replace('</body>', "<script>$(function(){\$('img').attr('onerror', '').on('error', function(){if (!\$(this).data('check-src') && (this.src.indexOf('http://') > -1 || this.src.indexOf('https://') > -1)) {this.src = this.src.indexOf('{$GLOBALS['_W']['attachurl_local']}') == -1 ? this.src.replace('{$GLOBALS['_W']['attachurl_remote']}', '{$GLOBALS['_W']['attachurl_local']}') : this.src.replace('{$GLOBALS['_W']['attachurl_local']}', '{$GLOBALS['_W']['attachurl_remote']}');\$(this).data('check-src', true);}});});</script></body>", $str);
+    }
+    $str = "<?php defined('IN_IA') or exit('Access Denied');?>" . $str;
+    return $str;
+}
+
+function template_addquote($matchs)
+{
+    $code = "<?php {$matchs[1]}?>";
+    $code = preg_replace('/\[([a-zA-Z0-9_\-\.\x7f-\xff]+)\](?![a-zA-Z0-9_\-\.\x7f-\xff\[\]]*[\'"])/s', "['$1']", $code);
+    return str_replace('\\\"', '\"', $code);
+}

+ 163 - 0
addons/zh_jdgjb/admin/index.php

xqd
@@ -0,0 +1,163 @@
+<?php
+
+define('IN_SYS', true);
+define('IN_dianc_ADMIN', true);
+require '../../../framework/bootstrap.inc.php';
+//require IA_ROOT . '/web/common/bootstrap.sys.inc.php';
+
+define('dianc_ROOT', dirname(dirname(__FILE__)));
+define('IS_OPERATOR', true);
+require dianc_ROOT . '/admin/common/bootstrap.sys.inc.php';
+require dianc_ROOT . '/admin/common/template.func.php';
+require dianc_ROOT . '/admin/common/common.func.php';
+$urls = parse_url($_W['siteroot']);
+$arr = explode('/', $urls['path']);
+do {
+	$val = array_pop($arr);
+} while ($val != 'addons');
+$path = implode('/', $arr);
+if(substr($path, -1) != '/') {
+	$path .= '/';
+}
+$urls['path'] = $path;
+$_W['siteroot'] = $urls['scheme'].'://'.$urls['host'].((!empty($urls['port']) && $urls['port']!='80') ? ':'.$urls['port'] : '').$urls['path'];
+
+//load()->web('common');
+//load()->web('template');
+
+if (empty($_W['isfounder']) && !empty($_W['user']) && $_W['user']['status'] == 1) {
+	message('您的账号正在审核或是已经被系统禁止,请联系网站管理员解决!');
+}
+$acl = array(
+	'user' => array(
+		'default' => 'login',
+		'direct' => array(
+			'login',
+			'register',
+			'logout',
+		),
+	),
+);
+if (($_W['setting']['copyright']['status'] == 1) && empty($_W['isfounder']) && $controller != 'cloud' && $controller != 'utility' && $controller != 'account') {
+	$_W['siteclose'] = true;
+	if ($controller == 'account' && $action == 'welcome') {
+		template('account/welcome');
+		exit;
+	}
+	if ($controller == 'user' && $action == 'login') {
+		if (checksubmit()) {
+			require _forward($controller, $action);
+		}
+		template('user/login');
+		exit;
+	}
+	isetcookie('__session', '', -10000);
+	message('站点已关闭,关闭原因:' . $_W['setting']['copyright']['reason'], url('account/welcome'), 'info');
+}
+
+$controllers = array();
+$handle = opendir(IA_ROOT . '/web/source/');
+if(!empty($handle)) {
+	while($dir = readdir($handle)) {
+		if($dir != '.' && $dir != '..') {
+			$controllers[] = $dir;
+		}
+	}
+}
+if(!in_array($controller, $controllers)) {
+	$controller = 'account';
+}
+$init = IA_ROOT . "/web/source/{$controller}/__init.php";
+if(is_file($init)) {
+	require $init;
+}
+
+$actions = array();
+$handle = opendir(IA_ROOT . '/web/source/' . $controller);
+if(!empty($handle)) {
+	while($dir = readdir($handle)) {
+		if($dir != '.' && $dir != '..' && strexists($dir, '.ctrl.php')) {
+			$dir = str_replace('.ctrl.php', '', $dir);
+			$actions[] = $dir;
+		}
+	}
+}
+if(empty($actions)) {
+	header('location: ?refresh');
+}
+if(!in_array($action, $actions)) {
+	$action = $acl[$controller]['default'];
+}
+if(!in_array($action, $actions)) {
+	$action = $actions[0];
+}
+
+$_W['page'] = array();
+$_W['page']['copyright'] = $_W['setting']['copyright'];
+
+if(is_array($acl[$controller]['direct']) && in_array($action, $acl[$controller]['direct'])) {
+		require _forward($controller, $action);
+	exit;
+}
+if(is_array($acl[$controller]['founder']) && in_array($action, $acl[$controller]['founder'])) {
+		if(!$_W['isfounder']) {
+		message('不能访问, 需要创始人权限才能访问.');
+	}
+}
+checklogin();
+if(!defined('IN_GW')) {
+//	checkaccount();
+	if(!in_array($_W['role'], array('manager', 'operator', 'founder', 'clerk'))) {
+//		message('您的账号没有访问此公众号的权限.');
+	}
+}
+require _forward($controller, $action);
+
+define('ENDTIME', microtime());
+if (empty($_W['config']['setting']['maxtimeurl'])) {
+	$_W['config']['setting']['maxtimeurl'] = 10;
+}
+if ((ENDTIME - STARTTIME) > $_W['config']['setting']['maxtimeurl']) {
+	$data = array(
+		'type' => '1',
+		'runtime' => ENDTIME - STARTTIME,
+		'runurl' => $_W['sitescheme'].$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
+		'createtime' => TIMESTAMP
+	);
+	pdo_insert('core_performance', $data);
+}
+
+function _forward($c, $a) {
+	$file = dianc_ROOT . '/admin/source/' . $c . '/' . $a . '.ctrl.php';
+	return $file;
+}
+
+function _calc_current_frames(&$frames) {
+	global $controller, $action;
+	if(!empty($frames) && is_array($frames)) {
+		foreach($frames as &$frame) {
+			if(empty($frame['items'])) continue;
+			foreach($frame['items'] as &$fr) {
+				$query = parse_url($fr['url'], PHP_URL_QUERY);
+				parse_str($query, $urls);
+				if(empty($urls)) continue;
+				if(defined('ACTIVE_FRAME_URL')) {
+					$query = parse_url(ACTIVE_FRAME_URL, PHP_URL_QUERY);
+					parse_str($query, $get);
+				} else {
+					$get = $_GET;
+					$get['c'] = $controller;
+					$get['a'] = $action;
+				}
+				if(!empty($do)) {
+					$get['do'] = $do;
+				}
+
+				$diff = array_diff_assoc($urls, $get);
+				if(empty($diff)) {
+					$fr['active'] = ' active';
+				}
+			}
+		}
+	}
+}

+ 101 - 0
addons/zh_jdgjb/admin/source/site/entry.ctrl.php

xqd
@@ -0,0 +1,101 @@
+<?php
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+load()->model('module');
+load()->model('extension');
+
+$eid = intval($_GPC['eid']);
+//echo $eid;die;
+if(!empty($eid)) {
+	$entry = module_entry($eid);
+} else {
+	$sql = 'SELECT * FROM ' . tablename('modules_bindings') . ' WHERE module = :module AND do = :do';
+	$entry = pdo_fetch($sql, array(':module' => trim($_GPC['m']), ':do' => trim($_GPC['do'])));
+	if (empty($entry)) {
+		$entry = array(
+			'module' => $_GPC['m'],
+			'do' => $_GPC['do'],
+			'state' => $_GPC['state'],
+			'direct' => $_GPC['direct']
+		);
+	}
+}
+if(empty($entry) || empty($entry['do'])) {
+	message('非法访问.');
+}
+if(!$entry['direct']) {
+	checklogin();
+	load()->model('module');
+	$module = module_fetch($entry['module']);
+	
+	if(empty($module)) {
+		message("访问非法, 没有操作权限. (module: {$entry['module']})");
+	}
+	// if($entry['entry'] == 'menu') {
+	// 	if (IMS_VERSION <= '1.5.3') {
+	// 		$permission = uni_user_module_permission_check($entry['module'] . '_menu_' . $entry['do'], $entry['module']);
+	// 	} else {
+	// 		$permission = permission_check_account_user_module($entry['module'] . '_menu_' . $entry['do'], $entry['module']);
+	// 	}
+	// } else {
+	// 	if (IMS_VERSION <= '1.5.3') {
+	// 		$permission = uni_user_module_permission_check($entry['module'] . '_rule', $entry['module']);
+	// 	} else {
+	// 		$permission = permission_check_account_user_module($entry['module'] . '_rule', $entry['module']);
+	// 	}
+	// }
+		if ($entry['entry'] == 'menu') {
+		$permission = permission_check_account_user_module($entry['module'] . '_menu_' . $entry['do'], $entry['module']);
+	} else {
+		$permission = permission_check_account_user_module($entry['module'] . '_rule', $entry['module']);
+	}
+
+	if(!$permission) {
+		message('您没有权限进行该操作');
+	}
+	define('FRAME', 'ext');
+	define('CRUMBS_NAV', 1);
+	$ptr_title = $entry['title'];
+	$module_types = module_types();
+	if($_COOKIE['ext_type'] == 1) {
+		define('ACTIVE_FRAME_URL', url('site/entry/', array('eid' => $entry['eid'])));
+	} else {
+		define('ACTIVE_FRAME_URL', url('home/welcome/ext', array('m' => $entry['module'])));
+	}
+	//$frames = buildframes(array(FRAME));
+	$frames = $frames[FRAME];
+}
+
+if(!empty($entry['module']) && !empty($_W['founder'])) {
+	load()->model('extension');
+	if(ext_module_checkupdate($entry['module'])) {
+		message('系统检测到该模块有更新,请点击“<a href="' . url('extension/module/upgrade', array('m' => $entry['module'])) . '">更新模块</a>”后继续使用!', '', 'error');
+	}
+}
+
+$_GPC['__entry'] = $entry['title'];
+$_GPC['__state'] = $entry['state'];
+$_GPC['state'] = $entry['state'];
+$_GPC['m'] = $entry['module'];
+$_GPC['do'] = $entry['do'];
+
+if(!empty($_W['modules'][$entry['module']]['handles']) && (count($_W['modules'][$entry['module']]['handles']) > 1 || !in_array('text', $_W['modules'][$entry['module']]['handles']))) {
+	$handlestips = true;
+}
+$modules = uni_modules();
+$_W['current_module'] = $modules[$entry['module']];
+$site = WeUtility::createModuleSite($entry['module']);
+define('IN_MODULE', $entry['module']);
+if(!is_error($site)) {
+	$sysmodule = system_modules();
+	if(in_array($m, $sysmodule)) {
+		$site_urls = $site->getTabUrls();
+	}
+	$method = 'doWeb' . ucfirst($entry['do']);
+	exit($site->$method());
+}
+  
+exit("访问的方法 {$method} 不存在.");

+ 116 - 0
addons/zh_jdgjb/admin/source/user/login.ctrl.php

xqd
@@ -0,0 +1,116 @@
+<?php
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+define('IN_GW', true);
+if(checksubmit() || $_W['isajax']) {
+	_login($_GPC['referer']);
+}
+
+$setting = $_W['setting'];
+template('user/login');
+function _login($forward = '') {
+
+	global $_GPC, $_W;
+	load()->model('user');
+	$member = array();
+	$username = trim($_GPC['username']);
+//	pdo_query('DELETE FROM'.tablename('users_failed_login'). ' WHERE lastupdate < :timestamp', array(':timestamp' => TIMESTAMP-300));
+//	$failed = pdo_get('users_failed_login', array('username' => $username, 'ip' => CLIENT_IP));
+//	if ($failed['count'] >= 5) {
+//		message('输入密码错误次数超过5次,请在5分钟后再登录',referer(), 'info');
+//	}
+//	$verify = trim($_GPC['verify']);
+//	if(empty($verify)) {
+//		message('请输入验证码');
+//	}
+//	$result = checkcaptcha($verify);
+//	if (empty($result)) {
+//		message('输入验证码错误');
+//	}
+	if(empty($username)) {
+		message('请输入要登录的用户名');
+	}
+	$member['username'] = $username;
+	$member['password'] = $_GPC['password'];
+	if(empty($member['password'])) {
+		message('请输入密码');
+	}
+	$record = user_single($member);
+	if(!empty($record)) {
+		if($record['status'] == 1) {
+			message('您的账号正在审核或是已经被系统禁止,请联系网站管理员解决!');
+		}
+
+		$account = pdo_fetch("SELECT * FROM " . tablename("zh_jdgjb_account") . " WHERE status=2 AND uid=:uid ORDER BY id DESC LIMIT 1", array(':uid' => $record['uid']));
+
+		if (!empty($account)) {
+			$storeid = $account['storeid'];
+			$_W['uniacid'] = $account['weid'];
+		} else {
+			message('您的账号正在审核或是已经被系统禁止,请联系网站管理员解决!!!');
+		}
+
+		$founders = explode(',', $_W['config']['setting']['founder']);
+		$_W['isfounder'] = in_array($record['uid'], $founders);
+		if (empty($_W['isfounder'])) {
+			if (!empty($record['endtime']) && $record['endtime'] < TIMESTAMP) {
+				message('您的账号有效期限已过,请联系网站管理员解决!');
+			}
+		}
+		if (!empty($_W['siteclose']) && empty($_W['isfounder'])) {
+			message('站点已关闭,关闭原因:' . $_W['setting']['copyright']['reason']);
+		}
+		$cookie = array();
+		$cookie['uid'] = $record['uid'];
+		$cookie['lastvisit'] = $record['lastvisit'];
+		$cookie['lastip'] = $record['lastip'];
+		$cookie['hash'] = md5($record['password'] . $record['salt']);
+		$session = base64_encode(json_encode($cookie));
+		isetcookie('__session', $session, !empty($_GPC['rember']) ? 7 * 86400 : 0, true);
+		$status = array();
+		$status['uid'] = $record['uid'];
+		$status['lastvisit'] = TIMESTAMP;
+		$status['lastip'] = CLIENT_IP;
+		user_update($status);
+
+		$role = uni_permission($record['uid'], $_W['uniacid']);
+		isetcookie('__uniacid', $_W['uniacid'], 7 * 86400);
+		isetcookie('__uid', $record['uid'], 7 * 86400);
+
+		if($_W['role'] == 'clerk' || $role == 'clerk') {
+//				message('登陆成功', url('activity/desk', array('uniacid' => $record['uniacid'])), 'success');
+//			message("欢迎回来!,{$record['username']}!", url('site/entry/stores', array('m' => 'wpdc', 'storeid' => $storeid, 'do' => 'start')), 'success');
+		}
+
+//		if(empty($forward)) {
+//			$forward = $_GPC['forward'];
+//		}
+//		if(empty($forward)) {
+//			$forward = './index.php?c=account&a=display';
+//		}
+//		if ($record['uid'] != $_GPC['__uid']) {
+//			isetcookie('__uniacid', '', -7 * 86400);
+//			isetcookie('__uid', '', -7 * 86400);
+//		}
+//		pdo_delete('users_failed_login', array('id' => $failed['id']));
+//		message("欢迎回来,{$record['username']}。", $forward);
+
+		$data = array(
+			'lastvisit' => TIMESTAMP,
+			'lastip' => CLIENT_IP,
+		);
+		pdo_update("zh_jdgjb_account", $data, array('id' => $record['id']));
+
+		message("欢迎回来,{$record['username']}!", url('site/entry/stores', array('m' => 'zh_jdgjb', 'id' => $storeid,'uid'=>$record['uid'], 'do' => 'dlstatistics')), 'success');
+	} else {
+		if (empty($failed)) {
+			pdo_insert('users_failed_login', array('ip' => CLIENT_IP, 'username' => $username, 'count' => '1', 'lastupdate' => TIMESTAMP));
+		} else {
+			pdo_update('users_failed_login', array('count' => $failed['count'] + 1, 'lastupdate' => TIMESTAMP), array('id' => $failed['id']));
+		}
+		message('登录失败,请检查您输入的用户名和密码!');
+	}
+}

+ 12 - 0
addons/zh_jdgjb/admin/source/user/logout.ctrl.php

xqd
@@ -0,0 +1,12 @@
+<?php
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
+ */
+defined('IN_IA') or exit('Access Denied');
+isetcookie('__session', '', -10000);
+$forward = $_GPC['forward'];
+if(empty($forward)) {
+	$forward = './?refersh';
+}
+header('Location:' . url('user/login'));

+ 7 - 0
addons/zh_jdgjb/admin/source/utility/__init.php

xqd
@@ -0,0 +1,7 @@
+<?php
+/**
+ * [WeEngine System] Copyright (c) 2014 WE7.CC
+ * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
+ */
+
+define('IN_GW', true);

+ 8 - 0
addons/zh_jdgjb/admin/themes/default/common/footer-base.html

xqd
@@ -0,0 +1,8 @@
+	<script type="text/javascript">
+		require(['bootstrap']);
+		$('.js-clip').each(function(){
+			util.clip(this, $(this).attr('data-url'));
+		});
+	</script>
+</body>
+</html>

+ 33 - 0
addons/zh_jdgjb/admin/themes/default/common/footer-cms.html

xqd
@@ -0,0 +1,33 @@
+		</div>
+		<script type="text/javascript">
+			require(['bootstrap']);
+			{if $_W['uid']}
+				function checknotice() {
+					$.post("{php echo url('utility/notice')}", {}, function(data){
+						var data = $.parseJSON(data);
+						$('#notice-container').html(data.notices);
+						$('#notice-total').html(data.total);
+						if(data.total > 0) {
+							$('#notice-total').css('background', '#ff9900');
+						} else {
+							$('#notice-total').css('background', '');
+						}
+						setTimeout(checknotice, 60000);
+					});
+				}
+				checknotice();
+			{/if}
+		</script>
+		<div class="container-fluid footer" role="footer">
+			<div class="page-header"></div>
+			<span class="pull-left">
+				<p>{if empty($_W['setting']['copyright']['footerleft'])}Powered by <a href="http://www.xxx.cc"><b>餐饮</b></a> v{IMS_VERSION} &copy; 2014-2015 <a href="http://www.xxx.cc">www.we7.cc</a>{else}{$_W['setting']['copyright']['footerleft']}{/if}{if !empty($_W['setting']['copyright']['statcode'])}{$_W['setting']['copyright']['statcode']}{/if}</p>
+			</span>
+			<span class="pull-right">
+				<p>{if empty($_W['setting']['copyright']['footerright'])}<a href="http://www.xxx.cc">关于餐饮2
+				</a>&nbsp;&nbsp;<a href="http://bbs.we7.cc">餐饮论坛</a>&nbsp;&nbsp;<a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw">联系客服</a>{else}{$_W['setting']['copyright']['footerright']}{/if}</p>
+			</span>
+		</div>
+		{if !empty($_W['setting']['copyright']['statcode'])}{$_W['setting']['copyright']['statcode']}{/if}
+	</body>
+</html>

+ 54 - 0
addons/zh_jdgjb/admin/themes/default/common/footer-gw.html

xqd
@@ -0,0 +1,54 @@
+			</div>
+		</div>
+		<script type="text/javascript">
+			require(['bootstrap']);
+			{if $_W['isfounder'] && !defined('IN_MESSAGE')}
+			function checkupgrade() {
+				require(['util'], function(util) {
+					if (util.cookie.get('checkupgrade_sys')) {
+						return;
+					}
+					$.getJSON("{url 'utility/checkupgrade/system'}", function(ret){
+						if (ret && ret.message && ret.message.upgrade == '1') {
+							$('body').prepend('<div id="upgrade-tips" class="upgrade-tips"><a href="./index.php?c=cloud&a=upgrade&">系统检测到新版本 '+ret.message.version+' ('+ ret.message.release +') ,请尽快更新!</a><span class="tips-close" style="background:#d03e14;" onclick="checkupgrade_hide();"><i class="fa fa-times-circle"></i></span></div>');
+							if ($('#upgrade-tips-module').size()) {
+								$('#upgrade-tips').css('top', '25px');
+							}
+						}
+					});
+				});
+			}
+
+			function checkupgrade_hide() {
+				require(['util'], function(util) {
+					util.cookie.set('checkupgrade_sys', 1, 3600);
+					$('#upgrade-tips').hide();
+				});
+			}
+			$(function(){
+				checkupgrade();
+			});
+			{/if}
+
+			{if $_W['uid']}
+				function checknotice() {
+					$.post("{php echo url('utility/notice')}", {}, function(data){
+						var data = $.parseJSON(data);
+						$('#notice-container').html(data.notices);
+						$('#notice-total').html(data.total);
+						if(data.total > 0) {
+							$('#notice-total').css('background', '#ff9900');
+						} else {
+							$('#notice-total').css('background', '');
+						}
+						setTimeout(checknotice, 60000);
+					});
+				}
+				checknotice();
+			{/if}
+		</script>
+	</div>
+			{if !empty($_W['setting']['copyright']['statcode'])}{$_W['setting']['copyright']['statcode']}{/if}
+
+</body>
+</html>

+ 6 - 0
addons/zh_jdgjb/admin/themes/default/common/footer.html

xqd
@@ -0,0 +1,6 @@
+			</div>
+		</div>
+	</div>
+</div>
+
+{template 'common/footer-base'}

+ 46 - 0
addons/zh_jdgjb/admin/themes/default/common/header-base.html

xqd
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="zh-cn">
+<head>
+	<meta charset="utf-8">
+	<meta http-equiv="X-UA-Compatible" content="IE=edge">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0">
+	<title>商户后台</title>
+	<meta name="keywords" content="{if empty($_W['page']['copyright']['keywords'])}{else}{$_W['page']['copyright']['keywords']}{/if}" />
+	<meta name="description" content="{if empty($_W['page']['copyright']['description'])}{else}{$_W['page']['copyright']['description']}{/if}" />
+	<link rel="shortcut icon" href="{$_W['siteroot']}{$_W['config']['upload']['attachdir']}/{if !empty($_W['setting']['copyright']['icon'])}{$_W['setting']['copyright']['icon']}{else}images/global/wechat.jpg{/if}" />
+	<link href="{$_W['siteroot']}/web/resource/css/bootstrap.min.css" rel="stylesheet">
+	<link href="{$_W['siteroot']}/web/resource/css/font-awesome.min.css" rel="stylesheet">
+	<link href="{$_W['siteroot']}/web/resource/css/common.css" rel="stylesheet">
+
+	<script type="text/javascript">
+	if(navigator.appName == 'Microsoft Internet Explorer'){
+		if(navigator.userAgent.indexOf("MSIE 5.0")>0 || navigator.userAgent.indexOf("MSIE 6.0")>0 || navigator.userAgent.indexOf("MSIE 7.0")>0) {
+			alert('您使用的 IE 浏览器版本过低, 推荐使用 Chrome 浏览器或 IE8 及以上版本浏览器.');
+		}
+	}
+	window.sysinfo = {
+		{if !empty($_W['uniacid'])}'uniacid': '{$_W['uniacid']}',{/if}
+		{if !empty($_W['acid'])}'acid': '{$_W['acid']}',{/if}
+		{if !empty($_W['openid'])}'openid': '{$_W['openid']}',{/if}
+		{if !empty($_W['uid'])}'uid': '{$_W['uid']}',{/if}
+		'siteroot': '{$_W['siteroot']}',
+		'siteurl': '{$_W['siteurl']}',
+		'attachurl': '{$_W['attachurl']}',
+		'attachurl_local': '{$_W['attachurl_local']}',
+		'attachurl_remote': '{$_W['attachurl_remote']}',
+		{if defined('MODULE_URL')}'MODULE_URL': '{MODULE_URL}',{/if}
+		'cookie' : {'pre': '{$_W['config']['cookie']['pre']}'},
+		'account' : {php echo json_encode($_W['account'])}
+	};
+	</script>
+	<script>var require = { urlArgs: 'v=20161011' };</script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/lib/jquery-1.11.1.min.js"></script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/app/util.js?v=20161011"></script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/app/common.min.js?v=20161011"></script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/require.js?v=20161011"></script>
+	<script type="text/javascript" src="{$_W['siteroot']}/web/resource/js/app/config.js?v=20161011"></script>
+
+</head>
+ <!-- <body style="background-color: #eee;background-image: url(https://15595755.kf5.com/attachments/download/4309568/0015a1d0ec49a7c0e90666d5e8f1f82/);"> -->
+ <body style="background-color: #eee;background-image: url(../addons/zh_jdgjb/template/images/seller_login_bg.jpg);"> 
+ <!-- <body style="background-color: #1ABC9C;"> -->

+ 136 - 0
addons/zh_jdgjb/admin/themes/default/common/header-cms.html

xqd
@@ -0,0 +1,136 @@
+{template 'common/header-base'}
+	{if !empty($_W['uid'])}
+		{if !empty($_W['uniacid'])}
+			<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="position:static;">
+				<div class="container-fluid">
+					<!-- <ul class="nav navbar-nav">
+						<li><a href="./?refresh"><i class="fa fa-reply-all"></i>返回系统</a></li>
+						{php global $top_nav;}
+						{loop $top_nav $nav}
+							{if !empty($_W['isfounder']) || empty($_W['setting']['permurls']['sections']) || in_array($nav['name'], $_W['setting']['permurls']['sections'])}<li{if FRAME == $nav['name']} class="active"{/if}><a href="{php echo url('home/welcome/' . $nav['name']);}"><i class="{$nav['append_title']}"></i>{$nav['title']}</a></li>{/if}
+						{/loop}
+						<li {if $action == 'emulator'}class="active"{/if}>
+							<a href="{php echo url('utility/emulator');}" target="_blank"><i class="fa fa-mobile"></i> 模拟测试</a>
+						</li>
+						{if IMS_FAMILY != 'x'}
+						<li><a href="http://bbs.we7.cc"><i class="fa fa-comment"></i>餐饮论坛</a></li>
+						<li><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw"><i class="fa fa-suitcase"></i>联系客服</a></li>
+						{/if}
+					</ul> -->
+					<ul class="nav navbar-nav navbar-right">
+						<li class="dropdown topbar-notice">
+							<a type="button" data-toggle="dropdown">
+								<i class="fa fa-bell"></i>
+								<span class="badge" id="notice-total">0</span>
+							</a>
+							<div class="dropdown-menu" aria-labelledby="dLabel">
+								<div class="topbar-notice-panel">
+									<div class="topbar-notice-arrow"></div>
+									<div class="topbar-notice-head">
+										<span>系统公告</span>
+										<a href="{php echo url('article/notice-show/list');}" class="pull-right">更多公告>></a>
+									</div>
+									<div class="topbar-notice-body">
+										<ul id="notice-container"></ul>
+									</div>
+								</div>
+							</div>
+						</li>
+						<li class="dropdown">
+							<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-group"></i>{$_W['account']['name']} <b class="caret"></b></a>
+							<ul class="dropdown-menu">
+								{if $_W['role'] != 'operator'}
+								<li><a href="{url 'account/post' array('uniacid' => $_W['uniacid'])}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 编辑当前账号资料</a></li>
+								{/if}
+								<li><a href="{url 'account/display'}" target="_blank"><i class="fa fa-cogs fa-fw"></i> 管理其它公众号</a></li>
+								<li><a href="{url 'utility/emulator'}" target="_blank"><i class="fa fa-mobile fa-fw"></i> 模拟测试</a></li>
+							</ul>
+						</li>
+						<li class="dropdown">
+							<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:185px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-user"></i>{$_W['user']['username']} ({if $_W['role'] == 'founder'}系统管理员{elseif $_W['role'] == 'manager'}公众号管理员{else}公众号操作员{/if}) <b class="caret"></b></a>
+							<ul class="dropdown-menu">
+								<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 我的账号</a></li>
+								{if $_W['role'] == 'founder'}
+								<li class="divider"></li>
+								<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-sitemap fa-fw"></i> 系统选项</a></li>
+								<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-cloud-download fa-fw"></i> 自动更新</a></li>
+								<li><a href="{url 'system/updatecache'}" target="_blank"><i class="fa fa-refresh fa-fw"></i> 更新缓存</a></li>
+								<li class="divider"></li>
+								{/if}
+								<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+							</ul>
+						</li>
+					</ul>
+				</div>
+			</div>
+		{else}
+			<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="z-index:1001;">
+				<div class="container-fluid">
+					<!-- <ul class="nav navbar-nav">
+						<li class="active"><a href="./?refresh"><i class="fa fa-cogs"></i>系统管理</a></li>
+						<li><a href="{url 'account/display'}" target="_blank"><i class="fa fa-share"></i>管理公众号</a></li>
+						{if IMS_FAMILY != 'x'}
+						<li><a href="http://bbs.we7.cc"><i class="fa fa-comment"></i>餐饮论坛</a></li>
+						<li><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw"><i class="fa fa-suitcase"></i>联系客服</a></li>
+						{/if}
+					</ul> -->
+					<ul class="nav navbar-nav navbar-right">
+						<li class="dropdown">
+							<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:185px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-user"></i>{$_W['user']['username']} ({if $_W['role'] == 'founder'}系统管理员{elseif $_W['role'] == 'manager'}公众号管理员{else}公众号操作员{/if}) <b class="caret"></b></a>
+							<ul class="dropdown-menu">
+								<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 我的账号</a></li>
+								{if $_W['role'] != 'operator'}
+								<li class="divider"></li>
+								<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-sitemap fa-fw"></i> 系统选项</a></li>
+								<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-cloud-download fa-fw"></i> 自动更新</a></li>
+								<li><a href="{url 'system/updatecache'}" target="_blank"><i class="fa fa-refresh fa-fw"></i> 更新缓存</a></li>
+								<li class="divider"></li>
+								{/if}
+								<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+							</ul>
+						</li>
+					</ul>
+				</div>
+			</div>
+		{/if}
+	{else}
+		<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="z-index:1001;">
+			<div class="container-fluid container">
+				<ul class="nav navbar-nav navbar-right">
+					<li class="active"><a href="{php echo url('user/register');}"><i class="fa fa-user"></i>注册</a></li>
+					<li><a href="{php echo url('user/login');}"><i class="fa fa-user-plus"></i>登陆</a></li>
+				</ul>
+			</div>
+		</div>
+	{/if}
+
+	<div class="container-fluid">
+		{if defined('IN_MESSAGE')}
+			<div class="jumbotron clearfix alert alert-{$label}">
+				<div class="row">
+					<div class="col-xs-12 col-sm-4 col-md-3 col-lg-2">
+						<i class="fa fa-5x fa-{if $label=='success'}check-circle{/if}{if $label=='danger'}times-circle{/if}{if $label=='info'}info-circle{/if}{if $label=='warning'}exclamation-triangle{/if}"></i>
+					</div>
+					<div class="col-xs-12 col-sm-8 col-md-9 col-lg-10">
+						{if is_array($msg)}
+							<h2>MYSQL 错误:</h2>
+							<p>{php echo cutstr($msg['sql'], 300, 1);}</p>
+							<p><b>{$msg['error'][0]} {$msg['error'][1]}:</b>{$msg['error'][2]}</p>
+						{else}
+						<h2>{$caption}</h2>
+						<p>{$msg}</p>
+						{/if}
+						{if $redirect}
+						<p><a href="{$redirect}" class="alert-link">如果你的浏览器没有自动跳转,请点击此链接</a></p>
+						<script type="text/javascript">
+							setTimeout(function () {
+								 location.href = "{$redirect}";
+							}, 3000);
+						</script>
+						{else}
+							<p>[<a href="javascript:history.go(-1);" class="alert-link">点击这里返回上一页</a>] &nbsp; [<a href="./?refresh" class="alert-link">首页</a>]</p>
+						{/if}
+					</div>
+				</div>
+			</div>
+		{/if}

+ 147 - 0
addons/zh_jdgjb/admin/themes/default/common/header-gw.html

xqd
@@ -0,0 +1,147 @@
+{template 'common/header-base'}
+<style type="text/css">
+	.xiaoren{width: 67px;height: 97px;position: fixed;right: 20%;bottom: 10%;z-index: 10;}
+	.xiaoren>img{width: 67px;height: 97px;}
+	.ygcheck{
+		margin-top: 15px;
+		display: inline-block;
+		width:100px;
+		height: 100px;
+	}
+	.jumbotron{background-color: rgba(0,0,0,0);border:none;}
+	.alert-success .alert-link,.alert-success{color: white;}
+</style>
+<div class="gw-container">
+	<!-- {if !empty($_W['uniacid']) && !defined('IN_MESSAGE')}
+	<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="z-index:1001; margin-bottom:0;">
+		<div class="container-fluid">
+			<ul class="nav navbar-nav">
+				<li class="active"><a href="./?refresh"><i class="fa fa-cogs"></i>系统管理</a></li>
+				<li><a href="{url 'home/welcome/platform'}" target="_blank"><i class="fa fa-share"></i>继续管理公众号({$_W['account']['name']})</a></li>
+				{if IMS_FAMILY != 'x'}
+				<li><a href="http://bbs.we7.cc"><i class="fa fa-comment"></i>餐饮论坛</a></li>
+				<li><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw"><i class="fa fa-suitcase"></i>联系客服</a></li>
+				{/if}
+			</ul>
+			<ul class="nav navbar-nav navbar-right">
+				<li class="dropdown topbar-notice">
+					<a type="button" data-toggle="dropdown">
+						<i class="fa fa-bell"></i>
+						<span class="badge" id="notice-total">0</span>
+					</a>
+					<div class="dropdown-menu" aria-labelledby="dLabel">
+						<div class="topbar-notice-panel">
+							<div class="topbar-notice-arrow"></div>
+							<div class="topbar-notice-head">
+								<span>系统公告</span>
+								<a href="{php echo url('article/notice-show/list');}" class="pull-right">更多公告>></a>
+							</div>
+							<div class="topbar-notice-body">
+								<ul id="notice-container"></ul>
+							</div>
+						</div>
+					</div>
+				</li>
+				<li class="dropdown">
+					<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown"  style="display:block; max-width:150px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-group"></i>{$_W['account']['name']} <b class="caret"></b></a>
+					<ul class="dropdown-menu">
+						{if $_W['role'] != 'operator'}
+						<li><a href="{url 'account/post' array('uniacid' => $_W['uniacid'])}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 编辑当前账号资料</a></li>
+						{/if}
+						<li><a href="{url 'account/display'}" target="_blank"><i class="fa fa-cogs fa-fw"></i> 管理其它公众号</a></li>
+						<li><a href="{url 'utility/emulator'}" target="_blank"><i class="fa fa-mobile fa-fw"></i> 模拟测试</a></li>
+					</ul>
+				</li>
+				<li class="dropdown">
+					<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:185px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-user"></i>{$_W['user']['username']} ({if $_W['role'] == 'founder'}系统管理员{elseif $_W['role'] == 'manager'}公众号管理员{else}公众号操作员{/if}) <b class="caret"></b></a>
+					<ul class="dropdown-menu">
+						<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 我的账号</a></li>
+						{if $_W['role'] == 'founder'}
+						<li class="divider"></li>
+						<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-sitemap fa-fw"></i> 系统选项</a></li>
+						<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-cloud-download fa-fw"></i> 自动更新</a></li>
+						<li><a href="{url 'system/updatecache'}" target="_blank"><i class="fa fa-refresh fa-fw"></i> 更新缓存</a></li>
+						<li class="divider"></li>
+						{/if}
+						<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+					</ul>
+				</li>
+			</ul>
+		</div>
+	</div>
+	{/if}
+	 -->
+	<div class="navbar navbar-static-top" role="navigation" style="padding-top:20px;">
+		<div class="container-fluid">
+			<!-- <a class="navbar-brand" href="./?refresh" {if !empty($_W['setting']['copyright']['blogo'])}style="background:url('{php echo tomedia($_W['setting']['copyright']['blogo']);}') no-repeat;"{/if}></a>
+			<ul class="nav navbar-nav pull-right" style="padding-top:10px;">
+				<a href="{url 'account/display'}" class="tile img-rounded{if $controller == 'account'} active{/if}">
+					<i class="fa fa-comments"></i>
+					<span>公众号管理</span>
+				</a>
+				<a href="{url 'system/welcome'}" class="tile img-rounded{if $system_activie == 1} active{/if}">
+					<i class="fa fa-sitemap"></i>
+					<span>系统</span>
+				</a>
+				{if $_W['isfounder'] == '1'}
+				{if $flow_master_info['status'] == 4 || IMS_FAMILY == 'v'}
+				<a href="{url 'system/content_provider/account_list'}" class="tile img-rounded{if $system_activie == 2} active{/if}">
+				{else}
+				<a href="{url 'system/content_provider/display'}" class="tile img-rounded{if $system_activie == 2} active{/if}">
+				{/if}
+					<i class="fa fa-sitemap"></i>
+					<span>广告联盟</span>
+				</a>
+				{/if}
+				{if $_W['uid']}
+				<a href="{url 'user/logout'}" class="tile img-rounded">
+					<i class="fa fa-sign-out"></i>
+					<span>退出</span>
+				</a>
+				{/if}
+			</ul> -->
+		</div>
+	</div>
+	
+	<div class="container-fluid">
+		{if defined('IN_MESSAGE')}
+		<div>
+		<!-- wi text-success wi-right-sign -->
+			<div class="jumbotron clearfix alert alert-{$label}">
+				<div class="row">
+					<div class="col-md-2 col-md-push-3">
+						<!-- <i class="ygcheck fa fa-5x fa-{if $label=='success'}check-circle{/if}{if $label=='danger'}times-circle{/if}{if $label=='info'}info-circle{/if}{if $label=='warning'}exclamation-triangle{/if}"></i> -->
+						<img src="../addons/zh_jdgjb/template/images/duigoubai.png" class="ygcheck"/>
+					</div>
+					<div class="col-md-5 col-md-push-2">
+						{if is_array($msg)}
+							<h2>MYSQL 错误:</h2>
+							<p>{php echo cutstr($msg['sql'], 300, 1);}</p>
+							<p><b>{$msg['error'][0]} {$msg['error'][1]}:</b>{$msg['error'][2]}</p>
+						{else}
+						<h2>{$caption}</h2>
+						<p>{$msg}</p>
+						{/if}
+						{if $redirect}
+						<p><a href="{$redirect}" class="alert-link">如果你的浏览器没有自动跳转,请点击此链接</a></p>
+						<div class="xiaoren"><img src="../addons/zh_jdgjb/template/images/stick.gif"></div>
+						<script type="text/javascript">
+							setTimeout(function () {
+								location.href = "{$redirect}";
+							}, 3000);
+						</script>
+						{else}
+							<p>[<a href="javascript:history.go(-1);" class="alert-link">点击这里返回上一页</a>] &nbsp; [<a href="./?refresh" class="alert-link">首页</a>]</p>
+							<div class="xiaoren"><img src="../addons/zh_jdgjb/template/images/stick.gif"></div>
+						{/if}
+					</div>
+				</div>
+			</div>
+		{else}
+		<div class="well">
+		{/if}
+<script>
+	var h = document.documentElement.clientHeight;
+	$(".gw-container").css('min-height',h);
+	{php echo site_profile_perfect_tips();}
+</script>

+ 219 - 0
addons/zh_jdgjb/admin/themes/default/common/header.html

xqd
@@ -0,0 +1,219 @@
+{template 'common/header-base'}
+<style>
+.navbar-inverse{background-color: rgba(0,0,0,0);border:none;}
+</style>
+	{if $_W['role'] != 'clerk'}
+	<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="position:static;">
+		<div class="container-fluid">
+			 <ul class="nav navbar-nav">
+							<!-- <li><a href="./?refresh"><i class="fa fa-reply-all"></i>返回系统</a></li> -->
+						<!-- 	{php global $top_nav;}
+						{loop $top_nav $nav}
+							{if !empty($_W['isfounder']) || empty($_W['setting']['permurls']['sections']) || in_array($nav['name'], $_W['setting']['permurls']['sections'])}<li{if FRAME == $nav['name']} class="active"{/if}><a href="{php echo url('home/welcome/' . $nav['name']);}"><i class="{$nav['append_title']}"></i>{$nav['title']}</a></li>{/if}
+						{/loop}
+						<li {if $action == 'emulator'}class="active"{/if}>
+							<a href="{php echo url('utility/emulator');}" target="_blank"><i class="fa fa-mobile"></i> 模拟测试</a>
+						</li> -->
+						</ul>  
+			<ul class="nav navbar-nav navbar-right">
+				<!-- <li class="dropdown topbar-notice">
+					<a type="button" data-toggle="dropdown">
+						<i class="fa fa-bell"></i>
+						<span class="badge" id="notice-total">0</span>
+					</a>
+					<div class="dropdown-menu" aria-labelledby="dLabel">
+						<div class="topbar-notice-panel">
+							<div class="topbar-notice-arrow"></div>
+							 <div class="topbar-notice-head">
+								<span>系统公告</span>
+								<a href="{php echo url('article/notice-show/list');}" class="pull-right">更多公告>></a>
+							</div>
+							<div class="topbar-notice-body">
+								<ul id="notice-container"></ul>
+							</div> 
+						</div>
+					</div>
+				</li> -->
+				<!-- <li class="dropdown">
+					<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-group"></i>{$_W['account']['name']} <b class="caret"></b></a>
+				 <ul class="dropdown-menu">
+						{if $_W['role'] != 'operator'}
+						<li><a href="{url 'account/post' array('uniacid' => $_W['uniacid'])}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 编辑当前账号资料</a></li>
+						{/if}
+						<li><a href="{url 'account/display'}" target="_blank"><i class="fa fa-cogs fa-fw"></i> 管理其它公众号</a></li>
+						<li><a href="{url 'utility/emulator'}" target="_blank"><i class="fa fa-mobile fa-fw"></i> 模拟测试</a></li>
+					</ul> 
+				</li> -->
+				<!-- <li class="dropdown">
+				<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" style="display:block; max-width:185px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; "><i class="fa fa-user"></i>{$_W['user']['username']} ({if $_W['role'] == 'founder'}系统管理员{elseif $_W['role'] == 'manager'}公众号管理员{else}公众号操作员{/if}) <b class="caret"></b></a>
+				<ul class="dropdown-menu">
+					<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 我的账号</a></li>
+					{if $_W['role'] == 'founder'}
+					<li class="divider"></li>
+					<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-sitemap fa-fw"></i> 系统选项</a></li>
+					<li><a href="{url 'system/welcome'}" target="_blank"><i class="fa fa-cloud-download fa-fw"></i> 自动更新</a></li>
+					<li><a href="{url 'system/updatecache'}" target="_blank"><i class="fa fa-refresh fa-fw"></i> 更新缓存</a></li>
+					<li class="divider"></li>
+					{/if}
+					<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+				</ul>
+							</li>  -->
+			</ul>
+		</div>
+	</div>
+	{if empty($_COOKIE['check_setmeal']) && !empty($_W['account']['endtime']) && ($_W['account']['endtime'] - TIMESTAMP < (6*86400))}
+		<div class="upgrade-tips" id="setmeal-tips">
+			<a href="{php echo url('user/edit', array('uid' => $_W['account']['uid']));}" target="_blank">
+				您的服务有效期限:{php echo date('Y-m-d', $_W['account']['starttime']);} ~ {php echo date('Y-m-d', $_W['account']['endtime']);}.
+				{if $_W['account']['endtime'] < TIMESTAMP}
+				目前已到期,请联系管理员续费
+				{else}
+				将在{php echo floor(($_W['account']['endtime'] - strtotime(date('Y-m-d')))/86400);}天后到期,请及时付费
+				{/if}
+			</a><span class="tips-close" style="background:#d03e14;" onclick="check_setmeal_hide();"><i class="fa fa-times-circle"></i></span>
+		</div>
+		<script>
+			function check_setmeal_hide() {
+				util.cookie.set('check_setmeal', 1, 1800);
+				$('#setmeal-tips').hide();
+				return false;
+			}
+		</script>
+	{/if}
+	{else}
+		<div class="navbar navbar-inverse navbar-static-top" role="navigation" style="position:static;">
+			<div class="container-fluid">
+				<ul class="nav navbar-nav">
+					<li><a href="{url 'activity/desk/index'}"><i class="fa fa-desktop"></i> 工作台首页</a></li>
+					<li><a href="javascript:;" class="login-qrcode"><i class="fa fa-qrcode"></i> 手机登录</a></li>
+					{if IMS_FAMILY != 'x'}
+						<li><a href="http://bbs.we7.cc"><i class="fa fa-comment"></i>餐饮论坛</a></li>
+						<li><a href="http://wpa.b.qq.com/cgi/wpa.php?ln=1&key=XzkzODAwMzEzOV8xNzEwOTZfNDAwMDgyODUwMl8yXw"><i class="fa fa-suitcase"></i>联系客服</a></li>
+					{/if}
+				</ul>
+				<ul class="nav navbar-nav navbar-right">
+					<li><a href="javascript:;"><i class="fa fa-user"></i> {$_W['user']['name']} - {$_W['user']['store_name']}</a></li>
+					<li><a href="{url 'user/profile/profile'}" target="_blank"><i class="fa fa-weixin fa-fw"></i> 账号信息</a></li>
+					<li><a href="{url 'user/logout'}"><i class="fa fa-sign-out fa-fw"></i> 退出系统</a></li>
+				</ul>
+			</div>
+		</div>
+	{/if}
+	<div class="container-fluid">
+		{if defined('IN_MESSAGE')}
+		<div class="jumbotron clearfix alert alert-{$label}">
+			<div class="row">
+				<div class="col-xs-12 col-sm-3 col-lg-2">
+					<i class="fa fa-5x fa-{if $label=='success'}check-circle{/if}{if $label=='danger'}times-circle{/if}{if $label=='info'}info-circle{/if}{if $label=='warning'}exclamation-triangle{/if}"></i>
+				</div>
+				<div class="col-xs-12 col-sm-8 col-md-9 col-lg-10">
+					{if is_array($msg)}
+						<h2>MYSQL 错误:</h2>
+						<p>{php echo cutstr($msg['sql'], 300, 1);}</p>
+						<p><b>{$msg['error'][0]} {$msg['error'][1]}:</b>{$msg['error'][2]}</p>
+					{else}
+					<h2>{$caption}</h2>
+					<p>{$msg}</p>
+					{/if}
+					{if $redirect}
+					
+					<p><a href="{$redirect}">如果你的浏览器没有自动跳转,请点击此链接</a></p>
+					<script type="text/javascript">
+						setTimeout(function () {
+						/*	location.href = "{$redirect}";*/
+						}, 3000);
+					</script>
+					{else}
+						<p>[<a href="javascript:history.go(-1);">点击这里返回上一页</a>] &nbsp; <!-- [<a href="./?refresh">首页</a>] --></p>
+					{/if}
+				</div>
+		{else}
+		<div class="row">
+			{php $frames = empty($frames) ? $GLOBALS['frames'] : $frames; _calc_current_frames($frames);}
+			{if !empty($frames)}
+				<div class="col-xs-12 col-sm-3 col-lg-2 big-menu">
+					<div id="search-menu">
+						<input class="form-control input-lg" style="border-radius:0; font-size:14px; height:43px;" type="text" placeholder="输入菜单名称可快速查找">
+					</div>
+					{if $GLOBALS['ext_type'] > 0}
+						<div class="btn-group">
+							<button class="btn {if $GLOBALS['ext_type'] == 1}btn-primary{else}btn-default{/if} ext-type" data-id="1">默认</button>
+							<button class="btn {if $GLOBALS['ext_type'] == 2}btn-primary{else}btn-default{/if} ext-type" data-id="2">系统</button>
+							<button class="btn {if $GLOBALS['ext_type'] == 3}btn-primary{else}btn-default{/if} ext-type" data-id="3">复合</button>
+						</div>
+					{/if}
+					{loop $frames $k $frame}
+					<div class="panel panel-default">
+						<div class="panel-heading">
+							<h4 class="panel-title">{$frame['title']}</h4>
+							<a class="panel-collapse collapsed" data-toggle="collapse" href="#frame-{$k}">
+								<i class="fa fa-chevron-circle-down"></i>
+							</a>
+						</div>
+						<ul class="list-group collapse in" id="frame-{$k}">
+							{loop $frame['items'] $link}
+							{if empty($link['is_permission'])}
+								{if !empty($link['append'])}
+								<li class="list-group-item{$link['active']}" onclick="window.location.href = '{$link['url']}';" style="cursor:pointer; overflow:hidden;" kw="{$link['title']}">
+									<a class="pull-right" href="{$link['append']['url']}">{$link['append']['title']}</a>
+									{$link['title']}
+								</li>
+								{else}
+								<a class="list-group-item{$link['active']}" href="{$link['url']}" kw="{$link['title']}">{$link['title']}</a>
+								{/if}
+							{/if}
+							{/loop}
+						</ul>
+					</div>
+					{/loop}
+					<script type="text/javascript">
+						require(['bootstrap'], function(){
+							$('.ext-type').click(function(){
+								var id = $(this).data('id');
+								util.cookie.del('ext_type');
+								util.cookie.set('ext_type', id, 8640000);
+								location.reload();
+								return false;
+							});
+
+							$('#search-menu input').keyup(function() {
+								var a = $(this).val();
+								$('.big-menu .list-group-item, .big-menu .panel-heading').hide();
+								$('.big-menu .list-group-item').each(function() {
+									$(this).css('border-left', '0');
+									if(a.length > 0 && $(this).attr('kw').indexOf(a) >= 0) {
+										$(this).parents(".panel").find('.panel-heading').show();
+										$(this).show().css('border-left', '3px #428bca double');
+									}
+								});
+								if(a.length == 0) {
+									$('.big-menu .list-group-item, .big-menu .panel-heading').show();
+								}
+							});
+						});
+					</script>
+				</div>
+				<div class="col-xs-12 col-sm-9 col-lg-10">
+					{if CRUMBS_NAV == 1}
+						{php global $module_types;global $module;global $ptr_title;}
+						<ol class="breadcrumb" style="padding:5px 0;">
+							<li><a href="{url 'home/welcome/ext'}"><i class="fa fa-cogs"></i> &nbsp; 扩展功能</a></li>
+							<li><a href="{url 'home/welcome/ext' array('m' => $module['name'])}">{$module_types[$module['type']]['title']}模块 - {$module['title']}</a></li>
+							<li class="active">{$ptr_title}</li>
+						</ol>
+					{elseif CRUMBS_NAV == 2}
+						{php global $module_types;global $module;global $ptr_title; global $site_urls; $m = $_GPC['m'];}
+						<ul class="nav nav-tabs">
+							<li><a href="{url 'platform/reply' array('m' => $m)}">管理{$module['title']}</a></li>
+							<li><a href="{url 'platform/reply/post' array('m' => $m)}"><i class="fa fa-plus"></i> 添加{$module['title']}</a></li>
+							{if !empty($site_urls)}
+								{loop $site_urls $site_url}
+									<li {if $_GPC['do'] == $site_url['do']} class="active"{/if}><a href="{$site_url['url']}"> {$site_url['title']}</a></li>
+								{/loop}
+							{/if}
+						</ul>
+					{/if}
+			{else}
+				<div class="col-xs-12 col-sm-12 col-lg-12">
+			{/if}
+		{/if}

+ 8 - 0
addons/zh_jdgjb/admin/themes/default/common/message.html

xqd
@@ -0,0 +1,8 @@
+{php define('IN_MESSAGE', true)}
+{if defined('IN_GW')}
+{template 'common/header-gw'}
+{template 'common/footer-gw'}
+{else}
+{template 'common/header'}
+{template 'common/footer'}
+{/if}

+ 181 - 0
addons/zh_jdgjb/admin/themes/default/user/login.html

xqd
@@ -0,0 +1,181 @@
+{template 'common/header-base'}
+<style>
+	@media screen and (max-width:767px){.login_wrap .panel.panel-default{width:90%; min-width:300px;}}
+	@media screen and (min-width:768px){.login_wrap .panel.panel-default{width:70%;}}
+	@media screen and (min-width:1200px){.login_wrap .panel.panel-default{width:50%;}}
+	body {
+		/*padding-top: 120px;
+		padding-bottom: 40px;*/
+		background-color: #27282d;
+	}
+
+/*———————————————第一个卡通样式———————————————*/
+.login_wrap{
+	width: 518px;
+	margin-left: 350px;
+}	
+.sellback{
+	width: 900px;
+	height: 440px;
+	background-color: white;
+	margin: 250px auto 0px;
+	background:url(../addons/zh_jdgjb/template/images/container_bg0.png) no-repeat;
+}
+.warp_content{ width:270px; margin:0 auto; padding-top:20px;}
+.warp_content .title{ margin-top:38px; padding-left:40px;}
+.warp_content .title h3{ font-size:30px; color:#7f6f67; line-height:32px;}
+.warp_content .title span{
+	background:url(../addons/zh_jdgjb/template/images/txt.png) 0 2px no-repeat;
+	height:12px;
+	display:block;
+	margin-top:5px;
+}
+.formInfo{ margin-top:20px; overflow:hidden;}
+.formInfo .formText{ margin-bottom:12px; position:relative; z-index:2;}
+.formInfo .formText .input-text{
+	border:0; height:40px;
+	padding:6px 28px 6px 42px;
+	width:270px;
+	border-radius:20px;
+	background-color: #f4f4f4;
+}
+.formInfo .formText input:focus{ outline:none;box-shadow:none;}
+.formInfo .formText .checked{ background-position:-109px -12px;}
+.formInfo .formText .login-icon{
+	background: url(../addons/zh_jdgjb/template/images/login_icon.png) no-repeat;
+	position: absolute;
+	top: 13px;
+	left: 17px;
+	width: 14px;
+	height: 13px;
+	z-index: 9;
+}
+.formInfo .formText .login-icon-user{ background-position:-5px -8px;}
+.formInfo .formText .login-icon-pwd{ background-position:-3px -38px;}
+.formInfo .focus .login-icon-user{ background-position:-33px -8px;}
+.formInfo .focus .login-icon-pwd{ background-position:-31px -38px;}
+.formInfo .submitDiv{ font-size:0; padding-top:20px;}
+.formInfo .submitDiv .input-yzm{ border:0; height:28px; padding:6px 5px 6px 20px; background:#f4f4f4; border-radius:50px 0 0 50px; width:110px;}
+.formInfo .submitDiv .sub{ width: 135px;height: 40px;border: 0;background: #ff7c3a;color: #FFF;border-radius: 0 50px 50px 0;padding: 0;font-size: 16px;cursor: pointer;font-family: "Microsoft YaHei";}
+.formInfo .submitDiv .qp_sub{ width:100%; border-radius:50px;}
+
+/*———————————————第二个样式—————————————————*/
+.msection{
+	width: 100%;
+	height: 557px;
+	background-color: white;
+	margin-top: 165px;
+	background:url(../addons/zh_jdgjb/template/images/u11_state0.png) no-repeat;
+	background-size: 2000px 360px;
+}
+.msecbox{width: 420px;margin: 0px auto;}
+.msecheader{width: 420px;height: 147px;text-align: center;margin-bottom: 20px;}
+.msecheader>img{width: 135px;height: 147px;}
+.mscontent{background-color: white;border-radius: 10px;margin: 0px auto;padding: 1px;width: 420px;height: 400px;}
+.msfutitle,.mstitle{text-align: center;font-family: "微软雅黑";color: #1ABC9C;margin-bottom: 0px;}
+.mstitle{font-size: 28px;margin-top: 35px;font-weight: bold;}
+.msfutitle{font-size: 20px;}
+.msbanner{border:1px solid #C0C0C0;padding: 5px;width: 300px;margin: 35px auto 20px;}
+.msbanner2>span,.msbanner>span{color: #CCCCCC;font-size: 26px;margin-left: 10px;}
+.msbanner2>input,.msbanner>input{width: 215px;height: 40px;margin-left: 10px;outline: none;border:none;}
+.msbanner2{border:1px solid #C0C0C0;padding: 5px;width: 300px;margin: 20px auto;}
+.msbanner3{margin: 0px auto;width: 300px;height: 50px;}
+.msbanner3>input{background-color: #1ABC9C;width: 300px;height: 50px;border:none;border-radius: 4px;color: white;font-size: 18px;}
+:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
+	color: #CCCCCC;
+}
+
+::-moz-placeholder { /* Mozilla Firefox 19+ */
+	color: #CCCCCC;
+}
+
+input:-ms-input-placeholder{
+	color: #CCCCCC;
+}
+
+input::-webkit-input-placeholder{
+	color: #CCCCCC;
+}
+.footer{
+        background:none !important;
+        color:#666;
+        position: fixed;
+        bottom: 0;
+        /*z-index: -100;*/
+        opacity: 1;
+        width: 100%;
+    }
+</style>
+
+<!-- —————————————第二套——————————— -->
+<div class="sellback">
+	<div class="login_wrap">
+		<div class="warp_content">
+            <div class="title">
+                <h3>商家管理中心</h3>
+                <span class="txt"></span>
+            </div>
+            <form action="" method="post" role="form" id="form1" onsubmit="return formcheck();">
+                <div class="formInfo">
+                    <div class="formText">
+                        <i class="login-icon login-icon-user"></i>
+                        <input type="text" name="username" autocomplete="off" class="input-text" value="" placeholder="用户名">
+                    </div>
+                    <div class="formText">
+                        <i class="login-icon login-icon-pwd"></i>
+                        <input type="password"   style="display:none"/>
+                        <input type="password" name="password" autocomplete="off" class="input-text" value="" placeholder="密  码">
+                    </div>
+                    <div class="formText submitDiv">
+                        <span class="submit_span">
+                        	<input type="submit" id="submit" name="submit" value="登录" class="sub qp_sub" value="登 录" />
+                        </span>
+                        <input name="token" value="{$_W['token']}" type="hidden" />
+                    </div>
+                </div>
+            </form>
+        </div>
+
+	</div>
+</div>
+<script>
+	function formcheck() {
+		if($('#remember:checked').length == 1) {
+			cookie.set('remember-username', $(':text[name="username"]').val());
+		} else {
+			cookie.del('remember-username');
+		}
+		return true;
+	}
+	$('#toggle').click(function() {
+		$('#imgverify').prop('src', '{php echo $_W['siteroot'].url("utility/code")}r='+Math.round(new Date().getTime()));
+		return false;
+	});
+
+</script>
+</body>
+</html>
+
+	<div class="container-fluid footer text-center" role="footer">	
+		<div class="friend-link">
+			{if empty($_W['setting']['copyright']['footerright'])}
+				<a href="http://www.we7.cc">微信开发</a>
+				<a href="http://s.we7.cc">微信应用</a>
+				<a href="http://bbs.we7.cc">微擎论坛</a>
+				<a href="http://s.we7.cc">联系客服</a>
+			{else}
+				{$_W['setting']['copyright']['footerright']}
+			{/if}
+		</div>
+		<div class="copyright">{if empty($_W['setting']['copyright']['footerleft'])}Powered by <a href="http://www.we7.cc"><b>微擎</b></a> v{IMS_VERSION} &copy; 2014-2015 <a href="http://www.we7.cc">www.we7.cc</a>{else}{$_W['setting']['copyright']['footerleft']}{/if}</div>
+		{if !empty($_W['setting']['copyright']['icp'])}<div>备案号:<a href="http://www.miitbeian.gov.cn" target="_blank">{$_W['setting']['copyright']['icp']}</a></div>{/if}
+	</div>
+	{if !empty($_W['setting']['copyright']['statcode'])}{$_W['setting']['copyright']['statcode']}{/if}
+	{if !empty($_GPC['m']) && !in_array($_GPC['m'], array('keyword', 'special', 'welcome', 'default', 'userapi')) || defined('IN_MODULE')}
+	<script>
+		if(typeof $.fn.tooltip != 'function' || typeof $.fn.tab != 'function' || typeof $.fn.modal != 'function' || typeof $.fn.dropdown != 'function') {
+			require(['bootstrap']);
+		}
+	</script>
+	{/if}
+

+ 25 - 0
addons/zh_jdgjb/baiduSdk/AipContentCensor.php

xqd
@@ -0,0 +1,25 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'AipImageCensor.php';
+
+/**
+ * 内容审核
+ */
+class AipContentCensor extends AipImageCensor{
+
+}

+ 530 - 0
addons/zh_jdgjb/baiduSdk/AipFace.php

xqd
@@ -0,0 +1,530 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+class AipFace extends AipBase {
+
+    /**
+     * 人脸检测 detect api url
+     * @var string
+     */
+    private $detectUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/detect';
+
+    /**
+     * 人脸搜索 search api url
+     * @var string
+     */
+    private $searchUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/search';
+
+    /**
+     * 人脸注册 user_add api url
+     * @var string
+     */
+    private $userAddUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/add';
+
+    /**
+     * 人脸更新 user_update api url
+     * @var string
+     */
+    private $userUpdateUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/update';
+
+    /**
+     * 人脸删除 face_delete api url
+     * @var string
+     */
+    private $faceDeleteUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/face/delete';
+
+    /**
+     * 用户信息查询 user_get api url
+     * @var string
+     */
+    private $userGetUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/get';
+
+    /**
+     * 获取用户人脸列表 face_getlist api url
+     * @var string
+     */
+    private $faceGetlistUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/face/getlist';
+
+    /**
+     * 获取用户列表 group_getusers api url
+     * @var string
+     */
+    private $groupGetusersUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/group/getusers';
+
+    /**
+     * 复制用户 user_copy api url
+     * @var string
+     */
+    private $userCopyUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/copy';
+
+    /**
+     * 删除用户 user_delete api url
+     * @var string
+     */
+    private $userDeleteUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/user/delete';
+
+    /**
+     * 创建用户组 group_add api url
+     * @var string
+     */
+    private $groupAddUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/group/add';
+
+    /**
+     * 删除用户组 group_delete api url
+     * @var string
+     */
+    private $groupDeleteUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/group/delete';
+
+    /**
+     * 组列表查询 group_getlist api url
+     * @var string
+     */
+    private $groupGetlistUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceset/group/getlist';
+
+    /**
+     * 身份验证 person_verify api url
+     * @var string
+     */
+    private $personVerifyUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/person/verify';
+
+    /**
+     * 语音校验码接口 video_sessioncode api url
+     * @var string
+     */
+    private $videoSessioncodeUrl = 'https://aip.baidubce.com/rest/2.0/face/v1/faceliveness/sessioncode';
+
+    /**
+     * 视频活体检测接口 video_faceliveness api url
+     * @var string
+     */
+    private $videoFacelivenessUrl = 'https://aip.baidubce.com/rest/2.0/face/v1/faceliveness/verify';
+
+    
+
+    /**
+     * 人脸检测接口
+     *
+     * @param string $image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断
+     * @param string $imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   face_field 包括**age,beauty,expression,faceshape,gender,glasses,landmark,race,quality,facetype,parsing信息**  <br> 逗号分隔. 默认只返回face_token、人脸框、概率和旋转角度
+     *   max_face_num 最多处理人脸的数目,默认值为1,仅检测图片中面积最大的那个人脸;**最大值10**,检测图片中面积最大的几张人脸。
+     *   face_type 人脸的类型 **LIVE**表示生活照:通常为手机、相机拍摄的人像图片、或从网络获取的人像图片等**IDCARD**表示身份证芯片照:二代身份证内置芯片中的人像照片 **WATERMARK**表示带水印证件照:一般为带水印的小图,如公安网小图 **CERT**表示证件照片:如拍摄的身份证、工卡、护照、学生证等证件图片 默认**LIVE**
+     * @return array
+     */
+    public function detect($image, $imageType, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = $image;
+        $data['image_type'] = $imageType;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->detectUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 人脸搜索接口
+     *
+     * @param string $image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断
+     * @param string $imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个
+     * @param string $groupIdList - 从指定的group中进行查找 用逗号分隔,**上限20个**
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   quality_control 图片质量控制  **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE**
+     *   liveness_control 活体检测控制  **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE**
+     *   user_id 当需要对特定用户进行比对时,指定user_id进行比对。即人脸认证功能。
+     *   max_user_num 查找后返回的用户数量。返回相似度最高的几个用户,默认为1,最多返回20个。
+     * @return array
+     */
+    public function search($image, $imageType, $groupIdList, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = $image;
+        $data['image_type'] = $imageType;
+        $data['group_id_list'] = $groupIdList;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->searchUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 人脸注册接口
+     *
+     * @param string $image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断
+     * @param string $imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个
+     * @param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
+     * @param string $userId - 用户id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   user_info 用户资料,长度限制256B
+     *   quality_control 图片质量控制  **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE**
+     *   liveness_control 活体检测控制  **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE**
+     * @return array
+     */
+    public function addUser($image, $imageType, $groupId, $userId, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = $image;
+        $data['image_type'] = $imageType;
+        $data['group_id'] = $groupId;
+        $data['user_id'] = $userId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->userAddUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 人脸更新接口
+     *
+     * @param string $image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断
+     * @param string $imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个
+     * @param string $groupId - 更新指定groupid下uid对应的信息
+     * @param string $userId - 用户id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   user_info 用户资料,长度限制256B
+     *   quality_control 图片质量控制  **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE**
+     *   liveness_control 活体检测控制  **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE**
+     * @return array
+     */
+    public function updateUser($image, $imageType, $groupId, $userId, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = $image;
+        $data['image_type'] = $imageType;
+        $data['group_id'] = $groupId;
+        $data['user_id'] = $userId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->userUpdateUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 人脸删除接口
+     *
+     * @param string $userId - 用户id(由数字、字母、下划线组成),长度限制128B
+     * @param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
+     * @param string $faceToken - 需要删除的人脸图片token,(由数字、字母、下划线组成)长度限制64B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function faceDelete($userId, $groupId, $faceToken, $options=array()){
+
+        $data = array();
+        
+        $data['user_id'] = $userId;
+        $data['group_id'] = $groupId;
+        $data['face_token'] = $faceToken;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->faceDeleteUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 用户信息查询接口
+     *
+     * @param string $userId - 用户id(由数字、字母、下划线组成),长度限制128B
+     * @param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function getUser($userId, $groupId, $options=array()){
+
+        $data = array();
+        
+        $data['user_id'] = $userId;
+        $data['group_id'] = $groupId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->userGetUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 获取用户人脸列表接口
+     *
+     * @param string $userId - 用户id(由数字、字母、下划线组成),长度限制128B
+     * @param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function faceGetlist($userId, $groupId, $options=array()){
+
+        $data = array();
+        
+        $data['user_id'] = $userId;
+        $data['group_id'] = $groupId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->faceGetlistUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 获取用户列表接口
+     *
+     * @param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   start 默认值0,起始序号
+     *   length 返回数量,默认值100,最大值1000
+     * @return array
+     */
+    public function getGroupUsers($groupId, $options=array()){
+
+        $data = array();
+        
+        $data['group_id'] = $groupId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->groupGetusersUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 复制用户接口
+     *
+     * @param string $userId - 用户id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   src_group_id 从指定组里复制信息
+     *   dst_group_id 需要添加用户的组id
+     * @return array
+     */
+    public function userCopy($userId, $options=array()){
+
+        $data = array();
+        
+        $data['user_id'] = $userId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->userCopyUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 删除用户接口
+     *
+     * @param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
+     * @param string $userId - 用户id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function deleteUser($groupId, $userId, $options=array()){
+
+        $data = array();
+        
+        $data['group_id'] = $groupId;
+        $data['user_id'] = $userId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->userDeleteUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 创建用户组接口
+     *
+     * @param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function groupAdd($groupId, $options=array()){
+
+        $data = array();
+        
+        $data['group_id'] = $groupId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->groupAddUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 删除用户组接口
+     *
+     * @param string $groupId - 用户组id(由数字、字母、下划线组成),长度限制128B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function groupDelete($groupId, $options=array()){
+
+        $data = array();
+        
+        $data['group_id'] = $groupId;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->groupDeleteUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 组列表查询接口
+     *
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   start 默认值0,起始序号
+     *   length 返回数量,默认值100,最大值1000
+     * @return array
+     */
+    public function getGroupList($options=array()){
+
+        $data = array();
+        
+
+        $data = array_merge($data, $options);
+        return $this->request($this->groupGetlistUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 身份验证接口
+     *
+     * @param string $image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断
+     * @param string $imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个
+     * @param string $idCardNumber - 身份证号(真实身份证号号码)
+     * @param string $name - utf8,姓名(真实姓名,和身份证号匹配)
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   quality_control 图片质量控制  **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE**
+     *   liveness_control 活体检测控制  **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE**
+     * @return array
+     */
+    public function personVerify($image, $imageType, $idCardNumber, $name, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = $image;
+        $data['image_type'] = $imageType;
+        $data['id_card_number'] = $idCardNumber;
+        $data['name'] = $name;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->personVerifyUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 语音校验码接口接口
+     *
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   appid 百度云创建应用时的唯一标识ID
+     * @return array
+     */
+    public function videoSessioncode($options=array()){
+
+        $data = array();
+        
+
+        $data = array_merge($data, $options);
+        return $this->request($this->videoSessioncodeUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 视频活体检测接口接口
+     *
+     * @param string $sessionId - 语音校验码会话id,使用此接口的前提是已经调用了语音校验码接口
+     * @param string $videoBase64 - base64编码后的视频数据(视频限制:最佳为上传5-15s的mp4文件。视频编码方式:h264编码;音频编码格式:aac,pcm均可。)
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function videoFaceliveness($sessionId, $videoBase64, $options=array()){
+
+        $data = array();
+        
+        $data['session_id'] = $sessionId;
+        $data['video_base64'] = $videoBase64;
+
+        $data = array_merge($data, $options);
+        return $this->request($this->videoFacelivenessUrl, json_encode($data),  array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+    /**
+     * 在线活体检测 faceverify api url
+     * @var string
+     */
+    private $faceverifyUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/faceverify';
+
+    /**
+     * 在线活体检测接口
+     *
+     * @param array $images
+     * @return array
+     */
+    public function faceverify($images){
+
+        return $this->request($this->faceverifyUrl, json_encode($images), array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * 人脸比对 match api url
+     * @var string
+     */
+    private $matchUrl = 'https://aip.baidubce.com/rest/2.0/face/v3/match';
+
+    /**
+     * 人脸比对接口
+     *
+     * @param array $images
+     * @return array
+     */
+    public function match($images){
+
+        return $this->request($this->matchUrl, json_encode($images), array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+}

+ 211 - 0
addons/zh_jdgjb/baiduSdk/AipImageCensor.php

xqd
@@ -0,0 +1,211 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+
+/**
+ * 黄反识别
+ */
+class AipImageCensor extends AipBase{
+
+    /**
+     * antiporn api url
+     * @var string
+     */
+    private $antiPornUrl = 'https://aip.baidubce.com/rest/2.0/antiporn/v1/detect';
+
+    /**
+     * antiporn gif api url
+     * @var string
+     */
+    private $antiPornGifUrl = 'https://aip.baidubce.com/rest/2.0/antiporn/v1/detect_gif';
+
+    /**
+     * antiterror api url
+     * @var string
+     */
+    private $antiTerrorUrl = 'https://aip.baidubce.com/rest/2.0/antiterror/v1/detect';
+
+    /**
+     * @var string
+     */
+    private $faceAuditUrl = 'https://aip.baidubce.com/rest/2.0/solution/v1/face_audit';
+
+    /**
+     * @var string
+     */
+    private $imageCensorCombUrl = 'https://aip.baidubce.com/api/v1/solution/direct/img_censor';
+
+    /**
+     * @var string
+     */
+    private $imageCensorUserDefinedUrl = 'https://aip.baidubce.com/rest/2.0/solution/v1/img_censor/user_defined';
+
+    /**
+     * @var string
+     */
+    private $antiSpamUrl = 'https://aip.baidubce.com/rest/2.0/antispam/v2/spam';
+
+    /**
+     * @param  string $image 图像读取
+     * @return array
+     */
+    public function antiPorn($image){
+
+        $data = array();
+        $data['image'] = base64_encode($image);
+
+        return $this->request($this->antiPornUrl, $data);
+    }
+
+    /**
+     * @param  string $image 图像读取
+     * @return array
+     */
+    public function multi_antiporn($images){
+
+        $data = array();
+        foreach($images as $image){
+            $data[] = array(
+                'image' => base64_encode($image),
+            );
+        }
+
+        return $this->multi_request($this->antiPornUrl, $data);
+    }
+
+    /**
+     * @param  string $image 图像读取
+     * @return array
+     */
+    public function antiPornGif($image){
+
+        $data = array();
+        $data['image'] = base64_encode($image);
+
+        return $this->request($this->antiPornGifUrl, $data);
+    }
+
+    /**
+     * @param  string $image 图像读取
+     * @return array
+     */
+    public function antiTerror($image){
+
+        $data = array();
+        $data['image'] = base64_encode($image);
+
+        return $this->request($this->antiTerrorUrl, $data);
+    }
+
+    /**
+     * @param  string $images 图像读取
+     * @return array
+     */
+    public function faceAudit($images, $configId=''){
+
+        // 非数组则处理为数组
+        if(!is_array($images)){
+            $images = array(
+                $images,
+            );
+        }
+
+        $data = array(
+            'configId' => $configId,
+        );
+
+        $isUrl = substr(trim($images[0]), 0, 4) === 'http';
+        if(!$isUrl){
+            $arr = array();
+            
+            foreach($images as $image){
+                $arr[] = base64_encode($image);
+            }
+            $data['images'] = implode(',', $arr);
+        }else{
+            $urls = array();
+            
+            foreach($images as $url){
+                $urls[] = urlencode($url);
+            }
+            
+            $data['imgUrls'] = implode(',', $urls);
+        }
+
+        return $this->request($this->faceAuditUrl, $data);
+    }
+
+    /**
+     * @param  string $image 图像读取
+     * @return array
+     */
+    public function imageCensorComb($image, $scenes='antiporn', $options=array()){
+
+        $scenes = !is_array($scenes) ? explode(',', $scenes) : $scenes;
+        
+        $data = array(
+            'scenes' => $scenes,
+        );
+
+        $isUrl = substr(trim($image), 0, 4) === 'http';
+        if(!$isUrl){
+            $data['image'] = base64_encode($image);
+        }else{
+            $data['imgUrl'] = $image;
+        }
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->imageCensorCombUrl, json_encode($data), array(
+            'Content-Type' => 'application/json',
+        ));
+    }
+
+    /**
+     * @param  string $image 图像
+     * @return array
+     */
+    public function imageCensorUserDefined($image){
+        
+        $data = array();
+
+        $isUrl = substr(trim($image), 0, 4) === 'http';
+        if(!$isUrl){
+            $data['image'] = base64_encode($image);
+        }else{
+            $data['imgUrl'] = $image;
+        }
+
+        return $this->request($this->imageCensorUserDefinedUrl, $data);     
+    }
+
+    /**
+     * @param  string $content
+     * @return array
+     */
+    public function antiSpam($content, $options=array()){
+
+        $data = array();
+        $data['content'] = $content;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->antiSpamUrl, $data);
+    }
+
+}

+ 273 - 0
addons/zh_jdgjb/baiduSdk/AipImageClassify.php

xqd
@@ -0,0 +1,273 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+class AipImageClassify extends AipBase {
+
+    /**
+     * 通用物体识别 advanced_general api url
+     * @var string
+     */
+    private $advancedGeneralUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v2/advanced_general';
+
+    /**
+     * 菜品识别 dish_detect api url
+     * @var string
+     */
+    private $dishDetectUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v2/dish';
+
+    /**
+     * 车辆识别 car_detect api url
+     * @var string
+     */
+    private $carDetectUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/car';
+
+    /**
+     * logo商标识别 logo_search api url
+     * @var string
+     */
+    private $logoSearchUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v2/logo';
+
+    /**
+     * logo商标识别—添加 logo_add api url
+     * @var string
+     */
+    private $logoAddUrl = 'https://aip.baidubce.com/rest/2.0/realtime_search/v1/logo/add';
+
+    /**
+     * logo商标识别—删除 logo_delete api url
+     * @var string
+     */
+    private $logoDeleteUrl = 'https://aip.baidubce.com/rest/2.0/realtime_search/v1/logo/delete';
+
+    /**
+     * 动物识别 animal_detect api url
+     * @var string
+     */
+    private $animalDetectUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/animal';
+
+    /**
+     * 植物识别 plant_detect api url
+     * @var string
+     */
+    private $plantDetectUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/plant';
+
+    /**
+     * 图像主体检测 object_detect api url
+     * @var string
+     */
+    private $objectDetectUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/object_detect';
+
+    
+
+    /**
+     * 通用物体识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function advancedGeneral($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->advancedGeneralUrl, $data);
+    }
+
+    /**
+     * 菜品识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   top_num 返回预测得分top结果数,默认为5
+     * @return array
+     */
+    public function dishDetect($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->dishDetectUrl, $data);
+    }
+
+    /**
+     * 车辆识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   top_num 返回预测得分top结果数,默认为5
+     * @return array
+     */
+    public function carDetect($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->carDetectUrl, $data);
+    }
+
+    /**
+     * logo商标识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   custom_lib 是否只使用自定义logo库的结果,默认false:返回自定义库+默认库的识别结果
+     * @return array
+     */
+    public function logoSearch($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->logoSearchUrl, $data);
+    }
+
+    /**
+     * logo商标识别—添加接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param string $brief - brief,检索时带回。此处要传对应的name与code字段,name长度小于100B,code长度小于150B
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function logoAdd($image, $brief, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+        $data['brief'] = $brief;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->logoAddUrl, $data);
+    }
+
+    /**
+     * logo商标识别—删除接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function logoDeleteByImage($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->logoDeleteUrl, $data);
+    }
+
+    /**
+     * logo商标识别—删除接口
+     *
+     * @param string $contSign - 图片签名(和image二选一,image优先级更高)
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function logoDeleteBySign($contSign, $options=array()){
+
+        $data = array();
+        
+        $data['cont_sign'] = $contSign;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->logoDeleteUrl, $data);
+    }
+
+    /**
+     * 动物识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   top_num 返回预测得分top结果数,默认为6
+     * @return array
+     */
+    public function animalDetect($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->animalDetectUrl, $data);
+    }
+
+    /**
+     * 植物识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function plantDetect($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->plantDetectUrl, $data);
+    }
+
+    /**
+     * 图像主体检测接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   with_face 如果检测主体是人,主体区域是否带上人脸部分,0-不带人脸区域,其他-带人脸区域,裁剪类需求推荐带人脸,检索/识别类需求推荐不带人脸。默认取1,带人脸。
+     * @return array
+     */
+    public function objectDetect($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->objectDetectUrl, $data);
+    }
+}

+ 324 - 0
addons/zh_jdgjb/baiduSdk/AipImageSearch.php

xqd
@@ -0,0 +1,324 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+class AipImageSearch extends AipBase {
+
+    /**
+     * 相同图检索—入库 same_hq_add api url
+     * @var string
+     */
+    private $sameHqAddUrl = 'https://aip.baidubce.com/rest/2.0/realtime_search/same_hq/add';
+
+    /**
+     * 相同图检索—检索 same_hq_search api url
+     * @var string
+     */
+    private $sameHqSearchUrl = 'https://aip.baidubce.com/rest/2.0/realtime_search/same_hq/search';
+
+    /**
+     * 相同图检索—删除 same_hq_delete api url
+     * @var string
+     */
+    private $sameHqDeleteUrl = 'https://aip.baidubce.com/rest/2.0/realtime_search/same_hq/delete';
+
+    /**
+     * 相似图检索—入库 similar_add api url
+     * @var string
+     */
+    private $similarAddUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/similar/add';
+
+    /**
+     * 相似图检索—检索 similar_search api url
+     * @var string
+     */
+    private $similarSearchUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/similar/search';
+
+    /**
+     * 相似图检索—删除 similar_delete api url
+     * @var string
+     */
+    private $similarDeleteUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/similar/delete';
+
+    /**
+     * 商品检索—入库 product_add api url
+     * @var string
+     */
+    private $productAddUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/add';
+
+    /**
+     * 商品检索—检索 product_search api url
+     * @var string
+     */
+    private $productSearchUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/search';
+
+    /**
+     * 商品检索—删除 product_delete api url
+     * @var string
+     */
+    private $productDeleteUrl = 'https://aip.baidubce.com/rest/2.0/image-classify/v1/realtime_search/product/delete';
+
+    
+
+    /**
+     * 相同图检索—入库接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   brief 检索时原样带回,最长256B。
+     *   tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索
+     * @return array
+     */
+    public function sameHqAdd($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->sameHqAddUrl, $data);
+    }
+
+    /**
+     * 相同图检索—检索接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索
+     *   tag_logic 检索时tag之间的逻辑, 0:逻辑and,1:逻辑or
+     *   pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条
+     *   rn 分页功能,截取条数,例:250
+     * @return array
+     */
+    public function sameHqSearch($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->sameHqSearchUrl, $data);
+    }
+
+    /**
+     * 相同图检索—删除接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function sameHqDeleteByImage($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->sameHqDeleteUrl, $data);
+    }
+
+    /**
+     * 相同图检索—删除接口
+     *
+     * @param string $contSign - 图片签名(和image二选一,image优先级更高)
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function sameHqDeleteBySign($contSign, $options=array()){
+
+        $data = array();
+        
+        $data['cont_sign'] = $contSign;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->sameHqDeleteUrl, $data);
+    }
+
+    /**
+     * 相似图检索—入库接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   brief 检索时原样带回,最长256B。
+     *   tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索
+     * @return array
+     */
+    public function similarAdd($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->similarAddUrl, $data);
+    }
+
+    /**
+     * 相似图检索—检索接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索
+     *   tag_logic 检索时tag之间的逻辑, 0:逻辑and,1:逻辑or
+     *   pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条
+     *   rn 分页功能,截取条数,例:250
+     * @return array
+     */
+    public function similarSearch($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->similarSearchUrl, $data);
+    }
+
+    /**
+     * 相似图检索—删除接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function similarDeleteByImage($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->similarDeleteUrl, $data);
+    }
+
+    /**
+     * 相似图检索—删除接口
+     *
+     * @param string $contSign - 图片签名(和image二选一,image优先级更高)
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function similarDeleteBySign($contSign, $options=array()){
+
+        $data = array();
+        
+        $data['cont_sign'] = $contSign;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->similarDeleteUrl, $data);
+    }
+
+    /**
+     * 商品检索—入库接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   brief 检索时原样带回,最长256B。**请注意,检索接口不返回原图,仅反馈当前填写的brief信息,所以调用该入库接口时,brief信息请尽量填写可关联至本地图库的图片id或者图片url、图片名称等信息**
+     *   class_id1 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索
+     *   class_id2 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索
+     * @return array
+     */
+    public function productAdd($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->productAddUrl, $data);
+    }
+
+    /**
+     * 商品检索—检索接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   class_id1 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索
+     *   class_id2 商品分类维度1,支持1-60范围内的整数。检索时可圈定该分类维度进行检索
+     *   pn 分页功能,起始位置,例:0。未指定分页时,默认返回前300个结果;接口返回数量最大限制1000条,例如:起始位置为900,截取条数500条,接口也只返回第900 - 1000条的结果,共计100条
+     *   rn 分页功能,截取条数,例:250
+     * @return array
+     */
+    public function productSearch($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->productSearchUrl, $data);
+    }
+
+    /**
+     * 商品检索—删除接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function productDeleteByImage($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->productDeleteUrl, $data);
+    }
+
+    /**
+     * 商品检索—删除接口
+     *
+     * @param string $contSign - 图片签名(和image二选一,image优先级更高)
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function productDeleteBySign($contSign, $options=array()){
+
+        $data = array();
+        
+        $data['cont_sign'] = $contSign;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->productDeleteUrl, $data);
+    }
+}
+

+ 189 - 0
addons/zh_jdgjb/baiduSdk/AipKg.php

xqd
@@ -0,0 +1,189 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+class AipKg extends AipBase {
+
+    /**
+     * 创建任务 create_task api url
+     * @var string
+     */
+    private $createTaskUrl = 'https://aip.baidubce.com/rest/2.0/kg/v1/pie/task_create';
+
+    /**
+     * 更新任务 update_task api url
+     * @var string
+     */
+    private $updateTaskUrl = 'https://aip.baidubce.com/rest/2.0/kg/v1/pie/task_update';
+
+    /**
+     * 获取任务详情 task_info api url
+     * @var string
+     */
+    private $taskInfoUrl = 'https://aip.baidubce.com/rest/2.0/kg/v1/pie/task_info';
+
+    /**
+     * 以分页的方式查询当前用户所有的任务信息 task_query api url
+     * @var string
+     */
+    private $taskQueryUrl = 'https://aip.baidubce.com/rest/2.0/kg/v1/pie/task_query';
+
+    /**
+     * 启动任务 task_start api url
+     * @var string
+     */
+    private $taskStartUrl = 'https://aip.baidubce.com/rest/2.0/kg/v1/pie/task_start';
+
+    /**
+     * 查询任务状态 task_status api url
+     * @var string
+     */
+    private $taskStatusUrl = 'https://aip.baidubce.com/rest/2.0/kg/v1/pie/task_status';
+
+    
+
+    /**
+     * 创建任务接口
+     *
+     * @param string $name - 任务名字
+     * @param string $templateContent - json string 解析模板内容
+     * @param string $inputMappingFile - 抓取结果映射文件的路径
+     * @param string $outputFile - 输出文件名字
+     * @param string $urlPattern - url pattern
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   limit_count 限制解析数量limit_count为0时进行全量任务,limit_count&gt;0时只解析limit_count数量的页面
+     * @return array
+     */
+    public function createTask($name, $templateContent, $inputMappingFile, $outputFile, $urlPattern, $options=array()){
+
+        $data = array();
+        
+        $data['name'] = $name;
+        $data['template_content'] = $templateContent;
+        $data['input_mapping_file'] = $inputMappingFile;
+        $data['output_file'] = $outputFile;
+        $data['url_pattern'] = $urlPattern;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->createTaskUrl, $data);
+    }
+
+    /**
+     * 更新任务接口
+     *
+     * @param integer $id - 任务ID
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   name 任务名字
+     *   template_content json string 解析模板内容
+     *   input_mapping_file 抓取结果映射文件的路径
+     *   url_pattern url pattern
+     *   output_file 输出文件名字
+     * @return array
+     */
+    public function updateTask($id, $options=array()){
+
+        $data = array();
+        
+        $data['id'] = $id;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->updateTaskUrl, $data);
+    }
+
+    /**
+     * 获取任务详情接口
+     *
+     * @param integer $id - 任务ID
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function getTaskInfo($id, $options=array()){
+
+        $data = array();
+        
+        $data['id'] = $id;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->taskInfoUrl, $data);
+    }
+
+    /**
+     * 以分页的方式查询当前用户所有的任务信息接口
+     *
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   id 任务ID,精确匹配
+     *   name 中缀模糊匹配,abc可以匹配abc,aaabc,abcde等
+     *   status 要筛选的任务状态
+     *   page 页码
+     *   per_page 页码
+     * @return array
+     */
+    public function getUserTasks($options=array()){
+
+        $data = array();
+        
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->taskQueryUrl, $data);
+    }
+
+    /**
+     * 启动任务接口
+     *
+     * @param integer $id - 任务ID
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function startTask($id, $options=array()){
+
+        $data = array();
+        
+        $data['id'] = $id;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->taskStartUrl, $data);
+    }
+
+    /**
+     * 查询任务状态接口
+     *
+     * @param integer $id - 任务ID
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function getTaskStatus($id, $options=array()){
+
+        $data = array();
+        
+        $data['id'] = $id;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->taskStatusUrl, $data);
+    }
+}

+ 327 - 0
addons/zh_jdgjb/baiduSdk/AipNlp.php

xqd
@@ -0,0 +1,327 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+class AipNlp extends AipBase {
+
+    /**
+     * 词法分析 lexer api url
+     * @var string
+     */
+    private $lexerUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer';
+
+    /**
+     * 词法分析(定制版) lexer_custom api url
+     * @var string
+     */
+    private $lexerCustomUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/lexer_custom';
+
+    /**
+     * 依存句法分析 dep_parser api url
+     * @var string
+     */
+    private $depParserUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/depparser';
+
+    /**
+     * 词向量表示 word_embedding api url
+     * @var string
+     */
+    private $wordEmbeddingUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v2/word_emb_vec';
+
+    /**
+     * DNN语言模型 dnnlm_cn api url
+     * @var string
+     */
+    private $dnnlmCnUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v2/dnnlm_cn';
+
+    /**
+     * 词义相似度 word_sim_embedding api url
+     * @var string
+     */
+    private $wordSimEmbeddingUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v2/word_emb_sim';
+
+    /**
+     * 短文本相似度 simnet api url
+     * @var string
+     */
+    private $simnetUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v2/simnet';
+
+    /**
+     * 评论观点抽取 comment_tag api url
+     * @var string
+     */
+    private $commentTagUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v2/comment_tag';
+
+    /**
+     * 情感倾向分析 sentiment_classify api url
+     * @var string
+     */
+    private $sentimentClassifyUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/sentiment_classify';
+
+    /**
+     * 文章标签 keyword api url
+     * @var string
+     */
+    private $keywordUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/keyword';
+
+    /**
+     * 文章分类 topic api url
+     * @var string
+     */
+    private $topicUrl = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/topic';
+
+    /**
+     * 格式化结果
+     * @param $content string
+     * @return mixed
+     */
+    protected function proccessResult($content){
+        return json_decode(mb_convert_encoding($content, 'UTF8', 'GBK'), true, 512, JSON_BIGINT_AS_STRING);
+    }
+
+    /**
+     * 词法分析接口
+     *
+     * @param string $text - 待分析文本(目前仅支持GBK编码),长度不超过65536字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function lexer($text, $options=array()){
+
+        $data = array();
+        
+        $data['text'] = $text;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->lexerUrl, $data);
+    }
+
+    /**
+     * 词法分析(定制版)接口
+     *
+     * @param string $text - 待分析文本(目前仅支持GBK编码),长度不超过65536字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function lexerCustom($text, $options=array()){
+
+        $data = array();
+        
+        $data['text'] = $text;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->lexerCustomUrl, $data);
+    }
+
+    /**
+     * 依存句法分析接口
+     *
+     * @param string $text - 待分析文本(目前仅支持GBK编码),长度不超过256字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   mode 模型选择。默认值为0,可选值mode=0(对应web模型);mode=1(对应query模型)
+     * @return array
+     */
+    public function depParser($text, $options=array()){
+
+        $data = array();
+        
+        $data['text'] = $text;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->depParserUrl, $data);
+    }
+
+    /**
+     * 词向量表示接口
+     *
+     * @param string $word - 文本内容(GBK编码),最大64字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function wordEmbedding($word, $options=array()){
+
+        $data = array();
+        
+        $data['word'] = $word;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->wordEmbeddingUrl, $data);
+    }
+
+    /**
+     * DNN语言模型接口
+     *
+     * @param string $text - 文本内容(GBK编码),最大512字节,不需要切词
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function dnnlm($text, $options=array()){
+
+        $data = array();
+        
+        $data['text'] = $text;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->dnnlmCnUrl, $data);
+    }
+
+    /**
+     * 词义相似度接口
+     *
+     * @param string $word1 - 词1(GBK编码),最大64字节
+     * @param string $word2 - 词1(GBK编码),最大64字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   mode 预留字段,可选择不同的词义相似度模型。默认值为0,目前仅支持mode=0
+     * @return array
+     */
+    public function wordSimEmbedding($word1, $word2, $options=array()){
+
+        $data = array();
+        
+        $data['word_1'] = $word1;
+        $data['word_2'] = $word2;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->wordSimEmbeddingUrl, $data);
+    }
+
+    /**
+     * 短文本相似度接口
+     *
+     * @param string $text1 - 待比较文本1(GBK编码),最大512字节
+     * @param string $text2 - 待比较文本2(GBK编码),最大512字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   model 默认为"BOW",可选"BOW"、"CNN"与"GRNN"
+     * @return array
+     */
+    public function simnet($text1, $text2, $options=array()){
+
+        $data = array();
+        
+        $data['text_1'] = $text1;
+        $data['text_2'] = $text2;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->simnetUrl, $data);
+    }
+
+    /**
+     * 评论观点抽取接口
+     *
+     * @param string $text - 评论内容(GBK编码),最大10240字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   type 评论行业类型,默认为4(餐饮美食)
+     * @return array
+     */
+    public function commentTag($text, $options=array()){
+
+        $data = array();
+        
+        $data['text'] = $text;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->commentTagUrl, $data);
+    }
+
+    /**
+     * 情感倾向分析接口
+     *
+     * @param string $text - 文本内容(GBK编码),最大102400字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function sentimentClassify($text, $options=array()){
+
+        $data = array();
+        
+        $data['text'] = $text;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->sentimentClassifyUrl, $data);
+    }
+
+    /**
+     * 文章标签接口
+     *
+     * @param string $title - 篇章的标题,最大80字节
+     * @param string $content - 篇章的正文,最大65535字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function keyword($title, $content, $options=array()){
+
+        $data = array();
+        
+        $data['title'] = $title;
+        $data['content'] = $content;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->keywordUrl, $data);
+    }
+
+    /**
+     * 文章分类接口
+     *
+     * @param string $title - 篇章的标题,最大80字节
+     * @param string $content - 篇章的正文,最大65535字节
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function topic($title, $content, $options=array()){
+
+        $data = array();
+        
+        $data['title'] = $title;
+        $data['content'] = $content;
+
+        $data = array_merge($data, $options);
+        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');
+
+        return $this->request($this->topicUrl, $data);
+    }
+}

+ 782 - 0
addons/zh_jdgjb/baiduSdk/AipOcr.php

xqd
@@ -0,0 +1,782 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+
+class AipOcr extends AipBase {
+
+    /**
+     * 通用文字识别 general_basic api url
+     * @var string
+     */
+    private $generalBasicUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic';
+
+    /**
+     * 通用文字识别(高精度版) accurate_basic api url
+     * @var string
+     */
+    private $accurateBasicUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic';
+
+    /**
+     * 通用文字识别(含位置信息版) general api url
+     * @var string
+     */
+    private $generalUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/general';
+
+    /**
+     * 通用文字识别(含位置高精度版) accurate api url
+     * @var string
+     */
+    private $accurateUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/accurate';
+
+    /**
+     * 通用文字识别(含生僻字版) general_enhanced api url
+     * @var string
+     */
+    private $generalEnhancedUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/general_enhanced';
+
+    /**
+     * 网络图片文字识别 web_image api url
+     * @var string
+     */
+    private $webImageUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/webimage';
+
+    /**
+     * 身份证识别 idcard api url
+     * @var string
+     */
+    private $idcardUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/idcard';
+
+    /**
+     * 银行卡识别 bankcard api url
+     * @var string
+     */
+    private $bankcardUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard';
+
+    /**
+     * 驾驶证识别 driving_license api url
+     * @var string
+     */
+    private $drivingLicenseUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/driving_license';
+
+    /**
+     * 行驶证识别 vehicle_license api url
+     * @var string
+     */
+    private $vehicleLicenseUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license';
+
+    /**
+     * 车牌识别 license_plate api url
+     * @var string
+     */
+    private $licensePlateUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/license_plate';
+
+    /**
+     * 营业执照识别 business_license api url
+     * @var string
+     */
+    private $businessLicenseUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/business_license';
+
+    /**
+     * 通用票据识别 receipt api url
+     * @var string
+     */
+    private $receiptUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/receipt';
+
+    /**
+     * 表格文字识别同步接口 form api url
+     * @var string
+     */
+    private $formUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/form';
+
+    /**
+     * 表格文字识别 table_recognize api url
+     * @var string
+     */
+    private $tableRecognizeUrl = 'https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/request';
+
+    /**
+     * 表格识别结果 table_result_get api url
+     * @var string
+     */
+    private $tableResultGetUrl = 'https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/get_request_result';
+
+    /**
+     * 增值税发票识别 vat_invoice api url
+     * @var string
+     */
+    private $vatInvoiceUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice';
+
+    /**
+     * 二维码识别 qrcode api url
+     * @var string
+     */
+    private $qrcodeUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/qrcode';
+
+    /**
+     * 数字识别 numbers api url
+     * @var string
+     */
+    private $numbersUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/numbers';
+
+    /**
+     * 彩票识别 lottery api url
+     * @var string
+     */
+    private $lotteryUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/lottery';
+
+    /**
+     * 护照识别 passport api url
+     * @var string
+     */
+    private $passportUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/passport';
+
+    /**
+     * 名片识别 business_card api url
+     * @var string
+     */
+    private $businessCardUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/business_card';
+
+    /**
+     * 手写文字识别 handwriting api url
+     * @var string
+     */
+    private $handwritingUrl = 'https://aip.baidubce.com/rest/2.0/ocr/v1/handwriting';
+
+    /**
+     * 自定义模板文字识别 custom api url
+     * @var string
+     */
+    private $customUrl = 'https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise';
+
+    
+
+    /**
+     * 通用文字识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语;
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
+     *   probability 是否返回识别结果中每一行的置信度
+     * @return array
+     */
+    public function basicGeneral($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->generalBasicUrl, $data);
+    }
+
+    /**
+     * 通用文字识别接口
+     *
+     * @param string $url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语;
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
+     *   probability 是否返回识别结果中每一行的置信度
+     * @return array
+     */
+    public function basicGeneralUrl($url, $options=array()){
+
+        $data = array();
+        
+        $data['url'] = $url;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->generalBasicUrl, $data);
+    }
+
+    /**
+     * 通用文字识别(高精度版)接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   probability 是否返回识别结果中每一行的置信度
+     * @return array
+     */
+    public function basicAccurate($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->accurateBasicUrl, $data);
+    }
+
+    /**
+     * 通用文字识别(含位置信息版)接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置
+     *   language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语;
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
+     *   vertexes_location 是否返回文字外接多边形顶点位置,不支持单字位置。默认为false
+     *   probability 是否返回识别结果中每一行的置信度
+     * @return array
+     */
+    public function general($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->generalUrl, $data);
+    }
+
+    /**
+     * 通用文字识别(含位置信息版)接口
+     *
+     * @param string $url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置
+     *   language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语;
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
+     *   vertexes_location 是否返回文字外接多边形顶点位置,不支持单字位置。默认为false
+     *   probability 是否返回识别结果中每一行的置信度
+     * @return array
+     */
+    public function generalUrl($url, $options=array()){
+
+        $data = array();
+        
+        $data['url'] = $url;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->generalUrl, $data);
+    }
+
+    /**
+     * 通用文字识别(含位置高精度版)接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   vertexes_location 是否返回文字外接多边形顶点位置,不支持单字位置。默认为false
+     *   probability 是否返回识别结果中每一行的置信度
+     * @return array
+     */
+    public function accurate($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->accurateUrl, $data);
+    }
+
+    /**
+     * 通用文字识别(含生僻字版)接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语;
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
+     *   probability 是否返回识别结果中每一行的置信度
+     * @return array
+     */
+    public function enhancedGeneral($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->generalEnhancedUrl, $data);
+    }
+
+    /**
+     * 通用文字识别(含生僻字版)接口
+     *
+     * @param string $url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语;
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
+     *   probability 是否返回识别结果中每一行的置信度
+     * @return array
+     */
+    public function enhancedGeneralUrl($url, $options=array()){
+
+        $data = array();
+        
+        $data['url'] = $url;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->generalEnhancedUrl, $data);
+    }
+
+    /**
+     * 网络图片文字识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
+     * @return array
+     */
+    public function webImage($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->webImageUrl, $data);
+    }
+
+    /**
+     * 网络图片文字识别接口
+     *
+     * @param string $url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)
+     * @return array
+     */
+    public function webImageUrl($url, $options=array()){
+
+        $data = array();
+        
+        $data['url'] = $url;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->webImageUrl, $data);
+    }
+
+    /**
+     * 身份证识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param string $idCardSide - front:身份证含照片的一面;back:身份证带国徽的一面
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   detect_risk 是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,即:false。可选值:true-开启;false-不开启
+     * @return array
+     */
+    public function idcard($image, $idCardSide, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+        $data['id_card_side'] = $idCardSide;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->idcardUrl, $data);
+    }
+
+    /**
+     * 银行卡识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function bankcard($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->bankcardUrl, $data);
+    }
+
+    /**
+     * 驾驶证识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     * @return array
+     */
+    public function drivingLicense($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->drivingLicenseUrl, $data);
+    }
+
+    /**
+     * 行驶证识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     *   accuracy normal 使用快速服务,1200ms左右时延;缺省或其它值使用高精度服务,1600ms左右时延
+     * @return array
+     */
+    public function vehicleLicense($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->vehicleLicenseUrl, $data);
+    }
+
+    /**
+     * 车牌识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   multi_detect 是否检测多张车牌,默认为false,当置为true的时候可以对一张图片内的多张车牌进行识别
+     * @return array
+     */
+    public function licensePlate($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->licensePlateUrl, $data);
+    }
+
+    /**
+     * 营业执照识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function businessLicense($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->businessLicenseUrl, $data);
+    }
+
+    /**
+     * 通用票据识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置
+     *   probability 是否返回识别结果中每一行的置信度
+     *   accuracy normal 使用快速服务,1200ms左右时延;缺省或其它值使用高精度服务,1600ms左右时延
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     * @return array
+     */
+    public function receipt($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->receiptUrl, $data);
+    }
+
+    /**
+     * 表格文字识别同步接口接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function form($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->formUrl, $data);
+    }
+
+    /**
+     * 表格文字识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function tableRecognitionAsync($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->tableRecognizeUrl, $data);
+    }
+
+    /**
+     * 表格识别结果接口
+     *
+     * @param string $requestId - 发送表格文字识别请求时返回的request id
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   result_type 期望获取结果的类型,取值为“excel”时返回xls文件的地址,取值为“json”时返回json格式的字符串,默认为”excel”
+     * @return array
+     */
+    public function getTableRecognitionResult($requestId, $options=array()){
+
+        $data = array();
+        
+        $data['request_id'] = $requestId;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->tableResultGetUrl, $data);
+    }
+
+    /**
+     * 增值税发票识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function vatInvoice($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->vatInvoiceUrl, $data);
+    }
+
+    /**
+     * 二维码识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function qrcode($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->qrcodeUrl, $data);
+    }
+
+    /**
+     * 数字识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置
+     *   detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。
+     * @return array
+     */
+    public function numbers($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->numbersUrl, $data);
+    }
+
+    /**
+     * 彩票识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置
+     * @return array
+     */
+    public function lottery($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->lotteryUrl, $data);
+    }
+
+    /**
+     * 护照识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function passport($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->passportUrl, $data);
+    }
+
+    /**
+     * 名片识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function businessCard($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->businessCardUrl, $data);
+    }
+
+    /**
+     * 手写文字识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     *   recognize_granularity 是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置
+     * @return array
+     */
+    public function handwriting($image, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->handwritingUrl, $data);
+    }
+
+    /**
+     * 自定义模板文字识别接口
+     *
+     * @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
+     * @param string $templateSign - 您在自定义文字识别平台制作的模板的ID
+     * @param array $options - 可选参数对象,key: value都为string类型
+     * @description options列表:
+     * @return array
+     */
+    public function custom($image, $templateSign, $options=array()){
+
+        $data = array();
+        
+        $data['image'] = base64_encode($image);
+        $data['templateSign'] = $templateSign;
+
+        $data = array_merge($data, $options);
+
+        return $this->request($this->customUrl, $data);
+    }
+
+    /**
+     * 同步请求
+     * @param  string $image 图像读取
+     * @param  options 接口可选参数
+     * @return array
+     */
+    public function tableRecognition($image, $options=array(), $timeout=10000){
+        $result = $this->tableRecognitionAsync($image);
+        if(isset($result['error_code'])){
+            return $result;
+        }
+        $requestId = $result['result'][0]['request_id'];
+        $count = ceil($timeout / 1000);
+        for($i=0; $i<$count; $i++){
+            $result = $this->getTableRecognitionResult($requestId, $options);
+            // 完成
+            if($result['result']['ret_code'] == 3){ 
+                break;
+            }
+            sleep(1);
+        }
+        return $result;
+    }
+
+}
+

+ 138 - 0
addons/zh_jdgjb/baiduSdk/AipSpeech.php

xqd
@@ -0,0 +1,138 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+
+/**
+ * 百度语音
+ */
+class AipSpeech extends AipBase{
+
+    /**
+     * url
+     * @var string
+     */
+    public $asrUrl = 'http://vop.baidu.com/server_api';
+
+    /**
+     * url
+     * @var string
+     */
+    public $ttsUrl = 'http://tsn.baidu.com/text2audio';
+
+    /**
+     * 判断认证是否有权限
+     * @param  array   $authObj 
+     * @return boolean          
+     */
+    protected function isPermission($authObj)
+    {
+        return true;
+    }
+
+    /**
+     * 处理请求参数
+     * @param string $url
+     * @param array $params
+     * @param array $data
+     * @param array $headers
+     */
+    protected function proccessRequest($url, &$params, &$data, $headers){
+
+        $token = isset($params['access_token']) ? $params['access_token'] : '';
+
+        if(empty($data['cuid'])){
+            $data['cuid'] = md5($token);
+        }
+
+        if($url === $this->asrUrl){
+            $data['token'] = $token;
+            $data = json_encode($data);
+        }else{
+            $data['tok'] = $token;
+        }
+
+        unset($params['access_token']);
+    }
+
+    /**
+     * 格式化结果
+     * @param $content string
+     * @return mixed
+     */
+    protected function proccessResult($content){
+        $obj = json_decode($content, true);
+
+        if($obj === null){
+            $obj = array(
+                '__json_decode_error' => $content
+            );
+        }
+
+        return $obj;
+    }
+
+    /**
+     * @param  string $speech
+     * @param  string $format
+     * @param  int $rate
+     * @param  array $options
+     * @return array
+     */
+    public function asr($speech, $format, $rate, $options=array()){
+        $data = array();
+
+        if(!empty($speech)){
+            $data['speech'] = base64_encode($speech);
+            $data['len'] = strlen($speech);
+        }
+
+        $data['format'] = $format;
+        $data['rate'] = $rate;
+        $data['channel'] = 1;
+
+        $data = array_merge($data, $options);  
+
+        return $this->request($this->asrUrl, $data, array());
+    }
+
+    /**
+     * @param  string $text
+     * @param  string $lang
+     * @param  int $ctp
+     * @param  array $options
+     * @return array
+     */
+    public function synthesis($text, $lang='zh', $ctp=1, $options=array()){
+        $data = array();
+
+        $data['tex'] = $text;
+        $data['lan'] = $lang;
+        $data['ctp'] = $ctp;
+
+        $data = array_merge($data, $options);  
+
+        $result = $this->request($this->ttsUrl, $data, array());
+
+        if(isset($result['__json_decode_error'])){
+            return $result['__json_decode_error'];
+        }
+
+        return $result;
+    }
+
+}

+ 367 - 0
addons/zh_jdgjb/baiduSdk/lib/AipBCEUtil.php

xqd
@@ -0,0 +1,367 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+/**
+ * BCE Util
+ */
+class AipHttpUtil
+{
+    // 根据RFC 3986,除了:
+    //   1.大小写英文字符
+    //   2.阿拉伯数字
+    //   3.点'.'、波浪线'~'、减号'-'以及下划线'_'
+    // 以外都要编码
+    public static $PERCENT_ENCODED_STRINGS;
+
+    //填充编码数组
+    public static function __init()
+    {
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS = array();
+        for ($i = 0; $i < 256; ++$i) {
+            AipHttpUtil::$PERCENT_ENCODED_STRINGS[$i] = sprintf("%%%02X", $i);
+        }
+
+        //a-z不编码
+        foreach (range('a', 'z') as $ch) {
+            AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord($ch)] = $ch;
+        }
+
+        //A-Z不编码
+        foreach (range('A', 'Z') as $ch) {
+            AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord($ch)] = $ch;
+        }
+
+        //0-9不编码
+        foreach (range('0', '9') as $ch) {
+            AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord($ch)] = $ch;
+        }
+
+        //以下4个字符不编码
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord('-')] = '-';
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord('.')] = '.';
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord('_')] = '_';
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord('~')] = '~';
+    }
+
+    /**
+     * 在uri编码中不能对'/'编码
+     * @param  string $path
+     * @return string
+     */
+    public static function urlEncodeExceptSlash($path)
+    {
+        return str_replace("%2F", "/", AipHttpUtil::urlEncode($path));
+    }
+
+    /**
+     * 使用编码数组编码
+     * @param  string $path
+     * @return string
+     */
+    public static function urlEncode($value)
+    {
+        $result = '';
+        for ($i = 0; $i < strlen($value); ++$i) {
+            $result .= AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord($value[$i])];
+        }
+        return $result;
+    }
+
+    /**
+     * 生成标准化QueryString
+     * @param  array $parameters
+     * @return array
+     */
+    public static function getCanonicalQueryString(array $parameters)
+    {
+        //没有参数,直接返回空串
+        if (count($parameters) == 0) {
+            return '';
+        }
+
+        $parameterStrings = array();
+        foreach ($parameters as $k => $v) {
+            //跳过Authorization字段
+            if (strcasecmp('Authorization', $k) == 0) {
+                continue;
+            }
+            if (!isset($k)) {
+                throw new \InvalidArgumentException(
+                    "parameter key should not be null"
+                );
+            }
+            if (isset($v)) {
+                //对于有值的,编码后放在=号两边
+                $parameterStrings[] = AipHttpUtil::urlEncode($k)
+                    . '=' . AipHttpUtil::urlEncode((string) $v);
+            } else {
+                //对于没有值的,只将key编码后放在=号的左边,右边留空
+                $parameterStrings[] = AipHttpUtil::urlEncode($k) . '=';
+            }
+        }
+        //按照字典序排序
+        sort($parameterStrings);
+
+        //使用'&'符号连接它们
+        return implode('&', $parameterStrings);
+    }
+
+    /**
+     * 生成标准化uri
+     * @param  string $path
+     * @return string
+     */
+    public static function getCanonicalURIPath($path)
+    {
+        //空路径设置为'/'
+        if (empty($path)) {
+            return '/';
+        } else {
+            //所有的uri必须以'/'开头
+            if ($path[0] == '/') {
+                return AipHttpUtil::urlEncodeExceptSlash($path);
+            } else {
+                return '/' . AipHttpUtil::urlEncodeExceptSlash($path);
+            }
+        }
+    }
+
+    /**
+     * 生成标准化http请求头串
+     * @param  array $headers
+     * @return array
+     */
+    public static function getCanonicalHeaders($headers)
+    {
+        //如果没有headers,则返回空串
+        if (count($headers) == 0) {
+            return '';
+        }
+
+        $headerStrings = array();
+        foreach ($headers as $k => $v) {
+            //跳过key为null的
+            if ($k === null) {
+                continue;
+            }
+            //如果value为null,则赋值为空串
+            if ($v === null) {
+                $v = '';
+            }
+            //trim后再encode,之后使用':'号连接起来
+            $headerStrings[] = AipHttpUtil::urlEncode(strtolower(trim($k))) . ':' . AipHttpUtil::urlEncode(trim($v));
+        }
+        //字典序排序
+        sort($headerStrings);
+
+        //用'\n'把它们连接起来
+        return implode("\n", $headerStrings);
+    }
+}
+AipHttpUtil::__init();
+
+
+class AipSignOption
+{
+    const EXPIRATION_IN_SECONDS = 'expirationInSeconds';
+
+    const HEADERS_TO_SIGN = 'headersToSign';
+
+    const TIMESTAMP = 'timestamp';
+
+    const DEFAULT_EXPIRATION_IN_SECONDS = 1800;
+
+    const MIN_EXPIRATION_IN_SECONDS = 300;
+
+    const MAX_EXPIRATION_IN_SECONDS = 129600;
+}
+
+
+class AipSampleSigner
+{
+
+    const BCE_AUTH_VERSION = "bce-auth-v1";
+    const BCE_PREFIX = 'x-bce-';
+
+    //不指定headersToSign情况下,默认签名http头,包括:
+    //    1.host
+    //    2.content-length
+    //    3.content-type
+    //    4.content-md5
+    public static $defaultHeadersToSign;
+
+    public static function  __init()
+    {
+        AipSampleSigner::$defaultHeadersToSign = array(
+            "host",
+            "content-length",
+            "content-type",
+            "content-md5",
+        );
+    }
+
+    /**
+     * 签名
+     * @param  array $credentials
+     * @param  string $httpMethod
+     * @param  string $path
+     * @param  array  $headers
+     * @param  string $params
+     * @param  array  $options
+     * @return string
+     */
+    public static function sign(
+        array $credentials,
+        $httpMethod,
+        $path,
+        $headers,
+        $params,
+        $options = array()
+    ) {
+        //设定签名有效时间
+        if (!isset($options[AipSignOption::EXPIRATION_IN_SECONDS])) {
+            //默认值1800秒
+            $expirationInSeconds = AipSignOption::DEFAULT_EXPIRATION_IN_SECONDS;
+        } else {
+            $expirationInSeconds = $options[AipSignOption::EXPIRATION_IN_SECONDS];
+        }
+
+        //解析ak sk
+        $accessKeyId = $credentials['ak'];
+        $secretAccessKey = $credentials['sk'];
+
+        //设定时间戳,注意:如果自行指定时间戳需要为UTC时间
+        if (!isset($options[AipSignOption::TIMESTAMP])) {
+            //默认值当前时间
+            $timestamp = gmdate('Y-m-d\TH:i:s\Z');
+        } else {
+            $timestamp = $options[AipSignOption::TIMESTAMP];
+        }
+
+        //生成authString
+        $authString = AipSampleSigner::BCE_AUTH_VERSION . '/' . $accessKeyId . '/'
+            . $timestamp . '/' . $expirationInSeconds;
+
+        //使用sk和authString生成signKey
+        $signingKey = hash_hmac('sha256', $authString, $secretAccessKey);
+
+        //生成标准化URI
+        $canonicalURI = AipHttpUtil::getCanonicalURIPath($path);
+
+        //生成标准化QueryString
+        $canonicalQueryString = AipHttpUtil::getCanonicalQueryString($params);
+
+        //填充headersToSign,也就是指明哪些header参与签名
+        $headersToSign = null;
+        if (isset($options[AipSignOption::HEADERS_TO_SIGN])) {
+            $headersToSign = $options[AipSignOption::HEADERS_TO_SIGN];
+        }
+
+        //生成标准化header
+        $canonicalHeader = AipHttpUtil::getCanonicalHeaders(
+            AipSampleSigner::getHeadersToSign($headers, $headersToSign)
+        );
+
+        //整理headersToSign,以';'号连接
+        $signedHeaders = '';
+        if ($headersToSign !== null) {
+            $signedHeaders = strtolower(
+                trim(implode(";", $headersToSign))
+            );
+        }
+
+        //组成标准请求串
+        $canonicalRequest = "$httpMethod\n$canonicalURI\n"
+            . "$canonicalQueryString\n$canonicalHeader";
+
+        //使用signKey和标准请求串完成签名
+        $signature = hash_hmac('sha256', $canonicalRequest, $signingKey);
+
+        //组成最终签名串
+        $authorizationHeader = "$authString/$signedHeaders/$signature";
+
+        return $authorizationHeader;
+    }
+
+    /**
+     * 根据headsToSign过滤应该参与签名的header
+     * @param  array $headers
+     * @param  array $headersToSign
+     * @return array
+     */
+    public static function getHeadersToSign($headers, $headersToSign)
+    {
+
+        //value被trim后为空串的header不参与签名
+        $filter_empty = function($v) {
+            return trim((string) $v) !== '';
+        };
+        $headers = array_filter($headers, $filter_empty);
+
+        //处理headers的key:去掉前后的空白并转化成小写
+        $trim_and_lower = function($str){
+            return strtolower(trim($str));
+        };
+        $temp = array();
+        $process_keys = function($k, $v) use(&$temp, $trim_and_lower) {
+            $temp[$trim_and_lower($k)] = $v;
+        };
+        array_map($process_keys, array_keys($headers), $headers);
+        $headers = $temp;
+
+        //取出headers的key以备用
+        $header_keys = array_keys($headers);
+
+        $filtered_keys = null;
+        if ($headersToSign !== null) {
+            //如果有headersToSign,则根据headersToSign过滤
+
+            //预处理headersToSign:去掉前后的空白并转化成小写
+            $headersToSign = array_map($trim_and_lower, $headersToSign);
+
+            //只选取在headersToSign里面的header
+            $filtered_keys = array_intersect_key($header_keys, $headersToSign);
+
+        } else {
+            //如果没有headersToSign,则根据默认规则来选取headers
+            $filter_by_default = function($k) {
+                return AipSampleSigner::isDefaultHeaderToSign($k);
+            };
+            $filtered_keys = array_filter($header_keys, $filter_by_default);
+        }
+
+        //返回需要参与签名的header
+        return array_intersect_key($headers, array_flip($filtered_keys));
+    }
+
+    /**
+     * 检查header是不是默认参加签名的:
+     * 1.是host、content-type、content-md5、content-length之一
+     * 2.以x-bce开头
+     * @param  array $header
+     * @return boolean
+     */
+    public static function isDefaultHeaderToSign($header)
+    {
+        $header = strtolower(trim($header));
+        if (in_array($header, AipSampleSigner::$defaultHeadersToSign)) {
+            return true;
+        }
+        return substr_compare($header, AipSampleSigner::BCE_PREFIX, 0, strlen(AipSampleSigner::BCE_PREFIX)) == 0;
+    }
+}
+AipSampleSigner::__init();

+ 395 - 0
addons/zh_jdgjb/baiduSdk/lib/AipBase.php

xqd
@@ -0,0 +1,395 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'AipHttpClient.php';
+require_once 'AipBCEUtil.php';
+
+/**
+ * Aip Base 基类
+ */
+class AipBase {
+
+    /**
+     * 获取access token url
+     * @var string
+     */
+    protected $accessTokenUrl = 'https://aip.baidubce.com/oauth/2.0/token';
+
+     /**
+     * 反馈接口
+     * @var string
+     */
+    protected $reportUrl = 'https://aip.baidubce.com/rpc/2.0/feedback/v1/report';
+
+    /**
+     * appId
+     * @var string
+     */
+    protected $appId = '';
+
+    /**
+     * apiKey
+     * @var string
+     */
+    protected $apiKey = '';
+    
+    /**
+     * secretKey
+     * @var string
+     */
+    protected $secretKey = '';
+
+    /**
+     * 权限
+     * @var array
+     */
+    protected $scope = 'brain_all_scope';
+
+    /**
+     * @param string $appId 
+     * @param string $apiKey
+     * @param string $secretKey
+     */
+    public function __construct($appId, $apiKey, $secretKey){
+        $this->appId = trim($appId);
+        $this->apiKey = trim($apiKey);
+        $this->secretKey = trim($secretKey);
+        $this->isCloudUser = null;
+        $this->client = new AipHttpClient();
+        $this->version = '2_2_4';
+        $this->proxies = array();
+    }
+
+    /**
+     * 查看版本
+     * @return string
+     * 
+     */
+    public function getVersion(){
+        return $this->version;
+    }    
+
+    /**
+     * 连接超时
+     * @param int $ms 毫秒
+     */
+    public function setConnectionTimeoutInMillis($ms){
+        $this->client->setConnectionTimeoutInMillis($ms);
+    }
+
+    /**
+     * 响应超时
+     * @param int $ms 毫秒
+     */
+    public function setSocketTimeoutInMillis($ms){
+        $this->client->setSocketTimeoutInMillis($ms);
+    }
+
+    /**
+     * 代理
+     * @param array $proxy
+     * @return string
+     * 
+     */
+    public function setProxies($proxies){
+        $this->client->setConf($proxies);
+    } 
+
+    /**
+     * 处理请求参数
+     * @param  string $url
+     * @param array $params
+     * @param array $data
+     * @param array $headers
+     */
+    protected function proccessRequest($url, &$params, &$data, $headers){
+        $params['aipSdk'] = 'php';
+        $params['aipSdkVersion'] = $this->version;
+    }
+
+    /**
+     * Api 请求
+     * @param  string $url
+     * @param  mixed $data
+     * @return mixed
+     */
+    protected function request($url, $data, $headers=array()){
+        try{
+            $result = $this->validate($url, $data);
+            if($result !== true){
+                return $result;
+            }
+
+            $params = array();
+            $authObj = $this->auth();
+
+            if($this->isCloudUser === false){
+                $params['access_token'] = $authObj['access_token'];
+            }
+
+            // 特殊处理
+            $this->proccessRequest($url, $params, $data, $headers);
+ 
+            $headers = $this->getAuthHeaders('POST', $url, $params, $headers);
+            $response = $this->client->post($url, $data, $params, $headers);
+           // var_dump($response);die;
+            $obj = $this->proccessResult($response['content']);
+            //
+            if(!$this->isCloudUser && isset($obj['error_code']) && $obj['error_code'] == 110){
+                   echo $obj['error_code'];die;
+                $authObj = $this->auth(true);
+                $params['access_token'] = $authObj['access_token'];
+                $response = $this->client->post($url, $data, $params, $headers);
+                $obj = $this->proccessResult($response['content']);
+            }
+
+            if(empty($obj) || !isset($obj['error_code'])){
+                $this->writeAuthObj($authObj);
+            }
+           // echo 678;die;
+        }catch(Exception $e){
+            return array(
+                'error_code' => 'SDK108',
+                'error_msg' => 'connection or read data timeout',
+            );
+        }
+        return $obj;
+    }
+
+    /**
+     * Api 多个并发请求
+     * @param  string $url
+     * @param  mixed $data
+     * @return mixed
+     */
+    protected function multi_request($url, $data){
+        try{
+            $params = array();
+            $authObj = $this->auth();
+            $headers = $this->getAuthHeaders('POST', $url);
+
+            if($this->isCloudUser === false){
+                $params['access_token'] = $authObj['access_token'];
+            }
+
+            $responses = $this->client->multi_post($url, $data, $params, $headers);
+
+            $is_success = false;
+            foreach($responses as $response){
+                $obj = $this->proccessResult($response['content']);
+
+                if(empty($obj) || !isset($obj['error_code'])){
+                    $is_success = true;
+                }
+
+                if(!$this->isCloudUser && isset($obj['error_code']) && $obj['error_code'] == 110){
+                    $authObj = $this->auth(true);
+                    $params['access_token'] = $authObj['access_token'];
+                    $responses = $this->client->post($url, $data, $params, $headers);
+                    break;
+                }
+            }
+
+            if($is_success){
+                $this->writeAuthObj($authObj);
+            }
+
+            $objs = array();
+            foreach($responses as $response){
+                $objs[] = $this->proccessResult($response['content']);
+            }
+
+        }catch(Exception $e){
+            return array(
+                'error_code' => 'SDK108',
+                'error_msg' => 'connection or read data timeout',
+            );
+        }
+
+        return $objs;
+    }
+
+    /**
+     * 格式检查
+     * @param  string $url
+     * @param  array $data
+     * @return mix
+     */
+    protected function validate($url, &$data){
+        return true;
+    }
+
+    /**
+     * 格式化结果
+     * @param $content string
+     * @return mixed
+     */
+    protected function proccessResult($content){
+        return json_decode($content, true);
+    }
+
+    /**
+     * 返回 access token 路径
+     * @return string
+     */
+    private function getAuthFilePath(){
+        return dirname(__FILE__) . DIRECTORY_SEPARATOR . md5($this->apiKey);
+    }
+
+    /**
+     * 写入本地文件
+     * @param  array $obj
+     * @return void
+     */
+    private function writeAuthObj($obj){
+        if($obj === null || (isset($obj['is_read']) && $obj['is_read'] === true)){
+            return;
+        }
+
+        $obj['time'] = time();
+        $obj['is_cloud_user'] = $this->isCloudUser;
+        @file_put_contents($this->getAuthFilePath(), json_encode($obj));
+    }
+
+    /**
+     * 读取本地缓存
+     * @return array
+     */
+    private function readAuthObj(){
+        $content = @file_get_contents($this->getAuthFilePath());
+        if($content !== false){
+            $obj = json_decode($content, true);
+            $this->isCloudUser = $obj['is_cloud_user'];
+            $obj['is_read'] = true;
+            if($this->isCloudUser || $obj['time'] + $obj['expires_in'] - 30 > time()){
+                return $obj;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * 认证
+     * @param bool $refresh 是否刷新
+     * @return array
+     */
+    private function auth($refresh=false){
+
+        //非过期刷新
+        if(!$refresh){
+            $obj = $this->readAuthObj();
+            if(!empty($obj)){
+                return $obj;
+            }
+        }
+
+        $response = $this->client->get($this->accessTokenUrl, array(
+            'grant_type' => 'client_credentials',
+            'client_id' => $this->apiKey,
+            'client_secret' => $this->secretKey,
+        ));
+        
+        $obj = json_decode($response['content'], true);
+
+        $this->isCloudUser = !$this->isPermission($obj);
+        return $obj;
+    }
+
+    /**
+     * 判断认证是否有权限
+     * @param  array   $authObj 
+     * @return boolean          
+     */
+    protected function isPermission($authObj)
+    {
+        if(empty($authObj) || !isset($authObj['scope'])){
+            return false;
+        }
+
+        $scopes = explode(' ', $authObj['scope']);
+
+        return in_array($this->scope, $scopes);
+    }
+
+    /**
+     * @param  string $method HTTP method
+     * @param  string $url
+     * @param  array $param 参数
+     * @return array
+     */
+    private function getAuthHeaders($method, $url, $params=array(), $headers=array()){
+        
+        //不是云的老用户则不用在header中签名 认证
+        if($this->isCloudUser === false){
+            return $headers;
+        }
+
+        $obj = parse_url($url);
+        if(!empty($obj['query'])){        
+            foreach(explode('&', $obj['query']) as $kv){
+                if(!empty($kv)){
+                    list($k, $v) = explode('=', $kv, 2);
+                    $params[$k] = $v;
+                }
+            }
+        }
+
+        //UTC 时间戳
+        $timestamp = gmdate('Y-m-d\TH:i:s\Z');
+        $headers['Host'] = isset($obj['port']) ? sprintf('%s:%s', $obj['host'], $obj['port']) : $obj['host'];
+        $headers['x-bce-date'] = $timestamp;
+
+        //签名
+        $headers['authorization'] = AipSampleSigner::sign(array(
+            'ak' => $this->apiKey,
+            'sk' => $this->secretKey,
+        ), $method, $obj['path'], $headers, $params, array(
+            'timestamp' => $timestamp,
+            'headersToSign' => array_keys($headers),
+        ));
+
+        return $headers;
+    }
+
+    /**
+     * 反馈
+     *
+     * @param array $feedbacks
+     * @return array
+     */
+    public function report($feedback){
+
+        $data = array();
+        
+        $data['feedback'] = $feedback;
+
+        return $this->request($this->reportUrl, $data);
+    }
+
+    /**
+     * 通用接口
+     * @param string $url
+     * @param array $data
+     * @param array header
+     * @return array
+     */
+    public function post($url, $data, $headers=array()){
+        return $this->request($url, $data, $headers);
+    }
+
+}

+ 214 - 0
addons/zh_jdgjb/baiduSdk/lib/AipHttpClient.php

xqd
@@ -0,0 +1,214 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+/**
+ * Http Client
+ */
+class AipHttpClient{
+
+    /**
+     * HttpClient
+     * @param array $headers HTTP header
+     */
+    public function __construct($headers=array()){
+        $this->headers = $this->buildHeaders($headers);
+        $this->connectTimeout = 60000;
+        $this->socketTimeout = 60000;
+        $this->conf = array();
+    }
+
+    /**
+     * 连接超时
+     * @param int $ms 毫秒
+     */
+    public function setConnectionTimeoutInMillis($ms){
+        $this->connectTimeout = $ms;
+    }
+
+    /**
+     * 响应超时
+     * @param int $ms 毫秒
+     */
+    public function setSocketTimeoutInMillis($ms){
+        $this->socketTimeout = $ms;
+    }    
+
+    /**
+     * 配置
+     * @param array $conf
+     */
+    public function setConf($conf){
+        $this->conf = $conf;
+    }
+
+    /**
+     * 请求预处理
+     * @param resource $ch
+     */
+    public function prepare($ch){
+        foreach($this->conf as $key => $value){
+            curl_setopt($ch, $key, $value);
+        }
+    }    
+
+    /**
+     * @param  string $url
+     * @param  array $data HTTP POST BODY
+     * @param  array $param HTTP URL
+     * @param  array $headers HTTP header
+     * @return array
+     */
+    public function post($url, $data=array(), $params=array(), $headers=array()){
+        $url = $this->buildUrl($url, $params);
+        $headers = array_merge($this->headers, $this->buildHeaders($headers));
+
+        $ch = curl_init();
+        $this->prepare($ch);
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_HEADER, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($data) ? http_build_query($data) : $data);
+        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout);
+        $content = curl_exec($ch);
+        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+
+        if($code === 0){
+            throw new Exception(curl_error($ch));
+        }
+
+        curl_close($ch);
+        return array(
+            'code' => $code,
+            'content' => $content,
+        );
+    }
+
+    /**
+     * @param  string $url
+     * @param  array $datas HTTP POST BODY
+     * @param  array $param HTTP URL
+     * @param  array $headers HTTP header
+     * @return array
+     */
+    public function multi_post($url, $datas=array(), $params=array(), $headers=array()){
+        $url = $this->buildUrl($url, $params);
+        $headers = array_merge($this->headers, $this->buildHeaders($headers));
+
+        $chs = array();
+        $result = array();
+        $mh = curl_multi_init();
+        foreach($datas as $data){        
+            $ch = curl_init();
+            $chs[] = $ch;
+            $this->prepare($ch);
+            curl_setopt($ch, CURLOPT_URL, $url);
+            curl_setopt($ch, CURLOPT_POST, 1);
+            curl_setopt($ch, CURLOPT_HEADER, false);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+            curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($data) ? http_build_query($data) : $data);
+            curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout);
+            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout);
+            curl_multi_add_handle($mh, $ch);
+        }
+
+        $running = null;
+        do{
+            curl_multi_exec($mh, $running);
+            usleep(100);
+        }while($running);
+
+        foreach($chs as $ch){        
+            $content = curl_multi_getcontent($ch);
+            $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+            $result[] = array(
+                'code' => $code,
+                'content' => $content,
+            );
+            curl_multi_remove_handle($mh, $ch);
+        }
+        curl_multi_close($mh);
+        
+        return $result;
+    }
+
+    /**
+     * @param  string $url
+     * @param  array $param HTTP URL
+     * @param  array $headers HTTP header
+     * @return array
+     */
+    public function get($url, $params=array(), $headers=array()){
+        $url = $this->buildUrl($url, $params);
+        $headers = array_merge($this->headers, $this->buildHeaders($headers));
+
+        $ch = curl_init();
+        $this->prepare($ch);
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_HEADER, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout);
+        $content = curl_exec($ch);
+        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+
+        if($code === 0){
+            throw new Exception(curl_error($ch));
+        }
+        
+        curl_close($ch);
+        return array(
+            'code' => $code,
+            'content' => $content,
+        );
+    }
+
+    /**
+     * 构造 header
+     * @param  array $headers
+     * @return array
+     */
+    private function buildHeaders($headers){
+        $result = array();
+        foreach($headers as $k => $v){
+            $result[] = sprintf('%s:%s', $k, $v);
+        }
+        return $result;
+    }
+
+    /**
+     * 
+     * @param  string $url
+     * @param  array $params 参数
+     * @return string
+     */
+    private function buildUrl($url, $params){
+        if(!empty($params)){
+            $str = http_build_query($params);
+            return $url . (strpos($url, '?') === false ? '?' : '&') . $str;
+        }else{
+            return $url;
+        }
+    }
+}

+ 174 - 0
addons/zh_jdgjb/cert/WxPay.Api.php

xqd
@@ -0,0 +1,174 @@
+<?php
+require_once IA_ROOT . "/addons/zh_jdgjb/cert/WxPay.Exception.php";
+require_once IA_ROOT . "/addons/zh_jdgjb/cert/WxPay.Data.php";
+
+/**
+ * 
+ * 接口访问类,包含所有微信支付API列表的封装,类中方法为static方法,
+ * 每个接口有默认超时时间(除提交被扫支付为10s,上报超时时间为1s外,其他均为6s)
+ * @author widyhu
+ *
+ */
+class WxPayApi
+{
+	/**
+	 * 
+	 * 查询订单,WxPayOrderQuery中out_trade_no、transaction_id至少填一个
+	 * appid、mchid、spbill_create_ip、nonce_str不需要填入
+	 * @param WxPayOrderQuery $inputObj
+	 * @param int $timeOut
+	 * @throws WxPayException
+	 * @return 成功时返回,其他抛异常
+	 */
+	public static function orderQuery($inputObj, $timeOut = 6,$key)
+	{
+		$url = "https://api.mch.weixin.qq.com/pay/orderquery";
+		//检测必填参数
+		if(!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
+			throw new WxPayException("订单查询接口中,out_trade_no、transaction_id至少填一个!");
+		}
+		
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		$inputObj->SetSign($key);//签名
+		$xml = $inputObj->ToXml();
+		
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, false, $timeOut,'1','2');
+		$result = WxPayResults::Init($response);
+		return $result;
+	}
+	
+	/**
+	 *
+ 	 *退款接口
+ 	 *
+  	 */
+	public static function refund($inputObj, $timeOut = 6,$f1,$f2,$key)
+
+	{
+
+		global $_W,$_GPC;
+
+		$url = "https://api.mch.weixin.qq.com/secapi/pay/refund";
+
+		//检测必填参数
+
+		if(!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) {
+
+			throw new WxPayException("退款申请接口中,out_trade_no、transaction_id至少填一个!");
+
+		}else if(!$inputObj->IsOut_refund_noSet()){
+
+			throw new WxPayException("退款申请接口中,缺少必填参数out_refund_no!");
+
+		}else if(!$inputObj->IsTotal_feeSet()){
+
+			throw new WxPayException("退款申请接口中,缺少必填参数total_fee!");
+
+		}else if(!$inputObj->IsRefund_feeSet()){
+
+			throw new WxPayException("退款申请接口中,缺少必填参数refund_fee!");
+
+		}else if(!$inputObj->IsOp_user_idSet()){
+
+			throw new WxPayException("退款申请接口中,缺少必填参数op_user_id!");
+
+		}
+		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
+		$inputObj->SetSign($key);//签名
+		$xml = $inputObj->ToXml();
+		$startTimeStamp = self::getMillisecond();//请求开始时间
+		$response = self::postXmlCurl($xml, $url, true, $timeOut,$f1,$f2);
+		$result = WxPayResults::Init($response);
+		return $result;
+	}
+
+	/**
+	 * 
+	 * 产生随机字符串,不长于32位
+	 * @param int $length
+	 * @return 产生的随机字符串
+	 */
+	public static function getNonceStr($length = 32) 
+	{
+		$chars = "abcdefghijklmnopqrstuvwxyz0123456789";  
+		$str ="";
+		for ( $i = 0; $i < $length; $i++ )  {  
+			$str .= substr($chars, mt_rand(0, strlen($chars)-1), 1);  
+		} 
+		return $str;
+	}
+	
+
+
+	/**
+	 * 以post方式提交xml到对应的接口url
+	 * 
+	 * @param string $xml  需要post的xml数据
+	 * @param string $url  url
+	 * @param bool $useCert 是否需要证书,默认不需要
+	 * @param int $second   url执行超时时间,默认30s
+	 * @throws WxPayException
+	 */
+	private static function postXmlCurl($xml, $url, $useCert, $second = 30,$f1,$f2)
+	{
+
+		
+		$ch = curl_init();
+		//设置超时
+		curl_setopt($ch, CURLOPT_TIMEOUT, $second);
+		
+//		//如果有配置代理这里就设置代理
+//		if(WxPayConfig::CURL_PROXY_HOST != "0.0.0.0" 
+//			&& WxPayConfig::CURL_PROXY_PORT != 0){
+//			curl_setopt($ch,CURLOPT_PROXY, WxPayConfig::CURL_PROXY_HOST);
+//			curl_setopt($ch,CURLOPT_PROXYPORT, WxPayConfig::CURL_PROXY_PORT);
+//		}
+		curl_setopt($ch,CURLOPT_URL, $url);
+		curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
+		curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);//严格校验
+		//设置header
+		curl_setopt($ch, CURLOPT_HEADER, FALSE);
+		//要求结果为字符串且输出到屏幕上
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+	
+		if($useCert == true){
+			//设置证书
+			//使用证书:cert 与 key 分别属于两个.pem文件
+			curl_setopt($ch,CURLOPT_SSLCERTTYPE,'PEM');
+			curl_setopt($ch,CURLOPT_SSLCERT, $f1);
+			curl_setopt($ch,CURLOPT_SSLKEYTYPE,'PEM');
+			curl_setopt($ch,CURLOPT_SSLKEY, $f2);
+		}
+		//post提交方式
+		curl_setopt($ch, CURLOPT_POST, TRUE);
+		curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
+		//运行curl
+		$data = curl_exec($ch);
+		//返回结果
+		if($data){
+			curl_close($ch);
+			return $data;
+		} else {
+			$error = curl_errno($ch);
+			curl_close($ch);
+			message("退款失败,CURL出错,错误码:".$error);exit;
+			
+//			throw new WxPayException("curl出错,错误码:$error");
+		}
+	}
+	
+	/**
+	 * 获取毫秒级别的时间戳
+	 */
+	private static function getMillisecond()
+	{
+		//获取毫秒的时间戳
+		$time = explode ( " ", microtime () );
+		$time = $time[1] . ($time[0] * 1000);
+		$time2 = explode( ".", $time );
+		$time = $time2[0];
+		return $time;
+	}
+}
+

+ 703 - 0
addons/zh_jdgjb/cert/WxPay.Data.php

xqd
@@ -0,0 +1,703 @@
+<?php
+/**
+* 2015-06-29 修复签名问题
+**/
+require_once IA_ROOT . "/addons/zh_jdgjb/cert/WxPay.Exception.php";
+
+/**
+ * 
+ * 数据对象基础类,该类中定义数据类最基本的行为,包括:
+ * 计算/设置/获取签名、输出xml格式的参数、从xml读取数据对象等
+ * @author widyhu
+ *
+ */
+class WxPayDataBase
+{
+	protected $values = array();
+	
+	/**
+	* 设置签名,详见签名生成算法
+	* @param string $value 
+	**/
+	public function SetSign($key)
+	{
+		$sign = $this->MakeSign($key);
+		$this->values['sign'] = $sign;
+		return $sign;
+	}
+	
+	/**
+	* 获取签名,详见签名生成算法的值
+	* @return 值
+	**/
+	public function GetSign()
+	{
+		return $this->values['sign'];
+	}
+	
+	/**
+	* 判断签名,详见签名生成算法是否存在
+	* @return true 或 false
+	**/
+	public function IsSignSet()
+	{
+		return array_key_exists('sign', $this->values);
+	}
+
+	/**
+	 * 输出xml字符
+	 * @throws WxPayException
+	**/
+	public function ToXml()
+	{
+		if(!is_array($this->values) 
+			|| count($this->values) <= 0)
+		{
+    		throw new WxPayException("数组数据异常!");
+    	}
+    	
+    	$xml = "<xml>";
+    	foreach ($this->values as $key=>$val)
+    	{
+    		if (is_numeric($val)){
+    			$xml.="<".$key.">".$val."</".$key.">";
+    		}else{
+    			$xml.="<".$key."><![CDATA[".$val."]]></".$key.">";
+    		}
+        }
+        $xml.="</xml>";
+        return $xml; 
+	}
+	
+    /**
+     * 将xml转为array
+     * @param string $xml
+     * @throws WxPayException
+     */
+	public function FromXml($xml)
+	{	
+		if(!$xml){
+			throw new WxPayException("xml数据异常!");
+		}
+        //将XML转为array
+        //禁止引用外部xml实体
+        libxml_disable_entity_loader(true);
+        $this->values = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);		
+		return $this->values;
+	}
+	
+	/**
+	 * 格式化参数格式化成url参数
+	 */
+	public function ToUrlParams()
+	{
+		$buff = "";
+		foreach ($this->values as $k => $v)
+		{
+			if($k != "sign" && $v != "" && !is_array($v)){
+				$buff .= $k . "=" . $v . "&";
+			}
+		}
+		
+		$buff = trim($buff, "&");
+		return $buff;
+	}
+	
+	/**
+	 * 生成签名
+	 * @return 签名,本函数不覆盖sign成员变量,如要设置签名需要调用SetSign方法赋值
+	 */
+	public function MakeSign($key)
+	{
+		//签名步骤一:按字典序排序参数
+		ksort($this->values);
+		$string = $this->ToUrlParams();
+		//签名步骤二:在string后加入KEY
+		$string = $string . "&key=".$key;
+		//签名步骤三:MD5加密
+		$string = md5($string);
+		//签名步骤四:所有字符转为大写
+		$result = strtoupper($string);
+		return $result;
+	}
+	
+	/**
+	 * 获取设置的值
+	 */
+	public function GetValues()
+	{
+		return $this->values;
+	}
+}
+/**
+ * 
+ * 订单查询输入对象
+ * @author widyhu
+ *
+ */
+class WxPayOrderQuery extends WxPayDataBase
+{
+	/**
+	* 设置微信分配的公众账号ID
+	* @param string $value 
+	**/
+	public function SetAppid($value)
+	{
+		$this->values['appid'] = $value;
+	}
+	/**
+	* 获取微信分配的公众账号ID的值
+	* @return 值
+	**/
+	public function GetAppid()
+	{
+		return $this->values['appid'];
+	}
+	/**
+	* 判断微信分配的公众账号ID是否存在
+	* @return true 或 false
+	**/
+	public function IsAppidSet()
+	{
+		return array_key_exists('appid', $this->values);
+	}
+
+
+	/**
+	* 设置微信支付分配的商户号
+	* @param string $value 
+	**/
+	public function SetMch_id($value)
+	{
+		$this->values['mch_id'] = $value;
+	}
+	/**
+	* 获取微信支付分配的商户号的值
+	* @return 值
+	**/
+	public function GetMch_id()
+	{
+		return $this->values['mch_id'];
+	}
+	/**
+	* 判断微信支付分配的商户号是否存在
+	* @return true 或 false
+	**/
+	public function IsMch_idSet()
+	{
+		return array_key_exists('mch_id', $this->values);
+	}
+
+
+	/**
+	* 设置微信的订单号,优先使用
+	* @param string $value 
+	**/
+	public function SetTransaction_id($value)
+	{
+		$this->values['transaction_id'] = $value;
+	}
+	/**
+	* 获取微信的订单号,优先使用的值
+	* @return 值
+	**/
+	public function GetTransaction_id()
+	{
+		return $this->values['transaction_id'];
+	}
+	/**
+	* 判断微信的订单号,优先使用是否存在
+	* @return true 或 false
+	**/
+	public function IsTransaction_idSet()
+	{
+		return array_key_exists('transaction_id', $this->values);
+	}
+
+
+	/**
+	* 设置商户系统内部的订单号,当没提供transaction_id时需要传这个。
+	* @param string $value 
+	**/
+	public function SetOut_trade_no($value)
+	{
+		$this->values['out_trade_no'] = $value;
+	}
+	/**
+	* 获取商户系统内部的订单号,当没提供transaction_id时需要传这个。的值
+	* @return 值
+	**/
+	public function GetOut_trade_no()
+	{
+		return $this->values['out_trade_no'];
+	}
+	/**
+	* 判断商户系统内部的订单号,当没提供transaction_id时需要传这个。是否存在
+	* @return true 或 false
+	**/
+	public function IsOut_trade_noSet()
+	{
+		return array_key_exists('out_trade_no', $this->values);
+	}
+
+
+	/**
+	* 设置随机字符串,不长于32位。推荐随机数生成算法
+	* @param string $value 
+	**/
+	public function SetNonce_str($value)
+	{
+		$this->values['nonce_str'] = $value;
+	}
+	/**
+	* 获取随机字符串,不长于32位。推荐随机数生成算法的值
+	* @return 值
+	**/
+	public function GetNonce_str()
+	{
+		return $this->values['nonce_str'];
+	}
+	/**
+	* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
+	* @return true 或 false
+	**/
+	public function IsNonce_strSet()
+	{
+		return array_key_exists('nonce_str', $this->values);
+	}
+}
+/**
+ * 
+ * 接口调用结果类
+ * @author widyhu
+ *
+ */
+class WxPayResults extends WxPayDataBase
+{
+	/**
+	 * 
+	 * 检测签名
+	 */
+	public function CheckSign()
+	{
+		//fix异常
+		if(!$this->IsSignSet()){
+			throw new WxPayException("签名错误1");
+		}
+		
+		$sign = $this->MakeSign();
+		if($this->GetSign() == $sign){
+			return true;
+		}
+		throw new WxPayException("签名错误2");
+	}
+	
+	/**
+	 * 
+	 * 使用数组初始化
+	 * @param array $array
+	 */
+	public function FromArray($array)
+	{
+		$this->values = $array;
+	}
+	
+	/**
+	 * 
+	 * 使用数组初始化对象
+	 * @param array $array
+	 * @param 是否检测签名 $noCheckSign
+	 */
+	public static function InitFromArray($array, $noCheckSign = false)
+	{
+		$obj = new self();
+		$obj->FromArray($array);
+		if($noCheckSign == false){
+		}
+        return $obj;
+	}
+	
+	/**
+	 * 
+	 * 设置参数
+	 * @param string $key
+	 * @param string $value
+	 */
+	public function SetData($key, $value)
+	{
+		$this->values[$key] = $value;
+	}
+	
+    /**
+     * 将xml转为array
+     * @param string $xml
+     * @throws WxPayException
+     */
+	public static function Init($xml)
+	{	
+		$obj = new self();
+		$obj->FromXml($xml);
+		//fix bug 2015-06-29
+		if($obj->values['return_code'] != 'SUCCESS'){
+			 return $obj->GetValues();
+		}
+        return $obj->GetValues();
+	}
+}
+
+/**
+ * 
+ * 回调基础类
+ * @author widyhu
+ *
+ */
+class WxPayNotifyReply extends  WxPayDataBase
+{
+	/**
+	 * 
+	 * 设置错误码 FAIL 或者 SUCCESS
+	 * @param string
+	 */
+	public function SetReturn_code($return_code)
+	{
+		$this->values['return_code'] = $return_code;
+	}
+	
+	/**
+	 * 
+	 * 获取错误码 FAIL 或者 SUCCESS
+	 * @return string $return_code
+	 */
+	public function GetReturn_code()
+	{
+		return $this->values['return_code'];
+	}
+
+	/**
+	 * 
+	 * 设置错误信息
+	 * @param string $return_code
+	 */
+	public function SetReturn_msg($return_msg)
+	{
+		$this->values['return_msg'] = $return_msg;
+	}
+	
+	/**
+	 * 
+	 * 获取错误信息
+	 * @return string
+	 */
+	public function GetReturn_msg()
+	{
+		return $this->values['return_msg'];
+	}
+	
+	/**
+	 * 
+	 * 设置返回参数
+	 * @param string $key
+	 * @param string $value
+	 */
+	public function SetData($key, $value)
+	{
+		$this->values[$key] = $value;
+	}
+}
+
+
+
+
+/**
+ * 
+ * 提交退款输入对象
+ * @author widyhu
+ *
+ */
+class WxPayRefund extends WxPayDataBase
+{
+	/**
+	* 设置微信分配的公众账号ID
+	* @param string $value 
+	**/
+	public function SetAppid($value)
+	{
+		$this->values['appid'] = $value;
+	}
+	/**
+	* 获取微信分配的公众账号ID的值
+	* @return 值
+	**/
+	public function GetAppid()
+	{
+		return $this->values['appid'];
+	}
+	/**
+	* 判断微信分配的公众账号ID是否存在
+	* @return true 或 false
+	**/
+	public function IsAppidSet()
+	{
+		return array_key_exists('appid', $this->values);
+	}
+
+
+	/**
+	* 设置微信支付分配的商户号
+	* @param string $value 
+	**/
+	public function SetMch_id($value)
+	{
+		$this->values['mch_id'] = $value;
+	}
+	/**
+	* 获取微信支付分配的商户号的值
+	* @return 值
+	**/
+	public function GetMch_id()
+	{
+		return $this->values['mch_id'];
+	}
+	/**
+	* 判断微信支付分配的商户号是否存在
+	* @return true 或 false
+	**/
+	public function IsMch_idSet()
+	{
+		return array_key_exists('mch_id', $this->values);
+	}
+
+
+	/**
+	* 设置微信支付分配的终端设备号,与下单一致
+	* @param string $value 
+	**/
+	public function SetDevice_info($value)
+	{
+		$this->values['device_info'] = $value;
+	}
+	/**
+	* 获取微信支付分配的终端设备号,与下单一致的值
+	* @return 值
+	**/
+	public function GetDevice_info()
+	{
+		return $this->values['device_info'];
+	}
+	/**
+	* 判断微信支付分配的终端设备号,与下单一致是否存在
+	* @return true 或 false
+	**/
+	public function IsDevice_infoSet()
+	{
+		return array_key_exists('device_info', $this->values);
+	}
+
+
+	/**
+	* 设置随机字符串,不长于32位。推荐随机数生成算法
+	* @param string $value 
+	**/
+	public function SetNonce_str($value)
+	{
+		$this->values['nonce_str'] = $value;
+	}
+	/**
+	* 获取随机字符串,不长于32位。推荐随机数生成算法的值
+	* @return 值
+	**/
+	public function GetNonce_str()
+	{
+		return $this->values['nonce_str'];
+	}
+	/**
+	* 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
+	* @return true 或 false
+	**/
+	public function IsNonce_strSet()
+	{
+		return array_key_exists('nonce_str', $this->values);
+	}
+
+	/**
+	* 设置微信订单号
+	* @param string $value 
+	**/
+	public function SetTransaction_id($value)
+	{
+		$this->values['transaction_id'] = $value;
+	}
+	/**
+	* 获取微信订单号的值
+	* @return 值
+	**/
+	public function GetTransaction_id()
+	{
+		return $this->values['transaction_id'];
+	}
+	/**
+	* 判断微信订单号是否存在
+	* @return true 或 false
+	**/
+	public function IsTransaction_idSet()
+	{
+		return array_key_exists('transaction_id', $this->values);
+	}
+
+
+	/**
+	* 设置商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no
+	* @param string $value 
+	**/
+	public function SetOut_trade_no($value)
+	{
+		$this->values['out_trade_no'] = $value;
+	}
+	/**
+	* 获取商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no的值
+	* @return 值
+	**/
+	public function GetOut_trade_no()
+	{
+		return $this->values['out_trade_no'];
+	}
+	/**
+	* 判断商户系统内部的订单号,transaction_id、out_trade_no二选一,如果同时存在优先级:transaction_id> out_trade_no是否存在
+	* @return true 或 false
+	**/
+	public function IsOut_trade_noSet()
+	{
+		return array_key_exists('out_trade_no', $this->values);
+	}
+
+
+	/**
+	* 设置商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔
+	* @param string $value 
+	**/
+	public function SetOut_refund_no($value)
+	{
+		$this->values['out_refund_no'] = $value;
+	}
+	/**
+	* 获取商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔的值
+	* @return 值
+	**/
+	public function GetOut_refund_no()
+	{
+		return $this->values['out_refund_no'];
+	}
+	/**
+	* 判断商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔是否存在
+	* @return true 或 false
+	**/
+	public function IsOut_refund_noSet()
+	{
+		return array_key_exists('out_refund_no', $this->values);
+	}
+
+
+	/**
+	* 设置订单总金额,单位为分,只能为整数,详见支付金额
+	* @param string $value 
+	**/
+	public function SetTotal_fee($value)
+	{
+		$this->values['total_fee'] = $value;
+	}
+	/**
+	* 获取订单总金额,单位为分,只能为整数,详见支付金额的值
+	* @return 值
+	**/
+	public function GetTotal_fee()
+	{
+		return $this->values['total_fee'];
+	}
+	/**
+	* 判断订单总金额,单位为分,只能为整数,详见支付金额是否存在
+	* @return true 或 false
+	**/
+	public function IsTotal_feeSet()
+	{
+		return array_key_exists('total_fee', $this->values);
+	}
+
+
+	/**
+	* 设置退款总金额,订单总金额,单位为分,只能为整数,详见支付金额
+	* @param string $value 
+	**/
+	public function SetRefund_fee($value)
+	{
+		$this->values['refund_fee'] = $value;
+	}
+	/**
+	* 获取退款总金额,订单总金额,单位为分,只能为整数,详见支付金额的值
+	* @return 值
+	**/
+	public function GetRefund_fee()
+	{
+		return $this->values['refund_fee'];
+	}
+	/**
+	* 判断退款总金额,订单总金额,单位为分,只能为整数,详见支付金额是否存在
+	* @return true 或 false
+	**/
+	public function IsRefund_feeSet()
+	{
+		return array_key_exists('refund_fee', $this->values);
+	}
+
+
+	/**
+	* 设置货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
+	* @param string $value 
+	**/
+	public function SetRefund_fee_type($value)
+	{
+		$this->values['refund_fee_type'] = $value;
+	}
+	/**
+	* 获取货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型的值
+	* @return 值
+	**/
+	public function GetRefund_fee_type()
+	{
+		return $this->values['refund_fee_type'];
+	}
+	/**
+	* 判断货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型是否存在
+	* @return true 或 false
+	**/
+	public function IsRefund_fee_typeSet()
+	{
+		return array_key_exists('refund_fee_type', $this->values);
+	}
+
+
+	/**
+	* 设置操作员帐号, 默认为商户号
+	* @param string $value 
+	**/
+	public function SetOp_user_id($value)
+	{
+		$this->values['op_user_id'] = $value;
+	}
+	/**
+	* 获取操作员帐号, 默认为商户号的值
+	* @return 值
+	**/
+	public function GetOp_user_id()
+	{
+		return $this->values['op_user_id'];
+	}
+	/**
+	* 判断操作员帐号, 默认为商户号是否存在
+	* @return true 或 false
+	**/
+	public function IsOp_user_idSet()
+	{
+		return array_key_exists('op_user_id', $this->values);
+	}
+}
+

+ 13 - 0
addons/zh_jdgjb/cert/WxPay.Exception.php

xqd
@@ -0,0 +1,13 @@
+<?php
+/**
+ * 
+ * 微信支付API异常类
+ * @author widyhu
+ *
+ */
+class WxPayException extends Exception {
+	public function errorMessage()
+	{
+		return $this->getMessage();
+	}
+}

+ 85 - 0
addons/zh_jdgjb/cert/WxPay.Notify.php

xqd
@@ -0,0 +1,85 @@
+<?php
+/**
+ * 
+ * 回调基础类
+ * @author widyhu
+ *
+ */
+class WxPayNotify extends WxPayNotifyReply
+{
+	/**
+	 * 
+	 * 回调入口
+	 * @param bool $needSign  是否需要签名输出
+	 */
+	final public function Handle($needSign = true)
+	{
+		$msg = "OK";
+		//当返回false的时候,表示notify中调用NotifyCallBack回调失败获取签名校验失败,此时直接回复失败
+		$result = WxpayApi::notify(array($this, 'NotifyCallBack'), $msg);
+		if($result == false){
+			$this->SetReturn_code("FAIL");
+			$this->SetReturn_msg($msg);
+			$this->ReplyNotify(false);
+			return;
+		} else {
+			//该分支在成功回调到NotifyCallBack方法,处理完成之后流程
+			$this->SetReturn_code("SUCCESS");
+			$this->SetReturn_msg("OK");
+		}
+		$this->ReplyNotify($needSign);
+	}
+	
+	/**
+	 * 
+	 * 回调方法入口,子类可重写该方法
+	 * 注意:
+	 * 1、微信回调超时时间为2s,建议用户使用异步处理流程,确认成功之后立刻回复微信服务器
+	 * 2、微信服务器在调用失败或者接到回包为非确认包的时候,会发起重试,需确保你的回调是可以重入
+	 * @param array $data 回调解释出的参数
+	 * @param string $msg 如果回调处理失败,可以将错误信息输出到该方法
+	 * @return true回调出来完成不需要继续回调,false回调处理未完成需要继续回调
+	 */
+	public function NotifyProcess($data, &$msg)
+	{
+		//TODO 用户基础该类之后需要重写该方法,成功的时候返回true,失败返回false
+		return true;
+	}
+	
+	/**
+	 * 
+	 * notify回调方法,该方法中需要赋值需要输出的参数,不可重写
+	 * @param array $data
+	 * @return true回调出来完成不需要继续回调,false回调处理未完成需要继续回调
+	 */
+	final public function NotifyCallBack($data)
+	{
+		$msg = "OK";
+		$result = $this->NotifyProcess($data, $msg);
+		
+		if($result == true){
+			$this->SetReturn_code("SUCCESS");
+			$this->SetReturn_msg("OK");
+		} else {
+			$this->SetReturn_code("FAIL");
+			$this->SetReturn_msg($msg);
+		}
+		return $result;
+	}
+	
+	/**
+	 * 
+	 * 回复通知
+	 * @param bool $needSign 是否需要签名输出
+	 */
+	final private function ReplyNotify($needSign = true)
+	{
+		//如果需要签名
+		if($needSign == true && 
+			$this->GetReturn_code($return_code) == "SUCCESS")
+		{
+			$this->SetSign();
+		}
+		WxpayApi::replyNotify($this->ToXml());
+	}
+}

+ 26 - 0
addons/zh_jdgjb/cert/apiclient_cert_64.pem

xqd
@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEbDCCA9WgAwIBAgIEAWg0NDANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC
+Q04xEjAQBgNVBAgTCUd1YW5nZG9uZzERMA8GA1UEBxMIU2hlbnpoZW4xEDAOBgNV
+BAoTB1RlbmNlbnQxDDAKBgNVBAsTA1dYRzETMBEGA1UEAxMKTW1wYXltY2hDQTEf
+MB0GCSqGSIb3DQEJARYQbW1wYXltY2hAdGVuY2VudDAeFw0xNzA5MDcxMDUwMjFa
+Fw0yNzA5MDUxMDUwMjFaMIGbMQswCQYDVQQGEwJDTjESMBAGA1UECBMJR3Vhbmdk
+b25nMREwDwYDVQQHEwhTaGVuemhlbjEQMA4GA1UEChMHVGVuY2VudDEOMAwGA1UE
+CxMFTU1QYXkxMDAuBgNVBAMUJ+atpuaxieW4guW/l+axh+e9kee7nOenkeaKgOac
+iemZkOWFrOWPuDERMA8GA1UEBBMINTAxOTU5NjQwggEiMA0GCSqGSIb3DQEBAQUA
+A4IBDwAwggEKAoIBAQCqZPHnf8SZ2J8DGYjh9mH0f5QFzWMWYSMHjokRyC9Ufy2j
+3SEnQUM4FvlYW8a4NCKhPYri5oeDFb5J5MkJL4ibeR3x1L0e/6YcfzL9HK63DVVy
+r/Ar7RXDgqlZYavXLAiBAkNV22bjwmXXojDq/upm0FrGMRbJ/AKqMH8h+iKrI0pS
+T/MPq/9FPWuh4WwPQEEDEaPutpMvE62rrzgLbjqGxNQIFxRVzhfGaW251bbqEZ0l
+bljbV7LUCjq2WKtGuPH1iM2Ea/G+CstteuZhbyRhydKvVX+r/5VILlziI62f5G44
+8bK1ihOBG4QU88WPwoSpq+v6YagthhST+a426EJfAgMBAAGjggFGMIIBQjAJBgNV
+HRMEAjAAMCwGCWCGSAGG+EIBDQQfFh0iQ0VTLUNBIEdlbmVyYXRlIENlcnRpZmlj
+YXRlIjAdBgNVHQ4EFgQURmKpIQWEjg+g50uWXbcf1ZjQgGMwgb8GA1UdIwSBtzCB
+tIAUPgUm9iJitBVbiM1kfrDUYqflhnShgZCkgY0wgYoxCzAJBgNVBAYTAkNOMRIw
+EAYDVQQIEwlHdWFuZ2RvbmcxETAPBgNVBAcTCFNoZW56aGVuMRAwDgYDVQQKEwdU
+ZW5jZW50MQwwCgYDVQQLEwNXWEcxEzARBgNVBAMTCk1tcGF5bWNoQ0ExHzAdBgkq
+hkiG9w0BCQEWEG1tcGF5bWNoQHRlbmNlbnSCCQC7VJcrvADoVzAOBgNVHQ8BAf8E
+BAMCBsAwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADgYEA
+Ge8hCnBxB8hyQz4E/+EiGS9FGORqn2jxdFSD6ULNz9tMzj2aGwPVHw0Pf3BjdWXt
+73nlf1dJsVKJ9DD22KLfnsqA6zCH0jMATAg78yUCMSWYu1lHMGLJLeg24Bwf09no
+M3G7ob+fXgrbL+AKSv5ZD14uEZA2XRPFvZJZQzUKuHc=
+-----END CERTIFICATE-----

+ 28 - 0
addons/zh_jdgjb/cert/apiclient_key_64.pem

xqd
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCqZPHnf8SZ2J8D
+GYjh9mH0f5QFzWMWYSMHjokRyC9Ufy2j3SEnQUM4FvlYW8a4NCKhPYri5oeDFb5J
+5MkJL4ibeR3x1L0e/6YcfzL9HK63DVVyr/Ar7RXDgqlZYavXLAiBAkNV22bjwmXX
+ojDq/upm0FrGMRbJ/AKqMH8h+iKrI0pST/MPq/9FPWuh4WwPQEEDEaPutpMvE62r
+rzgLbjqGxNQIFxRVzhfGaW251bbqEZ0lbljbV7LUCjq2WKtGuPH1iM2Ea/G+Cstt
+euZhbyRhydKvVX+r/5VILlziI62f5G448bK1ihOBG4QU88WPwoSpq+v6YagthhST
++a426EJfAgMBAAECggEAb9EkidVnr8net4sHL7memHMsMQ6SKrp94VShEIE8xgdb
+bQAM5JTIRsOUx24anwDfhM49GR9M6DHZmOZBIv0FeXlmtC72GKSNXn/+duleohNm
+8ocQZdMEiDNzbItS2DY2MmrIw0viXi5Q5MuzrFKygdvS5eKK4Ou21/ZRR3u9Sm4g
+LS0z+/8WfBkttYg6CK30wv5/J4pZLNXit8kxC8uDmG3rKEhM7zvCKZa/9gLRwe1y
+ekxXEbUVghSp74MWX47pgAbom6fc2MlWmawdzuzv45ZKeDiDLfGx64/fUwBCeukT
+xphAjQFlWXCkPds8AZqUPzkVr/G+zRuq35I7J2xE0QKBgQDimOmU9F3HpzjtCP+z
+gaHp4MsIBcO3lFXIWqbgHgIsIgmb+by3n9tVmscYgNJYB3rJZyOOdvsMocNvsbPx
+aZMfFTKAmL2LTKj0kTchKKE+5IHn9EdihEBWJ3oT6mksehNC/Cye4erMvlMzXzIW
+jNQm77S0Qip4+DL/uBUfOv3vCQKBgQDAgRY3SgIx3Cz/IbTrO8cC5OXZlXMeUz1g
+qR/c5RdX9gRxgKyhcPjpOQ02i3sNqhxGNLHeQVw1Gn7FOzK64kPlQIoPTwanueyn
+2/gCg8WWfAMQVGdvXN/BDUbFcQsZRnab8Dnpojdxyuhgn8JZ5DHc1O262POsJYeb
+S5FBMVAYJwKBgQCuCD8t9dio5JfmBUlN9rwCQnHtAXBl6HlR3b3Y13NXrfSvZMk6
+Rn5QawWKnjXvAh+d26cFXgBGnV7axCKtwSYLc15MQgMhn4kL/RPYVbox8ZKMMaM5
+2NUI1lz+OsT4MfHlOoSSqnSJN4vzIqP3icXO+b9RypeQPR/+IsWmLMqm8QKBgQCH
+HVOphOGbe219uXvRq8hYSK7nlFUTkNtAsBQ0J/vFemDOBcGlIrUihS+3/Bhnk+F6
+iVvaoseEYk9eQdmugEelbjI44n/KU94+R0+A/Fo/8FT6LjPXXzmRt67XwCtJF0MC
+2o7bZEdEMGYAA8IW8+rnk/A0ODh3uHPA1T5joqgT+wKBgEdqF7MPt8vdFo1wPQ6+
+lNIUmm5Xmh9SsJXrgVmrcfc8Q95OP/UpPMh3o7N+VyeAcozy5i9UC/Qs1dR1ppmz
+vLjRERHTupNsdzW6f7tYSR0vaVUnnZdLsNcxax/Y+pvlPPu+RDCbd6Zy2+tsjKae
+6Laq2eiD5tyI4oPhqdA9Q2zJ
+-----END PRIVATE KEY-----

+ 19 - 0
addons/zh_jdgjb/cert/rootca.pem

xqd
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV
+UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy
+dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1
+MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx
+dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B
+AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f
+BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A
+cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC
+AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ
+MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm
+aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw
+ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj
+IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF
+MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA
+A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y
+7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh
+1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4
+-----END CERTIFICATE-----

+ 1 - 0
addons/zh_jdgjb/developer.cer

xqd
@@ -0,0 +1 @@
+AA14A135D2A43FF1057719DA8424A6A9KYU7C0RPRGBBPL7UR6

+ 47 - 0
addons/zh_jdgjb/distance/config.php

xqd
@@ -0,0 +1,47 @@
+<?php
+
+ 
+ return $arr = [
+            "weChat" => [
+                "id" => "weChat",
+                "img" => "/theme/manage/img/channel-wechat.png",
+                "name" => "微信公众号",
+                "check" => true
+            ],
+            "mini" => [
+                "id" => "mini",
+                "img" => "/theme/manage/img/channel-mini.png",
+                "name" => "微信小程序",
+                "check" => true
+            ],
+            "H5" => [
+                "id" => "H5",
+                "img" => "/theme/manage/img/channel-h5.png",
+                "name" => "H5",
+                "check" => true
+            ],
+            "baiDu" => [
+                "id" => "baiDu",
+                "img" => "/theme/manage/img/channel-baidu.png",
+                "name" => "百度小程序",
+                "check" => true
+            ],
+            "zfb" => [
+                "id" => "zfb",
+                "img" => "/theme/manage/img/channel-alipay.png",
+                "name" => "支付宝小程序",
+                "check" => true
+            ],
+            "APP" => [
+                "id" => "APP",
+                "img" => "/theme/manage/img/channel-app.png",
+                "name" => "APP",
+                "check" => true
+            ],
+            "PC" => [
+                "id" => "PC",
+                "img" => "/theme/manage/img/channel-pc.png",
+                "name" => "PC",
+                "check" => true
+            ],
+        ];

+ 168 - 0
addons/zh_jdgjb/distance/distance.php

xqd
@@ -0,0 +1,168 @@
+<?php
+//if(!$_GET['longitude'] || !$_GET['latitude']) exit('-1');
+
+// longitude 经度
+// latitude 维度
+
+
+ 
+class Convert{
+    private $PI = 3.14159265358979324;
+    private $x_pi = 0;
+ 
+    public function __construct()
+    {
+        $this->x_pi = 3.14159265358979324 * 3000.0 / 180.0;
+    }
+ 
+    /**
+     * 判断一个坐标是否在圆内
+     * 思路:判断此点的经纬度到圆心的距离  然后和半径做比较
+     * 如果此点刚好在圆上 则返回true
+     * @param $point ['lng'=>'','lat'=>''] array指定点的坐标
+     * @param $circle array ['center'=>['lng'=>'','lat'=>''],'radius'=>'']  中心点和半径
+     */
+    function is_point_in_circle($point, $circle){
+ 
+        $distance = $this -> distance($point['lat'],$point['lng'],$circle['center']['lat'],$circle['center']['lng']);
+        if($distance <= $circle['radius']){
+            return true;
+        }else{
+            return false;
+        }
+    }
+ 
+ 
+    /**
+     *  计算两个点之间的距离
+     * @param $latA  第一个点的纬度
+     * @param $lonA  第一个点的经度
+     * @param $latB  第二个点的纬度
+     * @param $lonB  第二个点的经度
+     * @return float
+     */
+    function distance($latA, $lonA, $latB, $lonB)
+    {
+        $earthR = 6371000.;
+        $x = cos($latA * $this->PI / 180.) * cos($latB * $this->PI / 180.) * cos(($lonA - $lonB) * $this->PI / 180);
+        $y = sin($latA * $this->PI / 180.) * sin($latB * $this->PI / 180.);
+        $s = $x + $y;
+        if ($s > 1) $s = 1;
+        if ($s < -1) $s = -1;
+        $alpha = acos($s);
+        $distance = $alpha * $earthR;
+        return $distance;
+    }
+ 
+ 
+    /**
+     * 判断一个坐标是否在一个多边形内(由多个坐标围成的)
+     * 基本思想是利用射线法,计算射线与多边形各边的交点,如果是偶数,则点在多边形外,否则
+     * 在多边形内。还会考虑一些特殊情况,如点在多边形顶点上,点在多边形边上等特殊情况。
+     * @param $point 指定点坐标
+     * @param $pts 多边形坐标 顺时针方向
+     */
+    function is_point_in_polygon($point, $pts) {
+        $N = count($pts);
+        $boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
+        $intersectCount = 0;//cross points count of x
+        $precision = 2e-10; //浮点类型计算时候与0比较时候的容差
+        $p1 = 0;//neighbour bound vertices
+        $p2 = 0;
+        $p = $point; //测试点
+ 
+        $p1 = $pts[0];//left vertex
+        for ($i = 1; $i <= $N; ++$i) {//check all rays
+            // dump($p1);
+            if ($p['lng'] == $p1['lng'] && $p['lat'] == $p1['lat']) {
+                return $boundOrVertex;//p is an vertex
+            }
+ 
+            $p2 = $pts[$i % $N];//right vertex
+            if ($p['lat'] < min($p1['lat'], $p2['lat']) || $p['lat'] > max($p1['lat'], $p2['lat'])) {//ray is outside of our interests
+                $p1 = $p2;
+                continue;//next ray left point
+            }
+ 
+            if ($p['lat'] > min($p1['lat'], $p2['lat']) && $p['lat'] < max($p1['lat'], $p2['lat'])) {//ray is crossing over by the algorithm (common part of)
+                if($p['lng'] <= max($p1['lng'], $p2['lng'])){//x is before of ray
+                    if ($p1['lat'] == $p2['lat'] && $p['lng'] >= min($p1['lng'], $p2['lng'])) {//overlies on a horizontal ray
+                        return $boundOrVertex;
+                    }
+ 
+                    if ($p1['lng'] == $p2['lng']) {//ray is vertical
+                        if ($p1['lng'] == $p['lng']) {//overlies on a vertical ray
+                            return $boundOrVertex;
+                        } else {//before ray
+                            ++$intersectCount;
+                        }
+                    } else {//cross point on the left side
+                        $xinters = ($p['lat'] - $p1['lat']) * ($p2['lng'] - $p1['lng']) / ($p2['lat'] - $p1['lat']) + $p1['lng'];//cross point of lng
+                        if (abs($p['lng'] - $xinters) < $precision) {//overlies on a ray
+                            return $boundOrVertex;
+                        }
+ 
+                        if ($p['lng'] < $xinters) {//before ray
+                            ++$intersectCount;
+                        }
+                    }
+                }
+            } else {//special case when ray is crossing through the vertex
+                if ($p['lat'] == $p2['lat'] && $p['lng'] <= $p2['lng']) {//p crossing over p2
+                    $p3 = $pts[($i+1) % $N]; //next vertex
+                    if ($p['lat'] >= min($p1['lat'], $p3['lat']) && $p['lat'] <= max($p1['lat'], $p3['lat'])) { //p.lat lies between p1.lat & p3.lat
+                        ++$intersectCount;
+                    } else {
+                        $intersectCount += 2;
+                    }
+                }
+            }
+            $p1 = $p2;//next ray left point
+        }
+ 
+        if ($intersectCount % 2 == 0) {//偶数在多边形外
+            return false;
+        } else { //奇数在多边形内
+            return true;
+        }
+    }
+}
+ 
+
+ 
+//$point = ['lng'=>$_GET['longitude'],'lat'=>$_GET['latitude']];
+
+/*$circle = [
+    'center'=>['lng'=>116.12637,'lat'=>40.114308],
+    'radius'=>46807.83038795571
+];*/
+ 
+//$convert = new Convert();
+//$bool = $convert -> is_point_in_circle($point,$circle);
+//var_dump($bool);
+ 
+/*$pts = [
+    ['lng'=>108.326212, 'lat'=>22.891039],
+    ['lng'=>108.274757, 'lat'=>22.890107],
+    ['lng'=>108.22359, 'lat'=>22.856143],
+	['lng'=>108.235304, 'lat'=>22.791654],
+	['lng'=>108.247449, 'lat'=>22.769528],
+	['lng'=>108.276697, 'lat'=>22.755665],
+	['lng'=>108.323769, 'lat'=>22.754065],
+	['lng'=>108.334189, 'lat'=>22.722067],
+	['lng'=>108.390531, 'lat'=>22.7332],
+	['lng'=>108.441986, 'lat'=>22.761664],
+	['lng'=>108.497609, 'lat'=>22.787922],
+	['lng'=>108.494375, 'lat'=>22.821637],
+	['lng'=>108.446441, 'lat'=>22.819638],
+	['lng'=>108.42711, 'lat'=>22.85128],
+	['lng'=>108.375295, 'lat'=>22.878187],
+	['lng'=>108.326217, 'lat'=>22.891035],
+	['lng'=>108.326203, 'lat'=>22.891039],
+	['lng'=>108.326203, 'lat'=>22.891039],
+	['lng'=>108.326203, 'lat'=>22.891039]
+];*/
+ 
+//$point = ['lng'=>115.989864,'lat'=>39.973272];
+//$bool = $convert -> is_point_in_polygon($point,$pts);
+//var_dump($bool);

+ 23 - 0
addons/zh_jdgjb/errorCode.php

xqd
@@ -0,0 +1,23 @@
+<?php

+

+/**

+ * error code 说明.

+ * <ul>

+

+ *    <li>-41001: encodingAesKey 非法</li>

+ *    <li>-41003: aes 解密失败</li>

+ *    <li>-41004: 解密后得到的buffer非法</li>

+ *    <li>-41005: base64加密失败</li>

+ *    <li>-41016: base64解密失败</li>

+ * </ul>

+ */

+class ErrorCode

+{

+	public static $OK = 0;

+	public static $IllegalAesKey = -41001;

+	public static $IllegalIv = -41002;

+	public static $IllegalBuffer = -41003;

+	public static $DecodeBase64Error = -41004;

+}

+

+?>

BIN
addons/zh_jdgjb/icon.jpg


BIN
addons/zh_jdgjb/img/5.jpeg


BIN
addons/zh_jdgjb/img/6.jpg


BIN
addons/zh_jdgjb/img/7.jpg


BIN
addons/zh_jdgjb/img/hl.jpg


+ 1078 - 0
addons/zh_jdgjb/inc/func/core.php

xqd
@@ -0,0 +1,1078 @@
+<?php
+defined('IN_IA') or exit ('Access Denied');
+class Core extends WeModuleSite
+{
+
+    public function getMainMenu()
+    {
+        global $_W, $_GPC;
+        $type=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']),array('open_member','is_score'));
+        $do = $_GPC['do'];
+        $navemenu = array();
+        $cur_color = ' style="color:#d9534f;" '; 
+          if ($_W['role'] == 'operator') {
+            $navemenu[8] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=hotel&m=zh_jdgjb" class="panel-title wytitle" id="yframe-8"><icon style="color:#8d8d8d;" class="fa fa-cart-plus"></icon>  酒店管理</a>',
+                'items' => array(
+                    0 => $this->createMainMenu('门店列表', $do, 'hotel','')
+                )
+            );}elseif($_W['isfounder'] || $_W['role'] == 'manager') {
+        $navemenu[14] = array(
+
+            'title' => '<a href="index.php?c=site&a=entry&op=display&do=ptdata&m=zh_jdgjb" class="panel-title wytitle" id="yframe-14"><icon style="color:#8d8d8d;" class="fa fa-newspaper-o"></icon>  数据概况</a>',
+            'items' => array(
+               0 => $this->createMainMenu('数据展示 ', $do, 'ptdata', ''),
+               1 => $this->createMainMenu('账号管理 ', $do, 'account', ''),
+               2 => $this->createMainMenu('账号添加 ', $do, 'addaccount', ''),
+               )
+            );
+        $navemenu[8] = array(
+            'title' => '<a href="index.php?c=site&a=entry&op=display&do=hotel&m=zh_jdgjb" class="panel-title wytitle" id="yframe-8"><icon style="color:#8d8d8d;" class="fa fa-cart-plus"></icon>  酒店管理</a>',
+            'items' => array(
+                 0 => $this->createMainMenu('酒店列表 ', $do, 'hotel', ''),
+                 1=> $this->createMainMenu('添加酒店', $do, 'addhotel', ''),
+                 2=> $this->createMainMenu('入驻审核', $do, 'auditorhotel', ''),
+        
+            )
+        );
+        $navemenu[17] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=nav&m=zh_jdgjb" class="panel-title wytitle" id="yframe-17"><icon style="color:#8d8d8d;" class="fa fa-compass"></icon>导航管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('导航管理 ', $do, 'nav', ''),
+                     1=> $this->createMainMenu('添加导航', $do, 'addnav', ''),
+                    
+                   
+                )
+            );
+          $navemenu[2] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=ad&m=zh_jdgjb" class="panel-title wytitle" id="yframe-2"><icon style="color:#8d8d8d;" class="fa fa-gift"></icon>广告管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('广告管理 ', $do, 'ad', ''),
+                     1=> $this->createMainMenu('添加广告', $do, 'addad', ''),
+                )
+            );
+         $navemenu[18] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=order&m=zh_jdgjb" class="panel-title wytitle" id="yframe-18"><icon style="color:#8d8d8d;" class="fa fa-server"></icon>订单管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('订单管理 ', $do, 'order', ''),
+                    
+                    
+                   
+                )
+            );
+       $navemenu[6] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=coupon&m=zh_jdgjb" class="panel-title wytitle" id="yframe-6"><icon style="color:#8d8d8d;" class="fa fa-bars"></icon>优惠券管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('优惠券管理 ', $do, 'coupon', ''),
+                     1 => $this->createMainMenu('添加优惠券 ', $do, 'addcoupon', ''),
+                )
+            );   
+    if($type['is_score']==1){          
+        $navemenu[20] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=jftype&m=zh_jdgjb" class="panel-title wytitle" id="yframe-20"><icon style="color:#8d8d8d;" class="fa fa-star-half-o"></icon>  积分商城</a>',
+                'items' => array(
+                    0 => $this->createMainMenu('商品列表', $do, 'jfgoods', ''),
+                    1 => $this->createMainMenu('商品分类', $do, 'jftype', ''),
+                    2 => $this->createMainMenu('积分设置', $do, 'score', ''),
+                    3 => $this->createMainMenu('兑换列表', $do, 'dhlist', ''),
+                )
+            );
+        }
+           
+     if($type['open_member']==1){                      
+       $navemenu[1] = array(
+            'title' => '<a href="index.php?c=site&a=entry&op=display&do=memberlevel&m=zh_jdgjb" class="panel-title wytitle" id="yframe-1"><icon style="color:#8d8d8d;" class="fa fa-money"></icon>  会员等级</a>',
+            'items' => array(
+                 0 => $this->createMainMenu('等级管理 ', $do, 'memberlevel', ''),
+                 1=> $this->createMainMenu('添加等级', $do, 'addmemberlevel', ''),
+                 2=> $this->createMainMenu('会员列表', $do, 'member', ''),
+            )
+        );
+   }
+         $navemenu[9] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=fxlist&m=zh_jdgjb" class="panel-title wytitle" id="yframe-9"><icon style="color:#8d8d8d;" class="fa fa-users"></icon>  分销系统</a>',
+                'items' => array(
+                    0 => $this->createMainMenu('分销商管理', $do, 'fxlist', ''),
+                    1 => $this->createMainMenu('分销设置', $do, 'fxset', ''),
+                    2 => $this->createMainMenu('提现管理', $do, 'fxtx', ''),
+                    //3 => $this->createMainMenu('提现设置', $do, 'fxtxsz', ''),
+                )
+            );
+
+        
+     
+          /* $navemenu[10] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=sponsor&m=zh_jdgjb" class="panel-title wytitle" id="yframe-10"><icon style="color:#8d8d8d;" class="fa fa-users"></icon> 主办方管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('主办方管理 ', $do, 'sponsor', ''),
+                     1=> $this->createMainMenu('认证管理 ', $do, 'attestation', ''),
+                     2=> $this->createMainMenu('认证设置 ', $do, 'rzcheck', ''),
+                    
+                )
+            );*/
+
+          $navemenu[3] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=txlist&m=zh_jdgjb" class="panel-title wytitle" id="yframe-3"><icon style="color:#8d8d8d;" class="fa fa-money"></icon>  提现管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('提现列表 ', $do, 'txlist', ''),
+                     1 => $this->createMainMenu('提现设置 ', $do, 'txsz', ''),
+                     2 => $this->createMainMenu('充值优惠 ', $do, 'chongzhi', ''),
+                     3 => $this->createMainMenu('充值记录 ', $do, 'czjl', ''),
+                )
+            );
+           
+            $navemenu[4] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=user2&m=zh_jdgjb" class="panel-title wytitle" id="yframe-4"><icon style="color:#8d8d8d;" class="fa fa-user"></icon>  用户管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('用户列表 ', $do, 'user2', ''),
+                )
+            );         
+            $navemenu[5] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=settings&m=zh_jdgjb" class="panel-title wytitle" id="yframe-5"><icon style="color:#8d8d8d;" class="fa fa-cog"></icon>  系统设置</a>',
+                'items' => array(
+                    0 => $this->createMainMenu('基本信息 ', $do, 'settings', ''),
+                    1 => $this->createMainMenu('小程序配置', $do, 'peiz', ''),
+                    2 => $this->createMainMenu('支付配置', $do, 'pay', ''), 
+                    // 3 => $this->createMainMenu('积分设置', $do, 'score', ''),
+                    4 => $this->createMainMenu('短信配置', $do, 'sms', ''),
+                    5 => $this->createMainMenu('模板消息配置', $do, 'news', ''),                  
+                    //6 => $this->createMainMenu('提现设置', $do, 'txset', ''),
+                    7 => $this->createMainMenu('版权设置', $do, 'copyright', ''),                   
+                    
+                )
+            );
+          }
+     
+        return $navemenu;
+    }
+
+
+
+      public function getMainMenu2()
+    {
+        global $_W, $_GPC;
+        $do = $_GPC['do'];
+        $navemenu = array();
+        $cur_color = ' style="color:#d9534f;" '; 
+        $navemenu[14] = array(
+            'title' => '<a href="index.php?c=site&a=entry&op=display&do=statistics&m=zh_jdgjb" class="panel-title wytitle" id="yframe-14"><icon style="color:#8d8d8d;" class="fa fa-newspaper-o"></icon>  门店信息</a>',
+            'items' => array(
+                0 => $this->createMainMenu('首页概览', $do, 'statistics', ''),
+               1 => $this->createMainMenu('门店信息 ', $do, 'storeinfo', ''),
+               )
+            );
+        $navemenu[8] = array(
+            'title' => '<a href="index.php?c=site&a=entry&op=display&do=room&m=zh_jdgjb" class="panel-title wytitle" id="yframe-8"><icon style="color:#8d8d8d;" class="fa fa-cart-plus"></icon>房型管理</a>',
+            'items' => array(
+                
+                 3 => $this->createMainMenu('房型管理 ', $do, 'room', ''),
+                 4 => $this->createMainMenu('房型添加 ', $do, 'addroom', ''),
+        
+            )
+        );
+         $navemenu[12] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=inorder&m=zh_jdgjb" class="panel-title wytitle" id="yframe-12"><icon style="color:#8d8d8d;" class="fa fa-cog"></icon> 订单管理</a>',
+                'items' => array(
+                     2 => $this->createMainMenu('订单管理 ', $do, 'inorder', ''),
+                    
+                )
+            );
+        $navemenu[17] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=number&m=zh_jdgjb" class="panel-title wytitle" id="yframe-17"><icon style="color:#8d8d8d;" class="fa fa-compass"></icon>酒店维护</a>',
+                'items' => array(
+                     2 => $this->createMainMenu('房量维护 ', $do, 'number', ''),
+                     3 => $this->createMainMenu('房价维护 ', $do, 'price', ''),
+                    
+                   
+                )
+            );
+         $navemenu[18] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=incoupon&m=zh_jdgjb" class="panel-title wytitle" id="yframe-18"><icon style="color:#8d8d8d;" class="fa fa-bars"></icon>优惠券管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('优惠券管理 ', $do, 'incoupon', ''),
+                    1 => $this->createMainMenu('优惠券添加 ', $do, 'inaddcoupon', ''),
+                    
+                    
+                   
+                )
+            );
+         $navemenu[10] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=assess&m=zh_jdgjb" class="panel-title wytitle" id="yframe-10"><icon style="color:#8d8d8d;" class="fa fa-user"></icon> 评论管理</a>',
+                'items' => array(
+                     0 => $this->createMainMenu('评论管理 ', $do, 'assess', ''),
+                    
+                    
+                )
+                ); 
+       $navemenu[6] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=txdetails&m=zh_jdgjb" class="panel-title wytitle" id="yframe-6"><icon style="color:#8d8d8d;" class="fa fa-bars"></icon>提现管理</a>',
+                'items' => array(
+                    0 => $this->createMainMenu('提现明细 ', $do, 'txdetails', ''),
+                    1 => $this->createMainMenu('申请提现 ', $do, 'txapply', '')
+                )
+            );   
+                           
+           
+            $navemenu[4] = array(
+                'title' => '<a href="index.php?c=site&a=entry&op=display&do=print&m=zh_jdgjb" class="panel-title wytitle" id="yframe-4"><icon style="color:#8d8d8d;" class="fa fa-cog"></icon>  消息设置</a>',
+                'items' => array(
+                       0 => $this->createMainMenu('打印提醒 ', $do, 'print', ''),
+                       1 => $this->createMainMenu('短信提醒 ', $do, 'notice', ''),
+                )
+            );         
+      
+     
+        return $navemenu;
+    }
+
+
+     public function getNaveMenu($storeid='', $action='',$uid='')
+    {
+        global $_W, $_GPC;
+        $account=pdo_get('zh_jdgjb_account',array('storeid'=>$storeid,'uid'=>$uid));
+        $do = $_GPC['do'];
+        $navemenu = array();
+        $cur_color = '#8d8d8d';
+          if($account['role']==1){
+        $navemenu[0] = array(
+             'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlstatistics&m=zh_jdgjb" class="panel-title wytitle" id="yframe-0"><icon style="color:#8d8d8d;" class="fa fa-newspaper-o"></icon>  门店信息</a>',
+            'items' => array(
+                0 => $this->createSubMenu('首页概览', $do, 'dlstatistics', 'fa-angle-right', $cur_color, $storeid),
+                1 => $this->createSubMenu('门店信息 ', $do, 'dlstoreinfo', 'fa-angle-right', $cur_color, $storeid),
+               
+            ),
+            'icon' => 'fa fa-user-md'
+        );
+        $cur_color = '#8d8d8d';
+        $navemenu[1] = array(
+            'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlroom&m=zh_jdgjb" class="panel-title wytitle" id="yframe-1"><icon style="color:#8d8d8d;" class="fa fa-cart-plus"></icon>房型管理</a>',
+           
+            'items' => array(
+                0 => $this->createSubMenu('房型管理 ', $do, 'dlroom', $cur_color, $storeid),
+                1 => $this->createSubMenu('房型添加 ', $do, 'dladdroom', 'fa-angle-right', $cur_color, $storeid),
+              
+            )
+           
+        );
+        $cur_color = '#8d8d8d';
+        $navemenu[2] = array(
+           'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlinorder&m=zh_jdgjb" class="panel-title wytitle" id="yframe-2"><icon style="color:#8d8d8d;" class="fa fa-cog"></icon> 订单管理</a>',
+            'items' => array(
+                0 => $this->createSubMenu('订单管理 ', $do, 'dlinorder', 'fa-angle-right', $cur_color, $storeid),
+               
+            )
+        );
+
+        $cur_color = '#8d8d8d';
+
+            $navemenu[3] = array(
+               'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlnumber&m=zh_jdgjb" class="panel-title wytitle" id="yframe-3"><icon style="color:#8d8d8d;" class="fa fa-compass"></icon>酒店维护</a>',
+                'items' => array(
+                    0 => $this->createSubMenu('房量维护 ', $do, 'dlnumber', $cur_color, $storeid),
+                    1 => $this->createSubMenu('房价维护 ', $do, 'dlprice', 'fa-angle-right', $cur_color, $storeid),
+                ),
+            );
+   
+        
+        $cur_color = '#8d8d8d';
+        $navemenu[4] = array(
+           'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlincoupon&m=zh_jdgjb" class="panel-title wytitle" id="yframe-4"><icon style="color:#8d8d8d;" class="fa fa-bars"></icon>优惠券管理</a>',
+            'items' => array(
+                0 => $this->createSubMenu('优惠券管理 ', $do, 'dlincoupon', 'fa-angle-right', $cur_color, $storeid),
+                1 => $this->createSubMenu('优惠券添加 ', $do, 'dlinaddcoupon', 'fa-angle-right', $cur_color, $storeid),
+            )
+        );
+
+        $cur_color = '#8d8d8d';
+        $navemenu[5] = array(
+            'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlassess&m=zh_jdgjb" class="panel-title wytitle" id="yframe-5"><icon style="color:#8d8d8d;" class="fa fa-user"></icon> 评论管理</a>',
+            'items' => array(
+                0 => $this->createSubMenu('评论管理 ', $do, 'dlassess', 'fa-angle-right', $cur_color, $storeid),
+            )
+        );
+         $navemenu[7] = array(
+                'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dltxdetails&m=zh_jdgjb" class="panel-title wytitle" id="yframe-7"><icon style="color:#8d8d8d;" class="fa fa-bars"></icon>提现管理</a>',
+                'items' => array(
+                    0 => $this->createSubMenu('提现明细 ', $do, 'dltxdetails', ''),
+                    1 => $this->createSubMenu('申请提现 ', $do, 'dltxapply', '')
+                )
+            );   
+        $cur_color = '#8d8d8d';
+        $navemenu[6] = array(
+              'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlprint&m=zh_jdgjb" class="panel-title wytitle" id="yframe-6"><icon style="color:#8d8d8d;" class="fa fa-cog"></icon>  消息设置</a>',
+            'items' => array(
+                0 => $this->createSubMenu('打印提醒 ', $do, 'dlprint', 'fa-angle-right', $cur_color, $storeid),
+                1 => $this->createSubMenu('短信提醒 ', $do, 'dlnotice', 'fa-angle-right', $cur_color, $storeid),
+                
+            )
+        );
+            $navemenu[14] = array(
+
+            'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlaccount&m=zh_jdgjb" class="panel-title wytitle" id="yframe-14"><icon style="color:#8d8d8d;" class="fa fa-newspaper-o"></icon>  账号管理</a>',
+            'items' => array(
+        
+               1 => $this->createSubMenu('账号管理 ', $do, 'dlaccount', ''),
+               2 => $this->createSubMenu('账号添加 ', $do, 'dladdaccount', ''),
+               )
+            );
+
+        }else{
+        	$arr=explode(',',$account['authority']);
+        	foreach ($arr as $key => $value) {
+        		if( $value=='dlstatistics'){
+        			$navemenu[0] = array(
+        				'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlstatistics&m=zh_jdgjb" class="panel-title wytitle" id="yframe-0"><icon style="color:#8d8d8d;" class="fa fa-newspaper-o"></icon>  门店信息</a>',
+        				'items' => array(
+        					0 => $this->createSubMenu('首页概览', $do, 'dlstatistics', 'fa-angle-right', $cur_color, $storeid),
+        					1 => $this->createSubMenu('门店信息 ', $do, 'dlstoreinfo', 'fa-angle-right', $cur_color, $storeid),
+
+        					),
+        				'icon' => 'fa fa-user-md'
+        				);
+        		}
+        		if( $value=='dlroom'){
+        			$navemenu[1] = array(
+        				'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlroom&m=zh_jdgjb" class="panel-title wytitle" id="yframe-1"><icon style="color:#8d8d8d;" class="fa fa-cart-plus"></icon>房型管理</a>',
+        				'items' => array(
+        					0 => $this->createSubMenu('房型管理 ', $do, 'dlroom', $cur_color, $storeid),
+        					1 => $this->createSubMenu('房型添加 ', $do, 'dladdroom', 'fa-angle-right', $cur_color, $storeid),
+
+        					)
+
+        				);
+        		}
+        		if( $value=='dlinorder'){
+        			$navemenu[2] = array(
+        				'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlinorder&m=zh_jdgjb" class="panel-title wytitle" id="yframe-2"><icon style="color:#8d8d8d;" class="fa fa-cog"></icon> 订单管理</a>',
+        				'items' => array(
+        					0 => $this->createSubMenu('订单管理 ', $do, 'dlinorder', 'fa-angle-right', $cur_color, $storeid),
+
+        					)
+        				);
+        		}                  
+        		if( $value=='dlnumber'){
+        			$navemenu[3] = array(
+        				'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlnumber&m=zh_jdgjb" class="panel-title wytitle" id="yframe-3"><icon style="color:#8d8d8d;" class="fa fa-compass"></icon>酒店维护</a>',
+        				'items' => array(
+        					0 => $this->createSubMenu('房量维护 ', $do, 'dlnumber', $cur_color, $storeid),
+        					1 => $this->createSubMenu('房价维护 ', $do, 'dlprice', 'fa-angle-right', $cur_color, $storeid),
+        					),
+        				);
+        		}  
+        		if( $value=='dlincoupon'){
+        			$navemenu[4] = array(
+        				'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlincoupon&m=zh_jdgjb" class="panel-title wytitle" id="yframe-4"><icon style="color:#8d8d8d;" class="fa fa-bars"></icon>优惠券管理</a>',
+        				'items' => array(
+        					0 => $this->createSubMenu('优惠券管理 ', $do, 'dlincoupon', 'fa-angle-right', $cur_color, $storeid),
+        					1 => $this->createSubMenu('优惠券添加 ', $do, 'dlinaddcoupon', 'fa-angle-right', $cur_color, $storeid),
+        					)
+        				);
+        		}  
+        		if( $value=='dlassess'){
+        			$navemenu[5] = array(
+        				'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlassess&m=zh_jdgjb" class="panel-title wytitle" id="yframe-5"><icon style="color:#8d8d8d;" class="fa fa-user"></icon> 评论管理</a>',
+        				'items' => array(
+        					0 => $this->createSubMenu('评论管理 ', $do, 'dlassess', 'fa-angle-right', $cur_color, $storeid),
+        					)
+        				);
+        		}   
+        		if( $value=='dltxdetails'){
+        			$navemenu[7] = array(
+        				'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dltxdetails&m=zh_jdgjb" class="panel-title wytitle" id="yframe-7"><icon style="color:#8d8d8d;" class="fa fa-bars"></icon>提现管理</a>',
+        				'items' => array(
+        					0 => $this->createSubMenu('提现明细 ', $do, 'dltxdetails', ''),
+        					1 => $this->createSubMenu('申请提现 ', $do, 'dltxapply', '')
+        					)
+        				);  
+        		}   
+        		if( $value=='dlprint'){
+        			$navemenu[6] = array(
+        				'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlprint&m=zh_jdgjb" class="panel-title wytitle" id="yframe-6"><icon style="color:#8d8d8d;" class="fa fa-cog"></icon>  消息设置</a>',
+        				'items' => array(
+        					0 => $this->createSubMenu('打印提醒 ', $do, 'dlprint', 'fa-angle-right', $cur_color, $storeid),
+        					1 => $this->createSubMenu('短信提醒 ', $do, 'dlnotice', 'fa-angle-right', $cur_color, $storeid),
+
+        					)
+        				);
+        		}      
+        		if( $value=='dlaccount'){
+        		$navemenu[14] = array(
+
+        			'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do=dlaccount&m=zh_jdgjb" class="panel-title wytitle" id="yframe-14"><icon style="color:#8d8d8d;" class="fa fa-newspaper-o"></icon>  账号管理</a>',
+        			'items' => array(
+
+        				1 => $this->createSubMenu('账号管理 ', $do, 'dlaccount', ''),
+        				2 => $this->createSubMenu('账号添加 ', $do, 'dladdaccount', ''),
+        				)
+        			);
+        	}  
+
+        }
+
+        //       if(!empty($arr1)){
+        //         foreach($arr1 as $key=> $value) {
+        //             if(strpos($value['url'],'dlstatistics')){
+        //                 $nav='dlstatistics';
+        //                 break;
+        //             }
+        //              if(strpos($value['url'],'dlstoreinfo')){
+        //                 $nav='dlstoreinfo';
+        //                 break;
+        //             }
+        //         }  
+        //       // echo $nav;die;
+        //     $navemenu[0] = array(
+        //      'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do='.$nav.'&m=zh_jdgjb" class="panel-title wytitle" id="yframe-0"><icon style="color:#8d8d8d;" class="fa fa-newspaper-o"></icon>  门店信息</a>',
+        //     'items' => $arr1,
+        //     'icon' => 'fa fa-user-md',
+        //      );
+        // }
+        //    if(!empty($arr2)){
+        //       foreach($arr2 as $key=> $value) {
+        //             if(strpos($value['url'],'dlroom')){
+        //                 $nav='dlroom';
+        //                 break;
+        //             }
+        //              if(strpos($value['url'],'dladdroom')){
+        //                 $nav='dladdroom';
+        //                 break;
+        //             }
+        //         }  
+        //     $navemenu[1] = array(
+        //      'title' => '<a href="zhjd.php?c=site&a=entry&op=display&do='.$nav.'&m=zh_jdgjb" class="panel-title wytitle" id="yframe-0"><icon style="color:#8d8d8d;" class="fa fa-newspaper-o"></icon>  房型管理</a>',
+        //     'items' => $arr2,
+        //     'icon' => 'fa fa-user-md',
+        //      );
+        // }
+
+        }
+        return $navemenu;
+    }
+
+    function createWebUrl2($do, $query = array()) {
+        $query['do'] = $do;
+        $query['m'] = strtolower($this->modulename);
+        
+        return $this->wurl('site/entry', $query);
+    }
+
+    function wurl($segment, $params = array()) {
+      
+        list($controller, $action, $do) = explode('/', $segment);
+        $url = './zhjd.php?';
+        if (!empty($controller)) {
+            $url .= "c={$controller}&";
+        }
+        if (!empty($action)) {
+            $url .= "a={$action}&";
+        }
+        if (!empty($do)) {
+            $url .= "do={$do}&";
+        }
+        if (!empty($params)) {
+            $queryString = http_build_query($params, '', '&');
+            $url .= $queryString;
+        }
+        return $url;
+    }
+
+    function createCoverMenu($title, $method, $op, $icon = "fa-image", $color = '#d9534f')
+    {
+        global $_GPC, $_W;
+        $cur_op = $_GPC['op'];
+        $color = ' style="color:'.$color.';" ';
+        return array('title' => $title, 'url' => $op != $cur_op ? $this->createWebUrl($method, array('op' => $op)) : '',
+            'active' => $op == $cur_op ? ' active' : '',
+            'append' => array(
+                'title' => '<i class="fa fa-angle-right"></i>',
+                )
+            );
+    }
+
+    function createMainMenu($title, $do, $method, $icon = "fa-image", $color = '')
+    {
+        $color = ' style="color:'.$color.';" ';
+
+        return array('title' => $title, 'url' => $do != $method ? $this->createWebUrl($method, array('op' => 'display')) : '',
+            'active' => $do == $method ? ' active' : '',
+            'append' => array(
+                'title' => '<i '.$color.' class="fa fa-angle-right"></i>',
+                )
+            );
+    }
+
+/*    function createSubMenu($title, $do, $method, $icon = "fa-image", $color = '#d9534f', $storeid)
+    {
+        $color = ' style="color:'.$color.';" ';
+        $url = $this->createWebUrl($method, array('op' => 'display', 'storeid' => $storeid));
+        if ($method == 'stores') {
+            $url = $this->createWebUrl('stores', array('op' => 'post', 'id' => $storeid, 'storeid' => $storeid));
+        }
+
+        return array('title' => $title, 'url' => $do != $method ? $url : '',
+            'active' => $do == $method ? ' active' : '',
+            'append' => array(
+                'title' => '<i class="fa '.$icon.'"></i>',
+            )
+        );
+    }*/
+    function createSubMenu($title, $do, $method, $icon = "fa-image", $color = '#d9534f')
+    {
+        $color = ' style="color:'.$color.';" ';
+        $url = $this->createWebUrl2($method, array('op' => 'display'));
+        if ($method == 'stores2') {
+            $url = $this->createWebUrl2('stores2', array('op' => 'post', 'id' => $storeid));
+        }
+        return array('title' => $title, 'url' => $do != $method ? $url : '',
+            'active' => $do == $method ? ' active' : '',
+            'append' => array(
+                'title' => '<i class="fa '.$icon.'"></i>',
+                )
+            );
+    }
+
+      //获取商家信息
+      public function getStoreById($id)
+    {
+        $store = pdo_fetch("SELECT * FROM " . tablename('zh_jdgjb_seller') . " WHERE id=:id LIMIT 1", array(':id' => $id));
+        return $store;
+    }
+
+
+    public function set_tabbar($action, $storeid)
+    {
+        $actions_titles = $this->actions_titles;
+        $html = '<ul class="nav nav-tabs">';
+        foreach ($actions_titles as $key => $value) {
+            if ($key == 'stores') {
+                $url = $this->createWebUrl('stores', array('op' => 'post', 'id' => $storeid));
+            } else {
+                $url = $this->createWebUrl($key, array('op' => 'display', 'storeid' => $storeid));
+            }
+
+            $html .= '<li class="' . ($key == $action ? 'active' : '') . '"><a href="' . $url . '">' . $value . '</a></li>';
+        }
+        $html .= '</ul>';
+        return $html;
+    }
+
+    public   function getSon($pid ,$arr){
+        $newarr=array();
+        foreach ($arr as $key => $value) {
+            if($pid==$value['type_id']){
+                $newarr[]=$value; 
+                continue;                     
+            }      
+        }
+        return $newarr;
+        
+    }
+
+    function getLevel($members,$xf_money){     
+       for($i=0;$i<count($members);$i++){
+          if($xf_money>=$members[$i]['value']){
+            return  $members[$i]['id'];       
+        }
+        if($xf_money<$members[$i]['value']&&$xf_money>$members[$i+1]['value']){
+            return $members[$i+1]['id'];
+        }
+    }
+}
+
+function getScore($order_id){   
+    global $_W, $_GPC;
+    $orderInfo=pdo_get('zh_jdgjb_order',array('id'=>$order_id));
+    $scoreInfo=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $score= floor($orderInfo['dis_cost']*$scoreInfo['xf_score']);
+    return $score;
+
+}
+
+function saveScore($order_id,$user_id,$score){   
+    global $_W, $_GPC;
+    $data['user_id']=$user_id;
+    $data['order_id']=$order_id;
+    $data['score']=$score;
+    $data['note']='购物所得';
+    $data['time']=time();
+    $data['uniacid']=$_W['uniacid'];
+    $rst=pdo_insert('zh_jdgjb_score',$data);
+    return $rst;
+
+}
+
+  //退款
+public function wxrefund($order_id){
+    global $_W, $_GPC;
+    include_once IA_ROOT . '/addons/zh_jdgjb/cert/WxPay.Api.php';
+    load()->model('account');
+    load()->func('communication');
+    $refund_order =pdo_get('zh_jdgjb_order',array('id'=>$order_id));  
+    $WxPayApi = new WxPayApi();
+    $input = new WxPayRefund();
+    $path_cert = IA_ROOT . "/addons/zh_jdgjb/cert/".'apiclient_cert_' .$_W['uniacid'] . '.pem';
+    $path_key = IA_ROOT . "/addons/zh_jdgjb/cert/".'apiclient_key_' . $_W['uniacid'] . '.pem';
+    $account_info = $_W['account'];   
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $appid=$res['appid'];
+    $key=$res['wxkey'];
+    $mchid=$res['mchid']; 
+    $out_trade_no=$refund_order['out_trade_no'];
+    $fee = $refund_order['total_cost'] * 100;
+    $input->SetAppid($appid);
+    $input->SetMch_id($mchid);
+    $input->SetOp_user_id($mchid);
+    $input->SetRefund_fee($fee);
+    $input->SetTotal_fee($fee);
+           // $input->SetTransaction_id($refundid);
+    $input->SetOut_refund_no($refund_order['order_no']);
+    $input->SetOut_trade_no($out_trade_no);
+    $result = $WxPayApi->refund($input, 6, $path_cert, $path_key, $key);
+    return $result;
+}
+
+//入住模板消息
+public function rzMessage($order_id){
+  global $_W, $_GPC;
+  function getaccess_token($_W){
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $appid=$res['appid'];
+    $secret=$res['appsecret'];
+    $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret."";
+    $ch = curl_init();
+    curl_setopt($ch, CURLOPT_URL,$url);
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+    $data = curl_exec($ch);
+    curl_close($ch);
+    $data = json_decode($data,true);
+    return $data['access_token'];
+}
+
+   //设置与发送模板信息
+function set_msg($_W,$order_id){
+    $access_token = getaccess_token($_W);
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $sql="select a.*,b.tel as seller_tel from " . tablename("zh_jdgjb_order")."a left join".tablename('zh_jdgjb_seller')."b on a.seller_id=b.id WHERE a.id=:order_id  ";
+    $list=pdo_fetch($sql,array(':order_id'=>$order_id));
+    $userInfo=pdo_get('zh_jdgjb_user',array('id'=>$list['user_id']),'openid');
+        // var_dump($userInfo);die;
+    $time1=substr($list['arrival_time'],0,10);
+        //下面是要填充模板的信息
+    $formwork ='{
+      "touser": "'.$userInfo["openid"].'",
+      "template_id": "'.$res["rz_tid"].'",
+      "form_id":"'.$list['from_id'].'",
+      "data": {
+        "keyword1": {
+          "value": "'.$list['seller_name'].'",
+          "color": "#173177"
+      },
+      "keyword2": {
+          "value": "'. $list['room_type'].'",
+          "color": "#173177"
+      },
+      "keyword3": {
+          "value": "'.$list['name'].'",
+          "color": "#173177"
+      },
+      "keyword4": {
+          "value":  "'.$time1.'",
+          "color": "#173177"
+      },
+      "keyword5": {
+          "value": "'.$list['seller_tel'].'",
+          "color": "#173177"
+      },
+      "keyword6": {
+          "value":  "'.$list['seller_address'].'",
+          "color": "#173177"
+      }
+      
+  }
+}';
+$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=".$access_token."";
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL,$url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+curl_setopt($ch, CURLOPT_POST,1);
+curl_setopt($ch, CURLOPT_POSTFIELDS,$formwork);
+$data = curl_exec($ch);
+curl_close($ch);
+       // return $data;
+
+}
+echo set_msg($_W,$order_id);
+}
+
+
+//入住模板消息
+public function jjrzMessage($order_id){
+  global $_W, $_GPC;
+  function getaccess_token($_W){
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $appid=$res['appid'];
+    $secret=$res['appsecret'];
+    $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret."";
+    $ch = curl_init();
+    curl_setopt($ch, CURLOPT_URL,$url);
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+    $data = curl_exec($ch);
+    curl_close($ch);
+    $data = json_decode($data,true);
+    return $data['access_token'];
+}
+
+   //设置与发送模板信息
+function set_msg($_W,$order_id){
+    $access_token = getaccess_token($_W);
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $sql="select a.*,b.tel as seller_tel from " . tablename("zh_jdgjb_order")."a left join".tablename('zh_jdgjb_seller')."b on a.seller_id=b.id WHERE a.id=:order_id  ";
+    $list=pdo_fetch($sql,array(':order_id'=>$order_id));
+    $userInfo=pdo_get('zh_jdgjb_user',array('id'=>$list['user_id']),'openid');
+    $content="商家暂时无法接单!";
+         
+    $time=date('Y-m-d H:i',time());
+        //下面是要填充模板的信息
+    $formwork ='{
+      "touser": "'.$userInfo["openid"].'",
+      "template_id": "'.$res["jjrz_tid"].'",
+      "form_id":"'.$list['from_id'].'",
+      "data": {
+        "keyword1": {
+          "value": "'. $content.'",
+          "color": "#173177"
+      },
+      "keyword2": {
+          "value": "'. $time.'",
+          "color": "#173177"
+      },
+      "keyword3": {
+          "value": "'.$list['total_cost'].'",
+          "color": "#173177"
+      },
+      "keyword4": {
+          "value":  "'.$list['seller_name'].'",
+          "color": "#173177"
+      },
+      "keyword5": {
+          "value": "'.$list['seller_tel'].'",
+          "color": "#173177"
+      },
+      "keyword6": {
+          "value":  "'.$list['order_no'].'",
+          "color": "#173177"
+      }
+      
+  }
+}';
+$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=".$access_token."";
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL,$url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+curl_setopt($ch, CURLOPT_POST,1);
+curl_setopt($ch, CURLOPT_POSTFIELDS,$formwork);
+$data = curl_exec($ch);
+curl_close($ch);
+       // return $data;
+
+}
+echo set_msg($_W,$order_id);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//余额退还
+public function saveRecharge($order_id){
+    global $_W, $_GPC;
+    $orderInfo=pdo_get('zh_jdgjb_order',array('id'=>$order_id));
+    $data['user_id']=$orderInfo['user_id'];
+    $data['cz_money']=$orderInfo['total_cost'];
+    $data['note']='订单退款';
+    $data['state']=2;
+    $data['time']=time();
+    $data['uniacid']=$_W['uniacid'];
+    $res=pdo_insert('zh_jdgjb_recharge',$data);
+    if($res){
+        return'1';
+    }else{
+        return '2';
+    }
+}
+
+
+//修改房间数量
+
+public function roomNum($order_id){
+    global $_W, $_GPC;
+    $order=pdo_get('zh_jdgjb_order',array('id'=>$order_id));
+        //修改房间数量
+    $dt_start = strtotime(substr($order['arrival_time'],0,10));  
+    $dt_end = strtotime(substr($order['departure_time'],0,10));
+    while ($dt_start<$dt_end){
+        $dateday=$dt_start;
+        $res=pdo_get('zh_jdgjb_roomnum',array('rid'=>$order['room_id'],'dateday'=>$dateday));
+        if($res['id']){
+            $nums=$res['nums']-$order['num'];
+            pdo_update('zh_jdgjb_roomnum',array('nums'=>$nums),array('rid'=>$order['room_id'],'dateday'=>$dateday));
+        }else{
+            $uniacid=$_W['uniacid'];    
+            $roomArr=pdo_get('zh_jdgjb_room',array('id'=>$order['room_id'],'uniacid'=>$order['uniacid']),array('total_num','id'));
+            $nums=$roomArr['total_num']-$order['num'];
+            pdo_insert('zh_jdgjb_roomnum',array('nums'=>$nums,'rid'=>$roomArr['id'],'dateday'=>$dateday));
+        }
+        $dt_start = strtotime('+1 day',$dt_start);
+    }
+}
+
+
+
+//确认订单模板消息
+public function queryOrderMessage($order_id){
+  global $_W, $_GPC;
+  function getaccess_token($_W){
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+
+    $appid=$res['appid'];
+    $secret=$res['appsecret'];
+    $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret."";
+    $ch = curl_init();
+    curl_setopt($ch, CURLOPT_URL,$url);
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+    $data = curl_exec($ch);
+    curl_close($ch);
+    $data = json_decode($data,true);
+    return $data['access_token'];
+}
+
+   //设置与发送模板信息
+function set_msg($_W,$order_id){
+    $access_token = getaccess_token($_W);
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $sql="select a.*,b.tel as seller_tel from " . tablename("zh_jdgjb_order")."a left join".tablename('zh_jdgjb_seller')."b on a.seller_id=b.id WHERE a.id=:order_id  ";
+    $list=pdo_fetch($sql,array(':order_id'=>$order_id));
+    $userInfo=pdo_get('zh_jdgjb_user',array('id'=>$list['user_id']),'openid');
+        // var_dump($userInfo);die;
+    $time1=substr($list['arrival_time'],0,10);
+    $time2=substr($list['departure_time'],0,10);
+        //下面是要填充模板的信息
+    $formwork ='{
+      "touser": "'.$userInfo["openid"].'",
+      "template_id": "'.$res["tid3"].'",
+      "form_id":"'.$list['qr_fromid'].'",
+      "data": {
+        "keyword1": {
+          "value": "'.$list['order_no'].'",
+          "color": "#173177"
+      },
+      "keyword2": {
+          "value": "'.$list['seller_name'].'",
+          "color": "#173177"
+      },
+      "keyword3": {
+          "value": "订单已确认",
+          "color": "#173177"
+      },
+      "keyword4": {
+          "value": "'. $time1.'",
+          "color": "#173177"
+      },
+      "keyword5": {
+          "value":"'. $time2.'",
+          "color": "#173177"
+      }
+  
+  }
+}';
+$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=".$access_token."";
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL,$url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+curl_setopt($ch, CURLOPT_POST,1);
+curl_setopt($ch, CURLOPT_POSTFIELDS,$formwork);
+$data = curl_exec($ch);
+curl_close($ch);
+//return $data;
+
+}
+echo set_msg($_W,$order_id);
+}
+
+
+//拒绝订单模板消息
+public function rejectOrderMessage($order_id){
+  global $_W, $_GPC;
+  function getaccess_token($_W){
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $appid=$res['appid'];
+    $secret=$res['appsecret'];
+    $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret."";
+    $ch = curl_init();
+    curl_setopt($ch, CURLOPT_URL,$url);
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+    $data = curl_exec($ch);
+    curl_close($ch);
+    $data = json_decode($data,true);
+    return $data['access_token'];
+}
+
+   //设置与发送模板信息
+function set_msg($_W,$order_id){
+    $access_token = getaccess_token($_W);
+    $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+    $sql="select a.*,b.tel as seller_tel from " . tablename("zh_jdgjb_order")."a left join".tablename('zh_jdgjb_seller')."b on a.seller_id=b.id WHERE a.id=:order_id  ";
+    $list=pdo_fetch($sql,array(':order_id'=>$order_id));
+    $userInfo=pdo_get('zh_jdgjb_user',array('id'=>$list['user_id']),'openid');
+        // var_dump($userInfo);die;
+    $time1=substr($list['arrival_time'],0,10);
+        //下面是要填充模板的信息
+    $formwork ='{
+      "touser": "'.$userInfo["openid"].'",
+      "template_id": "'.$res["tid4"].'",
+      "form_id":"'.$list['qr_fromid'].'",
+      "data": {
+        "keyword1": {
+          "value": "很抱歉,房型已满无法提供服务",
+          "color": "#173177"
+      },
+      "keyword2": {
+          "value": "'. $list['order_no'].'",
+          "color": "#173177"
+      },
+      "keyword3": {
+          "value": "'.$time1.'",
+          "color": "#173177"
+      },
+      "keyword4": {
+          "value": "'.$list['name'].'",
+          "color": "#173177"
+      },
+      "keyword5": {
+          "value": "'.$list['seller_name'].'",
+          "color": "#173177"
+      },
+      "keyword6": {
+          "value":  "'.$list['seller_address'].'",
+          "color": "#173177"
+      },
+       "keyword7": {
+          "value":  "'.$list['seller_tel'].'",
+          "color": "#173177"
+      }
+      
+  }
+}';
+$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=".$access_token."";
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL,$url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+curl_setopt($ch, CURLOPT_POST,1);
+curl_setopt($ch, CURLOPT_POSTFIELDS,$formwork);
+$data = curl_exec($ch);
+curl_close($ch);
+return $data;
+
+}
+echo set_msg($_W,$order_id);
+}
+
+
+public function getaccess_token(){
+        global $_GPC, $_W;
+        $tokenName='access_token'.$_W['uniacid'];
+        $timeName='access_token_time'.$_W['uniacid'];
+        load()->classs('wesession');
+        WeSession::start($_W['uniacid'], CLIENT_IP);
+        if($_SESSION[$timeName]<time() || !$_SESSION[$tokenName]){
+            $res=pdo_get('zh_jdgjb_system',array('uniacid'=>$_W['uniacid']));
+            $appid=$res['appid'];
+            $secret=$res['appsecret'];
+            $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret."";
+            $ch = curl_init();
+            curl_setopt($ch, CURLOPT_URL,$url);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
+            $data = curl_exec($ch);
+            curl_close($ch);
+            $data = json_decode($data,true);
+            $_SESSION[$tokenName]=$data['access_token'];
+            $_SESSION[$timeName]=time()+300;
+            return $data['access_token'];
+        }else{
+            return $_SESSION[$tokenName];
+        }
+        
+    }
+    public function httpRequest($url,$data = null){
+            $curl = curl_init();
+            curl_setopt($curl, CURLOPT_URL, $url);
+            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
+            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
+            if (!empty($data)){
+                curl_setopt($curl, CURLOPT_POST, 1);
+                curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
+            }
+            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+    //执行
+            $output = curl_exec($curl);
+            curl_close($curl);
+            return $output;
+        }
+    //查找模板的关键词列表
+    public function getKeyword($id){
+        global $_GPC, $_W;
+        $url='https://api.weixin.qq.com/cgi-bin/wxopen/template/library/get?access_token='.$this->getaccess_token();
+        $formWork = '{
+            "id": "' . $id . '"
+        }';
+        $data = $this->httpRequest($url, $formWork);
+        return json_decode($data,true)['keyword_list'];
+    }
+    //生成模板
+    public function generateTemplate($id,$keyword_id_list){
+        global $_GPC, $_W;
+        $key=$this->getKeyword($id);
+        $list=[];
+        for($i=0;$i<count($keyword_id_list);$i++){
+            
+            for($k=0;$k<count($key);$k++){
+                if($keyword_id_list[$i]==$key[$k]['name']){
+                    $list[]=$key[$k]['keyword_id'];
+                }
+            }
+        }
+        $url='https://api.weixin.qq.com/cgi-bin/wxopen/template/add?access_token='.$this->getaccess_token();
+        $formWork = '{
+                 "id": "' . $id . '",
+                 "keyword_id_list": ' . json_encode($list) . '
+         }';
+        $data = $this->httpRequest($url, $formWork);
+        // print_r($data);die;
+        return json_decode($data,true)['template_id'];
+
+
+    }
+
+
+}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":40169,"errmsg":"invalid length for scene, or the data is not json string hint: [IlBExa0066wxa8]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj19.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [7ua2aA09854525]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj20.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [vLfrAA0036wxa7]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj21.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [7jAFIa01044524]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj32..jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [5VCsJa0083xa12]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj32.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [vb0JOa0470wxa3]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj33.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [K6V0Ja0268wxa4]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj34.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [UV20385wxa9]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj35.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [zufUJA0557xa12]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj36.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [zFWr_0612xa10]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj37.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [NM49VA0649wxa2]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj39.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [0682xa12]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj41.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [QCF0075wxa2]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj44.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [Fk5TWa0486wxa9]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj58.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [oX1rtA00704527]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj59.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [06inFA0318wxa7]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj60.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [Rz2Wta06124528]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj62.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [zmW7Ra00564525]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj63.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [WoG7IA04804530]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj64.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [PWZXfA04734526]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj65.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [jgx05371540]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj66.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [P4U4905864529]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj68.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [fGTnuA02081513]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj70.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [kDWD706031524]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj71.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [02144530]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj72.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [Q5w8Ma02954522]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj74.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [I0721a01434527]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj75.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [CmSQvA06374523]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj79.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [GA9P.a05961540]"}

+ 1 - 0
addons/zh_jdgjb/inc/upload/tcsj80.jpeg

xqd
@@ -0,0 +1 @@
+{"errcode":41030,"errmsg":"invalid page hint: [Q0DCiA01581513]"}

+ 31 - 0
addons/zh_jdgjb/inc/web/account.inc.php

xqd
@@ -0,0 +1,31 @@
+<?php
+global $_GPC, $_W;
+$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
+$GLOBALS['frames'] = $this->getMainMenu();
+
+
+
+if ($operation == 'display') {
+    $strwhere = '';
+    $pindex = max(1, intval($_GPC['page']));
+    $psize = 10;
+    $list = pdo_fetchall("SELECT a.*,b.username AS username,b.status AS status,c.name as user_name FROM " . tablename('zh_jdgjb_account') . " a LEFT JOIN
+" . tablename('users') . " b ON a.uid=b.uid left join".tablename('zh_jdgjb_seller')."c on a.storeid=c.id  WHERE a.weid = :weid AND a.role=1 $strwhere ORDER BY id DESC LIMIT
+" . ($pindex - 1) * $psize . ',' . $psize, array(':weid' =>$_W['uniacid']));
+
+    if (!empty($list)) {
+        $total = pdo_fetchcolumn('SELECT COUNT(1) FROM ' . tablename('zh_jdgjb_account') . " WHERE weid = :weid $strwhere", array(':weid' => $_W['uniacid']));
+        $pager = pagination($total, $pindex, $psize);
+    }
+} else if ($operation == 'delete') {
+    $id = intval($_GPC['id']);
+    $item = pdo_fetch("SELECT * FROM " . tablename('zh_jdgjb_account') . " WHERE id = '$id'");
+    if (empty($item)) {
+        message('抱歉,不存在或是已经被删除!', $this->createWebUrl('account', array('op' => 'display')), 'error');
+    }
+     pdo_delete('users', array('uid' => $item['uid']));
+    pdo_delete('zh_jdgjb_account', array('id' => $id, 'weid' => $_W['uniacid']));
+   
+    message('删除成功!', $this->createWebUrl('account', array('op' => 'display')), 'success');
+}
+include $this->template('web/account');

+ 28 - 0
addons/zh_jdgjb/inc/web/ad.inc.php

xqd
@@ -0,0 +1,28 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$pageindex = max(1, intval($_GPC['page']));
+$pagesize=10;
+$sql="select * from".tablename('zh_jdgjb_ad')." where uniacid={$_W['uniacid']} ORDER BY orderby ASC";
+$total=pdo_fetchcolumn("select count(*) from".tablename('zh_jdgjb_ad')." where uniacid={$_W['uniacid']} ");
+$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
+$list=pdo_fetchall($select_sql);
+$pager = pagination($total, $pageindex, $pagesize);
+if($_GPC['op']=='delete'){
+	$res=pdo_delete('zh_jdgjb_ad',array('id'=>$_GPC['id']));
+	if($res){
+		 message('删除成功!', $this->createWebUrl('ad'), 'success');
+		}else{
+			  message('删除失败!','','error');
+		}
+}
+if($_GPC['status']){
+	$data['status']=$_GPC['status'];
+	$res=pdo_update('zh_jdgjb_ad',$data,array('id'=>$_GPC['id']));
+	if($res){
+		 message('编辑成功!', $this->createWebUrl('ad'), 'success');
+		}else{
+			  message('编辑失败!','','error');
+		}
+}
+include $this->template('web/ad');

+ 115 - 0
addons/zh_jdgjb/inc/web/addaccount.inc.php

xqd
@@ -0,0 +1,115 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$user = pdo_fetchall("SELECT * FROM " . tablename('zh_jdgjb_seller') . " WHERE uniacid= :weid  and state=2 ORDER BY id DESC", array(':weid' => $_W['uniacid']), 'id');
+    $id = intval($_GPC['id']);
+    //echo $id;die;
+    $user_id = intval($_GPC['user_id']);
+    if (!empty($id)) {
+        $account = pdo_fetch("SELECT * FROM " . tablename('zh_jdgjb_account') . " WHERE weid = :weid AND id=:id ORDER BY id DESC", array(':weid' => $_W['uniacid'], ':id' => $id));
+        //$fans = $this->getFansByOpenid($account['from_user']);
+    }
+    if (!empty($account)) {
+        $users = user_single($account['uid']);
+    }
+ if (checksubmit('submit')) {
+        load()->model('user');
+        $user = array();
+        $user['username'] = trim($_GPC['username']);
+        if (!preg_match(REGULAR_USERNAME, $user['username'])) {
+            message('必须输入用户名,格式为 3-15 位字符,可以包括汉字、字母(不区分大小写)、数字、下划线和句点。');
+        }
+        if (empty($users)) {
+            $user['password'] = $_GPC['password'];
+            if (istrlen($user['password']) < 8) {
+                message('必须输入密码,且密码长度不得低于8位。');
+            }
+        }
+        if (!empty($_GPC['password'])) {
+            $user['password'] = $_GPC['password'];
+            if (istrlen($user['password']) < 8) {
+                message('必须输入密码,且密码长度不得低于8位。');
+            }
+        }
+        if (!empty($account)) {
+            $user['salt'] = $users['salt'];
+            $user['uid'] = $account['uid'];
+        }
+        $user['remark'] = $_GPC['remark'];
+        $user['status'] = $_GPC['status'];
+        $user['groupid'] = -1;
+        if (empty($users)) {
+            if (user_check(array('username' => $user['username']))) {
+                message('非常抱歉,此用户名已经被注册,你需要更换注册名称!');
+            }
+      
+
+            $uid = user_register($user,$source='');
+            if ($uid > 0) {
+                unset($user['password']);
+                //operator
+                $data = array(
+                    'uniacid' => $_W['uniacid'],
+                    'uid' => $uid,
+                    'role' => 'operator',
+                );
+                $exists = pdo_fetch("SELECT * FROM " . tablename('uni_account_users') . " WHERE uid = :uid AND uniacid = :uniacid", array(':uniacid' => $_W['uniacid'], ':uid' => $uid));
+                if (empty($exists)) {
+                    pdo_insert('uni_account_users', $data);
+                }
+                //permission
+                pdo_insert('users_permission', array(
+                    'uid' => $uid,
+                    'uniacid' => $_W['uniacid'],
+                    'url' => '',
+                    'type' => 'zh_jdgjb',
+                    'permission' => 'zh_jdgjb_menu_store'
+                ));
+//update ims_users_permission set permission='zh_dianc_menu_stores2' where permission='zh_dianc_menu_stores';
+                pdo_insert('zh_jdgjb_account', array(
+                    'uid' => $uid,
+                    'weid' => $_W['uniacid'],
+                    'storeid' => intval($_GPC['user_id']),
+                    'from_user' => trim($_GPC['from_user']),
+                    'email' => trim($_GPC['email']),
+                    'mobile' => trim($_GPC['mobile']),
+                    'pay_account' => trim($_GPC['pay_account']),
+                    'status' => intval($_GPC['status']),
+                    'remark' => trim($_GPC['remark']),
+                    'dateline' => TIMESTAMP,
+                    'username' => trim($_GPC['truename']),
+                    'role' => 1,
+                    'is_admin_order' => intval($_GPC['is_admin_order']),
+                    'is_notice_order' => intval($_GPC['is_notice_order']),
+                    'is_notice_service' => intval($_GPC['is_notice_service']),
+                    'is_notice_boss' => intval($_GPC['is_notice_boss']),
+                    'is_notice_queue' => intval($_GPC['is_notice_queue']),
+                ));
+                message('用户增加成功!!', $this->createWebUrl('account', array(), true));
+            }
+        }else {
+            user_update($user);
+            pdo_update('zh_jdgjb_account', array(
+                'weid' => $_W['uniacid'],
+                'storeid' => intval($_GPC['user_id']),
+                'from_user' => trim($_GPC['from_user']),
+                'email' => trim($_GPC['email']),
+                'mobile' => trim($_GPC['mobile']),
+                'pay_account' => trim($_GPC['pay_account']),
+                'status' => intval($_GPC['status']),
+                'remark' => trim($_GPC['remark']),
+                'dateline' => TIMESTAMP,
+                'role' => 1,
+                'username' => trim($_GPC['truename']),
+                'is_admin_order' => intval($_GPC['is_admin_order']),
+                'is_notice_order' => intval($_GPC['is_notice_order']),
+                'is_notice_service' => intval($_GPC['is_notice_service']),
+                'is_notice_boss' => intval($_GPC['is_notice_boss']),
+                'is_notice_queue' => intval($_GPC['is_notice_queue']),
+            ), array('id' => $id));
+            message('更新成功!', $this->createWebUrl('account', array(), true));
+        }
+        message('操作用户失败,请稍候重试或联系网站管理员解决!');
+   }
+ //  print_R($users);die;
+include $this->template('web/addaccount');

+ 50 - 0
addons/zh_jdgjb/inc/web/addad.inc.php

xqd
@@ -0,0 +1,50 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$info=pdo_get('zh_jdgjb_ad',array('id'=>$_GPC['id']));
+if(checksubmit('submit')){
+         $data['logo']=$_GPC['logo'];
+        
+        $data['orderby']=$_GPC['orderby'];
+        $data['status']=$_GPC['status'];
+        $data['title']=$_GPC['title'];
+        $data['type']=$_GPC['type'];
+        if($_GPC['state']==1){
+              $data['state']=1;
+            $data['src']=$_GPC['src'];
+             $data['wb_src']='';
+            $data['xcx_name']='';
+            $data['appid']='';
+        }
+         if($_GPC['state']==2){
+             $data['state']=2;
+           $data['src']='';
+             $data['wb_src']=$_GPC['wb_src'];
+            $data['xcx_name']='';
+            $data['appid']='';
+        }
+          if($_GPC['state']==3){
+            $data['state']=3;
+           $data['src']='';
+            $data['wb_src']='';
+            $data['xcx_name']=$_GPC['xcx_name'];
+            $data['appid']=$_GPC['appid'];
+        }
+        $data['uniacid']=$_W['uniacid'];
+     if($_GPC['id']==''){  
+        $res=pdo_insert('zh_jdgjb_ad',$data);
+        if($res){
+             message('添加成功!', $this->createWebUrl('ad'), 'success');
+        }else{
+             message('添加失败!','','error');
+        }
+    }else{
+        $res=pdo_update('zh_jdgjb_ad',$data,array('id'=>$_GPC['id']));
+        if($res){
+             message('编辑成功!', $this->createWebUrl('ad'), 'success');
+        }else{
+             message('编辑失败!','','error');
+        }
+    }
+}
+include $this->template('web/addad');

+ 32 - 0
addons/zh_jdgjb/inc/web/addcoupon.inc.php

xqd
@@ -0,0 +1,32 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$list = pdo_get('zh_jdgjb_coupons',array('id'=>$_GPC['id']));
+if(checksubmit('submit')){
+    $data['name']=$_GPC['name'];    
+    $data['number']=$_GPC['number'];    
+    $data['cost']=$_GPC['cost'];
+    $data['introduce']=$_GPC['introduce'];
+    $data['start_time']=$_GPC['time']['start'];
+    $data['conditions']=$_GPC['conditions'];
+    $data['end_time']=$_GPC['time']['end'];
+    $data['uniacid']=$_W['uniacid'];
+    if($_GPC['id']==''){
+        $data['type']=1;
+        $data['time']=time();
+        $res=pdo_insert('zh_jdgjb_coupons',$data);
+        if($res){
+            message('添加成功',$this->createWebUrl('coupon',array()),'success');
+        }else{
+            message('添加失败','','error');
+        }
+    }else{
+        $res = pdo_update('zh_jdgjb_coupons', $data, array('id' => $_GPC['id']));
+        if($res){
+            message('编辑成功',$this->createWebUrl('coupon',array()),'success');
+        }else{
+            message('编辑失败','','error');
+        }
+    }
+}
+include $this->template('web/addcoupon');

+ 100 - 0
addons/zh_jdgjb/inc/web/addhotel.inc.php

xqd
@@ -0,0 +1,100 @@
+<?php
+/**
+ *门店添加;
+ */
+global $_GPC, $_W;
+load()->func('tpl');
+$weid = $this->_weid;
+$action = 'fans';
+$GLOBALS['frames'] = $this->getMainMenu($storeid,$action);
+$title = $this->actions_titles[$action];
+$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
+$list = pdo_get('zh_jdgjb_seller',array('id'=>$_GPC['id']));
+$user=pdo_getall('zh_jdgjb_user',array('uniacid'=>$_W['uniacid']));
+$sql =" select id,name from ".tablename('zh_jdgjb_user')." where uniacid={$_W['uniacid']}  and  openid like '%{$_GPC['keywords']}%' and id not in (select user_id from".tablename('zh_jdgjb_seller')." where  uniacid={$_W['uniacid']})";
+$user2=pdo_fetchall($sql);
+$userinfo2=pdo_get('zh_jdgjb_user',array('id'=>$list['user_id']));
+$cityName= ["province"=> $list['provinceName'] ,"city"=>  $list['cityName'] ,"district"=>'' ];
+ $system = pdo_fetch("SELECT openCity FROM ". tablename('zh_jdgjb_system') . " WHERE uniacid = :weid", array('weid' => $_W['uniacid']));
+if($list['img']){
+  if(strlen($list['img'])>51){
+    $img= explode(',',$list['img']);
+  }else{
+    $img=array(
+      0=>$list['img']
+      );
+  }  
+}  
+if(checksubmit('submit')){
+
+  if(empty($_GPC['name'])){
+    message('酒店名称不能为空','','error');
+  }
+  if(empty($_GPC['address'])){
+    message('酒店具体地址不能为空','','error');
+  }
+  if(empty($_GPC['link_name'])){
+    message('联系人姓名不能为空','','error');
+  }
+  if(empty($_GPC['link_tel'])){
+    message('联系人电话不能为空','','error');
+  }
+  if($_GPC['img']){
+    $data['img']=implode(",",$_GPC['img']);
+  }
+  $data['name']=$_GPC['name'];
+  $data['star']=$_GPC['star'];
+  $data['tel']=$_GPC['tel'];
+  $data['address']=$_GPC['address'];
+  $data['open_time']=$_GPC['open_time'];
+  $data['handle']=$_GPC['handle'];
+  $data['wake']=$_GPC['wake'];
+  $data['wifi']=$_GPC['wifi'];
+  $data['park']=$_GPC['park'];
+  $data['breakfast']=$_GPC['breakfast'];
+  $data['unionPay']=$_GPC['unionPay'];
+  $data['support']=$_GPC['support'];
+  $data['bq_logo']=$_GPC['bq_logo'];
+  $data['gym']=$_GPC['gym'];
+  $data['ewm_logo']=$_GPC['ewm_logo'];
+  $data['cityName']=$_GPC['cityName']['city'];
+  $data['provinceName']=$_GPC['cityName']['province'];
+  $data['boardroom']=$_GPC['boardroom'];
+  $data['introduction']=html_entity_decode($_GPC['introduction']);
+  $data['water']=$_GPC['water'];
+  $data['policy']=html_entity_decode($_GPC['policy']);
+  $data['rule']=$_GPC['rule'];
+  $data['prompt']=$_GPC['prompt'];
+  $data['zd_money']=$_GPC['zd_money'];
+  $data['uniacid']=$_W['uniacid'];
+  $data['link_name']=$_GPC['link_name'];
+  $data['link_tel']=$_GPC['link_tel'];
+  $data['coordinates']=$_GPC['coordinates'];
+  $data['scort']=$_GPC['scort'];
+  $data['bd_id']=$_GPC['bd_id'];
+   $data['ye_open']=$_GPC['ye_open'];
+   $data['wx_open']=$_GPC['wx_open'];
+   $data['dd_open']=$_GPC['dd_open'];
+   $data['user_id']=$_GPC['user_id'];
+  if($_GPC['id']==''){
+    $data['owner']=1;
+     $data['state']=2;
+       $data['time']=time();
+    $res=pdo_insert('zh_jdgjb_seller',$data);
+    if($res){
+      message('添加成功',$this->createWebUrl('hotel',array()),'success');
+    }else{
+      message('添加失败','','error');
+    }
+
+  }else{       
+    $res = pdo_update('zh_jdgjb_seller', $data, array('id' => $_GPC['id']));
+    if($res){
+      message('编辑成功',$this->createWebUrl('hotel',array()),'success');
+    }else{
+      message('编辑失败','','error');
+    }
+  }
+}
+
+include $this->template('web/addhotel');

+ 38 - 0
addons/zh_jdgjb/inc/web/addjfgoods.inc.php

xqd
@@ -0,0 +1,38 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+	$info = pdo_get('zh_jdgjb_jfgoods',array('uniacid' => $_W['uniacid'],'id'=>$_GPC['id']));
+	$type = pdo_getall('zh_jdgjb_jftype',array('uniacid' => $_W['uniacid']));
+		if(checksubmit('submit')){
+			$data['name']=$_GPC['name'];
+			$data['img']=$_GPC['img'];
+			$data['score']=$_GPC['score'];
+			$data['type_id']=$_GPC['type_id'];
+			$data['goods_details']=html_entity_decode($_GPC['goods_details']);
+			$data['process_details']=html_entity_decode($_GPC['process_details']);
+			$data['attention_details']=html_entity_decode($_GPC['attention_details']);
+			$data['number']=$_GPC['number'];
+			$data['is_open']=$_GPC['is_open'];
+			$data['type']=$_GPC['type'];
+			$data['num']=$_GPC['num'];
+			$data['hb_moeny']=$_GPC['hb_moeny'];
+			$data['end_time']=strtotime($_GPC['end_time']);
+
+			$data['uniacid']=$_W['uniacid'];
+			if($_GPC['id']==''){				
+				$res=pdo_insert('zh_jdgjb_jfgoods',$data);
+				if($res){
+					message('添加成功',$this->createWebUrl('jfgoods',array()),'success');
+				}else{
+					message('添加失败','','error');
+				}
+			}else{
+				$res = pdo_update('zh_jdgjb_jfgoods', $data, array('id' => $_GPC['id']));
+				if($res){
+					message('编辑成功',$this->createWebUrl('jfgoods',array()),'success');
+				}else{
+					message('编辑失败','','error');
+				}
+			}
+		}
+include $this->template('web/addjfgoods');

+ 26 - 0
addons/zh_jdgjb/inc/web/addjftype.inc.php

xqd
@@ -0,0 +1,26 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$info = pdo_get('zh_jdgjb_jftype',array('uniacid' => $_W['uniacid'],'id'=>$_GPC['id']));
+if(checksubmit('submit')){
+	$data['img']=$_GPC['img'];
+	$data['num']=$_GPC['num'];
+	$data['name']=$_GPC['name'];
+	$data['uniacid']=$_W['uniacid'];
+	if($_GPC['id']==''){				
+		$res=pdo_insert('zh_jdgjb_jftype',$data);
+		if($res){
+			message('添加成功',$this->createWebUrl('jftype',array()),'success');
+		}else{
+			message('添加失败','','error');
+		}
+	}else{
+		$res = pdo_update('zh_jdgjb_jftype', $data, array('id' => $_GPC['id']));
+		if($res){
+			message('编辑成功',$this->createWebUrl('jftype',array()),'success');
+		}else{
+			message('编辑失败','','error');
+		}
+	}
+}
+include $this->template('web/addjftype');

+ 29 - 0
addons/zh_jdgjb/inc/web/addmemberlevel.inc.php

xqd
@@ -0,0 +1,29 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$list = pdo_get('zh_jdgjb_level',array('uniacid' => $_W['uniacid'],'id'=>$_GPC['id']));
+if(checksubmit('submit')){
+	$data['name']=$_GPC['name'];
+	$data['uniacid']=$_W['uniacid'];
+	$data['icon']=$_GPC['icon'];
+	$data['value']=$_GPC['value'];
+	$data['orderby']=$_GPC['orderby'];	
+	$data['discount']=$_GPC['discount'];
+	$data['content']=html_entity_decode($_GPC['content']);
+	if($_GPC['id']==''){		
+		$res=pdo_insert('zh_jdgjb_level',$data);
+		if($res){
+			message('添加成功',$this->createWebUrl('memberlevel',array()),'success');
+		}else{
+			message('添加失败','','error');
+		}
+	}else{			
+		$res = pdo_update('zh_jdgjb_level', $data, array('id' => $_GPC['id']));
+		if($res){
+			message('编辑成功',$this->createWebUrl('memberlevel',array()),'success');
+		}else{
+			message('编辑失败','','error');
+		}
+	}
+}
+include $this->template('web/addmemberlevel');

+ 48 - 0
addons/zh_jdgjb/inc/web/addnav.inc.php

xqd
@@ -0,0 +1,48 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$info=pdo_get('zh_jdgjb_nav',array('id'=>$_GPC['id']));
+if(checksubmit('submit')){
+         $data['logo']=$_GPC['logo'];       
+        $data['orderby']=$_GPC['orderby'];
+        $data['status']=$_GPC['status'];
+        $data['title']=$_GPC['title'];       
+        if($_GPC['state']==1){
+              $data['state']=1;
+            $data['src']=$_GPC['src'];
+             $data['wb_src']='';
+            $data['xcx_name']='';
+            $data['appid']='';
+        }
+         if($_GPC['state']==2){
+             $data['state']=2;
+           $data['src']='';
+             $data['wb_src']=$_GPC['wb_src'];
+            $data['xcx_name']='';
+            $data['appid']='';
+        }
+          if($_GPC['state']==3){
+            $data['state']=3;
+           $data['src']='';
+            $data['wb_src']='';
+            $data['xcx_name']=$_GPC['xcx_name'];
+            $data['appid']=$_GPC['appid'];
+        }    
+        $data['uniacid']=$_W['uniacid'];
+     if($_GPC['id']==''){  
+        $res=pdo_insert('zh_jdgjb_nav',$data);
+        if($res){
+             message('添加成功!', $this->createWebUrl('nav'), 'success');
+        }else{
+             message('添加失败!','','error');
+        }
+    }else{
+        $res=pdo_update('zh_jdgjb_nav',$data,array('id'=>$_GPC['id']));
+        if($res){
+             message('编辑成功!', $this->createWebUrl('nav'), 'success');
+        }else{
+             message('编辑失败!','','error');
+        }
+    }
+}
+include $this->template('web/addnav');

+ 61 - 0
addons/zh_jdgjb/inc/web/addroom.inc.php

xqd
@@ -0,0 +1,61 @@
+<?php
+//门店列表
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu2();
+$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'fieldset_display';
+$seller_id=$_COOKIE["storeid"];
+$cur_store = $this->getStoreById($seller_id);
+$pageindex = max(1, intval($_GPC['page']));
+$pagesize=10;
+$list = pdo_get('zh_jdgjb_room',array('id'=>$_GPC['id']));
+if($list['img']){
+  if(strlen($list['img'])>51){
+    $img= explode(',',$list['img']);
+  }else{
+    $img=array(
+      0=>$list['img']
+      );
+  }  
+}  
+if(checksubmit('submit')){
+
+	$data['name']=$_GPC['name'];
+	$data['price']=$_GPC['price'];
+	$data['logo']=$_GPC['logo'];
+	if($_GPC['img']){
+		$data['img']=implode(",",$_GPC['img']);
+	}	
+	$data['floor']=$_GPC['floor'];
+	$data['people']=$_GPC['people'];
+	$data['bed']=$_GPC['bed'];
+	$data['breakfast']=$_GPC['breakfast'];
+	$data['facilities']=$_GPC['facilities'];
+	$data['windows']=$_GPC['windows'];
+	$data['size']=$_GPC['size'];
+	$data['logo']=$_GPC['logo'];
+	$data['total_num']=$_GPC['total_num'];
+	$data['uniacid']=$_W['uniacid'];
+	$data['seller_id']=$seller_id;
+	$data['yj_cost']=$_GPC['yj_cost'];
+	$data['state']=$_GPC['state'];
+	$data['sort']=$_GPC['sort'];
+	$data['rz_time']=$_GPC['rz_time'];
+	$data['classify']=$_GPC['classify'];
+	if($_GPC['id']==''){			
+		$res=pdo_insert('zh_jdgjb_room',$data);
+		if($res){
+			message('添加成功',$this->createWebUrl('room',array()),'success');
+		}else{
+			message('添加失败','','error');
+		}
+
+	}else{		
+		$res = pdo_update('zh_jdgjb_room', $data, array('id' => $_GPC['id']));
+		if($res){
+			message('编辑成功',$this->createWebUrl('room',array()),'success');
+		}else{
+			message('编辑失败','','error');
+		}
+	}
+}
+include $this->template('web/addroom');

+ 38 - 0
addons/zh_jdgjb/inc/web/assess.inc.php

xqd
@@ -0,0 +1,38 @@
+<?php
+global $_GPC, $_W;
+load()->func('tpl');
+$storeid=$_COOKIE["storeid"];
+$cur_store = $this->getStoreById($storeid);
+$GLOBALS['frames'] = $this->getMainMenu2($storeid,$action);
+if(checksubmit('submit')){
+	$op=$_GPC['keywords'];
+	$where="%$op%";
+}else{
+	$where='%%';
+}
+$pageindex = max(1, intval($_GPC['page']));
+$pagesize=10;
+$sql="select * from ". tablename("zh_jdgjb_assess").  "WHERE uniacid=:uniacid and seller_id=".$storeid." and content LIKE :name";
+$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
+$list = pdo_fetchall($select_sql,array(':uniacid'=>$_W['uniacid'],':name'=>$where));	   
+$total = pdo_fetchcolumn("select count(*) from ".tablename("zh_jdgjb_assess").  "WHERE uniacid=:uniacid and seller_id=".$storeid." and content LIKE :name",array(':uniacid'=>$_W['uniacid'],':name'=>$where));	
+$pager = pagination($total, $pageindex, $pagesize);
+if(checksubmit('submit2')){
+	$result = pdo_update('zh_jdgjb_assess', array('reply' => $_GPC['reply'],'status'=>2,'reply_time'=>date("Y-m-d H:i:s")), array('id' => $_GPC['id']));
+	if($result){
+			message('回复成功',$this->createWebUrl('assess',array()),'success');
+		}else{
+			message('回复失败','','error');
+		}
+}
+if($_GPC['op']=='delete'){
+	$result = pdo_delete('zh_jdgjb_assess', array('id'=>$_GPC['id']));
+	if($result){
+		message('删除成功',$this->createWebUrl('assess',array()),'success');
+	}else{
+		message('删除失败','','error');
+	}
+}
+
+
+include $this->template('web/assess');

+ 39 - 0
addons/zh_jdgjb/inc/web/assessinfo.inc.php

xqd
@@ -0,0 +1,39 @@
+<?php
+
+global $_GPC, $_W;
+
+load()->func('tpl');
+
+$storeid=$_COOKIE["storeid"];
+
+$cur_store = $this->getStoreById($storeid);
+
+$GLOBALS['frames'] = $this->getMainMenu2($storeid,$action);
+
+
+
+$sql="select a.* ,b.name from " . tablename("zh_jdgjb_assess") . " a"  . " left join " . tablename("zh_jdgjb_user") . " b on b.id=a.user_id where a.uniacid=:uniacid and a.id=:id";
+
+$list=pdo_fetch($sql, array(':uniacid'=>$_W['uniacid'],':id'=>$_GPC['id']));
+
+if (checksubmit('submit')) {
+
+	$data['content']=$_GPC['content'];
+
+	$data['reply']=$_GPC['reply'];
+
+	$res=pdo_update("zh_jdgjb_assess",$data,array('id'=>$_GPC['id']));
+
+	if($res){
+
+			message('修改成功',$this->createWebUrl('assess',array()),'success');
+
+		}else{
+
+			message('修改失败','','error');
+
+		}
+
+}
+
+include $this->template('web/assessinfo');

+ 54 - 0
addons/zh_jdgjb/inc/web/auditorhotel.inc.php

xqd
@@ -0,0 +1,54 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
+$type=empty($_GPC['type']) ? 'all' :$_GPC['type'];
+$state=$_GPC['state'];
+$pageindex = max(1, intval($_GPC['page']));
+$pagesize=20;
+$where=' WHERE  uniacid=:uniacid  and owner=2';
+$data[':uniacid']=$_W['uniacid'];
+if($_GPC['keywords']){
+    $op=$_GPC['keywords'];
+    $where.=" and name LIKE  concat('%', :name,'%') ";    
+    $data[':name']=$op;
+}
+if($type !='all'){
+     $where.= " and state=".$state;
+}
+$sql="SELECT * FROM ".tablename('zh_jdgjb_seller'). $where." ORDER BY id DESC";
+$total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zh_jdgjb_seller') .$where,$data);
+$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
+$list=pdo_fetchall($select_sql,$data);
+$pager = pagination($total, $pageindex, $pagesize);
+if($operation=='adopt'){//审核通过 
+    $id=$_GPC['id'];
+    $res=pdo_update('zh_jdgjb_seller',array('state'=>2,'time'=>time(),'sq_time'=>time()),array('id'=>$id));  
+    if($res){
+        $rzinfo=pdo_get('zh_jdgjb_seller',array('id'=>$id));
+        message('审核成功',$this->createWebUrl('auditorhotel',array()),'success');
+    }else{
+        message('审核失败','','error');
+    }
+}
+if($operation=='reject'){
+     $id=$_GPC['id'];
+    $res=pdo_update('zh_jdgjb_seller',array('state'=>3,'time'=>time(),'sq_time'=>time()),array('id'=>$id));
+     if($res){  
+        message('拒绝成功',$this->createWebUrl('auditorhotel',array()),'success');
+    }else{
+        message('拒绝失败','','error');
+    }
+}
+if($operation=='delete'){
+     $id=$_GPC['id'];
+     $res=pdo_delete('zh_jdgjb_seller',array('id'=>$id));
+     if($res){
+        message('删除成功',$this->createWebUrl('auditorhotel',array()),'success');
+    }else{
+        message('删除失败','','error');
+    }
+
+}
+
+include $this->template('web/auditorhotel');

+ 21 - 0
addons/zh_jdgjb/inc/web/auditorhotelinfo.inc.php

xqd
@@ -0,0 +1,21 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$sql="SELECT * FROM ".tablename('zh_jdgjb_seller')."  where id=:id ";
+$item=pdo_fetch($sql,array(':id'=>$_GPC['id']));
+if(checksubmit('submit')){   
+	$data['name']=$_GPC['name'];     
+	$data['link_name']=$_GPC['link_name'];
+	$data['link_tel']=$_GPC['link_tel'];
+	$data['state']=$_GPC['state'];
+	$data['other']=html_entity_decode($_GPC['other']);
+	$rst=pdo_update('zh_jdgjb_seller',$data,array('id'=>$_GPC['id']));
+	if($rst){
+	     message('编辑成功!', $this->createWebUrl('auditorhotel'), 'success');
+	}else{
+	     message('编辑失败!','','error');
+	}
+
+}
+
+include $this->template('web/auditorhotelinfo');

+ 5 - 0
addons/zh_jdgjb/inc/web/chongzhi.inc.php

xqd
@@ -0,0 +1,5 @@
+<?php
+global $_GPC, $_W;
+$GLOBALS['frames'] = $this->getMainMenu();
+$list=pdo_getall('zh_jdgjb_czhd',array('uniacid'=>$_W['uniacid']));
+include $this->template('web/chongzhi');

Неке датотеке нису приказане због велике количине промена