作者 郭文星

111

... ... @@ -30,7 +30,7 @@ return [
'title' => 'token',
'type' => 'string',
'content' => [],
'value' => 'Fdc2022666fdC',
'value' => 'Wyc666666',
'rule' => 'required',
'msg' => '',
'tip' => '',
... ... @@ -42,7 +42,7 @@ return [
'title' => 'aes_key',
'type' => 'string',
'content' => [],
'value' => 'vfVRWaOmV7B19NqjE6zPBHaBTEDgv71plzhEGr8SxiQ',
'value' => 'HJXrDOoAhdN64J2Z33DyLo1gJsT6vw2xh9xbSzpD1Nn',
'rule' => 'required',
'msg' => '',
'tip' => '',
... ...
<?php
/**
* 首字母排序A-Z(含汉字)
*/
use app\admin\model\User;
use app\api\controller\v1\WxxcxPush;
if (!function_exists('getFirstChar')) {
function getFirstChar($s)
{
$s0 = mb_substr($s, 0, 1); //获取名字的姓
$s = iconv('UTF-8', 'gb2312', $s0); //将UTF-8转换成GB2312编码
//var_dump(ord($s0));
// var_dump(ord($s));
if (ord($s0) > 128) { //汉字开头,汉字没有以U、V开头的
$asc = ord($s{0}) * 256 + ord($s{1}) - 65536;
if ($asc >= -20319 and $asc <= -20284) return "A";
if ($asc >= -20283 and $asc <= -19776) return "B";
if ($asc >= -19775 and $asc <= -19219) return "C";
if ($asc >= -19218 and $asc <= -18711) return "D";
if ($asc >= -18710 and $asc <= -18527) return "E";
if ($asc >= -18526 and $asc <= -18240) return "F";
if ($asc >= -18239 and $asc <= -17760) return "G";
if ($asc >= -17759 and $asc <= -17248) return "H";
if ($asc >= -17247 and $asc <= -17418) return "I";
if ($asc >= -17417 and $asc <= -16475) return "J";
if ($asc >= -16474 and $asc <= -16213) return "K";
if ($asc >= -16212 and $asc <= -15641) return "L";
if ($asc >= -15640 and $asc <= -15166) return "M";
if ($asc >= -15165 and $asc <= -14923) return "N";
if ($asc >= -14922 and $asc <= -14915) return "O";
if ($asc >= -14914 and $asc <= -14631) return "P";
if ($asc >= -14630 and $asc <= -14150) return "Q";
if ($asc >= -14149 and $asc <= -14091) return "R";
if ($asc >= -14090 and $asc <= -13319) return "S";
if ($asc >= -13318 and $asc <= -12839) return "T";
if ($asc >= -12838 and $asc <= -12557) return "W";
if ($asc >= -12556 and $asc <= -11848) return "X";
if ($asc >= -11847 and $asc <= -11056) return "Y";
if ($asc >= -11055 and $asc <= -10247) return "Z";
} else if (ord($s) >= 48 && ord($s) <= 57) {//数字开头
$aa = @iconv_substr($s, 0, 1, 'utf-8');
switch ($aa) {
case 1:
return "Y";
case 2:
return "E";
case 3:
return "S";
case 4:
return "S";
case 5:
return "W";
case 6:
return "L";
case 7:
return "Q";
case 8:
return "B";
case 9:
return "J";
case 0:
return "L";
}
} else if (ord($s) >= 65 && ord($s) <= 90) { //大写英文开头
return substr($s, 0, 1);
} else if (ord($s) >= 97 && ord($s) <= 122) { //小写英文开头
return strtoupper(substr($s, 0, 1));
} else {
return iconv_substr($s0, 0, 1, 'utf-8');
//中英混合的词语,不适合上面的各种情况,因此直接提取首个字符即可
}
}
}
if (!function_exists('http_request')) {
// curl请求
function http_request($url, $timeout = 30, $header = array())
{
if (!function_exists('curl_init')) {
throw new Exception('server not install curl');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
if (!empty($header)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
}
$data = curl_exec($ch);
list($header, $data) = explode("\r\n\r\n", $data);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code == 301 || $http_code == 302) {
$matches = array();
preg_match('/Location:(.*?)\n/', $header, $matches);
$url = trim(array_pop($matches));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
$data = curl_exec($ch);
}
if ($data == false) {
curl_close($ch);
}
@curl_close($ch);
return $data;
}
}
if (!function_exists('insert_openid_info')) {
/**
* 将授权用户信息保存起来
*/
function insert_openid_info($data)
{
$data['upt_time'] = time();
$res = \think\Db::name("openid_info")->where("openid", $data['openid'])->find();
// file_put_contents("ccc.txt", date("Y-m-d H:i:s") . json_encode($data) . PHP_EOL, FILE_APPEND);
if (!empty($res)) {
\think\Db::name("openid_info")->where("openid", $data['openid'])->update($data);
} else {
\think\Db::name("openid_info")->insertGetId($data);
}
return true;
}
}
/**
* 生成订单号
* 重复就重新生成
*/
if (!function_exists('getOrderSn')) {
function getOrderSn()
{
$orderid = date("YmdHis") . mt_rand(1000, 999999);
$odcks = \think\Db::name('order')
->where(['order_no' => $orderid])
->find();
while (!empty($odcks)) {
$orderid = date("YmdHis") . mt_rand(1000, 999999);
}
return $orderid;
}
}
if(!function_exists('beingPushed')){
/**
* 发送模板消息
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function SendMessage($order_id){
$order=\think\Db::name("order")->find($order_id);
$wxxcxpush=new WxxcxPush();
$user=new User();
$user=$user->find($order['user_id']);
$res=$wxxcxpush->Message($user['wx_xcx_openid'],$order_id);
if ($res !== false) {
return $res;
}
}
}
if(!function_exists('OrderSendMessage')){
/**
* 发送模板消息
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function OrderSendMessage($order_id){
$order=\think\Db::name("order")->find($order_id);
$wxxcxpush=new WxxcxPush();
$user=new User();
$user=$user->find($order['user_id']);
$driver=new \app\admin\model\Driver();
$driver=$driver->find($order['driver_id']);
$driver_user=$user->find($driver['user_id']);
$res=$wxxcxpush->Message($driver_user['wx_xcx_openid'],$order_id);
$res=$wxxcxpush->Message($user['wx_xcx_openid'],$order_id);
if ($res !== false) {
return $res;
}
}
}
if(!function_exists('beingPushed')){
/**
* 发送模板消息
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function refundSendMessage($order_id){
$order=\think\Db::name("order")->find($order_id);
$wxxcxpush=new WxxcxPush();
$user=new User();
$user=$user->find($order['user_id']);
$res=$wxxcxpush->refundMessage($user['wx_xcx_openid'],$order_id);
if ($res !== false) {
return $res;
}
}
}
if (!function_exists('beingPushed')) {
/**
* 小程序模板推送选择类型
* @param $type @模板类型
* @param $openid @接收人ID
* @param $page @跳转页面
* @param $temp @具体提醒参数
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
function beingPushed($type, $openid, $page, $temp)
{
$data = [];
$data['touser'] = $openid;
$data['page'] = $page;
//模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } }
switch ($type) {
case 1:
//待审批事项提醒(新版本的长期订阅)
$data['template_id'] = "ws6bz6-WyHHA-upU2oRzc_C5toDUexe9ZicQ-ITtImA";
$data['data'] = [
"thing10" => [
'value' =>$temp['value1'],//审核状态(待处理)
],
"thing12" => [
'value' => $temp['value2'],//申请人(测试黄超)
],
"thing8" => [
'value' => $temp['value3'],//原因(入州报备审核)
]
];
break;
case 2:
//审核结果通知(新版本的长期订阅)
$data['template_id'] = "Qt2xqfH8uQyTm1A0ReNxeybtAydAhfhi4HinnyB5f0s";
$data['data'] = [
"thing1" => [
'value' => $temp['value1'],//提醒内容(已审核)
],
// "name1" => [
// 'value' => $temp['value2'],//审核人
// ],
"thing4" => [
'value' => $temp['value3'],//提示说明
]
];
break;
case 3:
//待审批事项提醒(老版本的一次性订阅)
$data['template_id'] = "vVOonN76AFjxgz77iG-hcWrH6HJ-vPGKyIyAK0VzPIk";
$data['data'] = [
"thing1" => [
'value' => $temp['value1'],//待办事项
],
"thing4" => [
'value' => $temp['value2'],//流程状态
],
"thing2" => [
'value' => $temp['value3'],//申请人
],
"time3" => [
'value' => $temp['value4'],//申请时间
],
"thing5" => [
'value' => $temp['value5'],//备注描述
]
];
break;
case 4:
//审核结果通知(老版本的一次性订阅)
$data['template_id'] = "qR9reAuv_Ulelyg1H2xbN-GoWGWFRhS0t4nhtvnFr5Q";
$data['data'] = [
"character_string1" => [
'value' => $temp['value1'],//审核结果
],
"date3" => [
'value' => $temp['value2'],//审核人
],
"thing5" => [
'value' => $temp['value3'],//审批时间
],
"thing6" => [
'value' => $temp['value4'],//审批时间
],
"thing7" => [
'value' => $temp['value5'],//审批时间
]
];
break;
case 5:
//预约结果通知
$data['template_id'] = "oczyQ_SabASMQRRhDedXRGUEzCAuGh1xBw8sp2HVPvQ";
$data['data'] = [
"thing1" => [
'value' => $temp['value1'],//备注
],
"thing2" => [
'value' =>$temp['value2'],//日期
],
"number3" => [
'value' => $temp['value3'],//就诊人
],
"time4" => [
'value' => $temp['value4'],//就诊人
],
"thing6" => [
'value' => $temp['value5'],//就诊人
]
];
break;
case 6:
//预约结果通知
$data['template_id'] = "Dfvkyn3So2YE5aVJtkUTFWdjgzpo6VvWkNHZBOMb_n4";
$data['data'] = [
"character_string1" => [
'value' => $temp['value1'],//备注
],
"number2" => [
'value' =>$temp['value2'],//日期
],
"name3" => [
'value' => $temp['value3'],//就诊人
],
"date4" => [
'value' => $temp['value4'],//就诊人
],
"thing9" => [
'value' => $temp['value5'],//就诊人
]
];
break;
}
return sendSubscribeMessage($data);
}
}
if (!function_exists('sendSubscribeMessage')) {
/**
* 小程序订阅消息推送
* @param $data
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
function sendSubscribeMessage($data)
{
//access_token
$access_token = getAccessToken();
//请求url
$url = 'https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=' . $access_token;
//file_put_contents('notify.txt',$data.PHP_EOL,FILE_APPEND);
//跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
$data['miniprogram_state'] = 'formal';
return curlPost($url, json_encode($data));
}
}
if (!function_exists('getAccessToken')) {
/**
* 获取access_token
* @return mixed
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
function getAccessToken()
{
$wx_xcx_token = \think\Db::name("wechat_token")->where("type", "wx_xcx")->find();
if (empty($wx_xcx_token) || empty($wx_xcx_token['access_token']) || $wx_xcx_token['over_time'] <= time()) {
//微信小程序失效
//当前时间戳
$now_time = strtotime(date('Y-m-d H:i:s', time()));
//获取新的access_token
$appid = config("site.wxxcx_AppID");
$secret = config("site.wxxcx_AppSecret");
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret;
$res = json_decode(file_get_contents($url), true);
$access_token = $res['access_token'];
if (!empty($access_token)) {
$time = time();
$update_data = [
"access_token" => $access_token,
"over_time" => $time + 7200,
"type" => "wx_xcx",
"updatetime" => $time
];
if (!empty($wx_xcx_token)) {
//更新
\think\Db::name("wechat_token")->where("id", $wx_xcx_token['id'])->update($update_data);
} else {
//新增
\think\Db::name("wechat_token")->insertGetId($update_data);
}
}
} else {
$access_token = $wx_xcx_token['access_token'];
}
return $access_token;
}
}
if (!function_exists('curlPost')) {
/**
* 发送post请求
*/
function curlPost($url, $data)
{
$ch = curl_init();
$params[CURLOPT_URL] = $url; //请求url地址
$params[CURLOPT_HEADER] = FALSE; //是否返回响应头信息
$params[CURLOPT_SSL_VERIFYPEER] = false;
$params[CURLOPT_SSL_VERIFYHOST] = false;
$params[CURLOPT_RETURNTRANSFER] = true; //是否将结果返回
$params[CURLOPT_POST] = true;
$params[CURLOPT_POSTFIELDS] = $data;
curl_setopt_array($ch, $params); //传入curl参数
$content = curl_exec($ch); //执行
// file_put_contents('notify.txt', $content . date('Y-m-d H:i:s', time()) . PHP_EOL, FILE_APPEND);
curl_close($ch); //关闭连接
return $content;
}
}
if (!function_exists('array_callback')) {
/**
* 20190729 kevin
* 规范数据返回函数
* @param unknown $state
* @param unknown $msg
* @param unknown $data
* @return multitype:unknown
*/
function array_callback($state = true, $msg = '', $data = array())
{
return array('state' => $state, 'msg' => $msg, 'data' => $data);
}
}
\ No newline at end of file
... ...
<?php
//配置文件
return [
'exception_handle' => '\\app\\api\\library\\ExceptionHandle',
];
... ...
<?php
namespace app\api\controller;
use app\api\controller\inspection\Task;
use app\common\controller\Api;
use fast\Http;
/**
* 首页接口
*/
class Index extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = ['*'];
/**
* 首页
*
*/
public function index()
{
$this->success('请求成功');
}
function getAccessToken() {
$appId = "wx58ceff4e93cfc523";
$appSecret = "baf744d21875280a5e98611f66adaf91";
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appId}&secret={$appSecret}";
$result = json_decode(file_get_contents($url), true);
return $result["access_token"] ?? null;
}
function createMiniProgramQRCode($accessToken, $path, $width = 430) {
$url = "https://api.weixin.qq.com/wxa/getwxacode?access_token={$accessToken}";
$data = json_encode([
'path' => $path,
'width' => $width
]);
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-type:application/json',
'content' => $data,
],
];
//POST参数
$result = $this->httpRequest($url,$data,"POST");
$file_name=md5(rand(1000,9999).time()). '.png';
$filename= 'uploads/' . $file_name ;
$ret = file_put_contents($filename, $result, true);
$task=new Task();
$res=$task->fileUpload($file_name);
return $res;
}
//把请求发送到微信服务器换取二维码
public function httpRequest($url,$data='',$method='GET'){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
if($method=='POST')
{
curl_setopt($curl, CURLOPT_POST, 1);
if ($data !='')
{
curl_setopt($curl, CURLOPT_POSTFIELDS,$data);
}
}
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
public function test(){
$accessToken = $this->getAccessToken();
if ($accessToken) {
$path = 'pages/index/index'; // 小程序内的页面路径
$qrCodeData = $this->createMiniProgramQRCode($accessToken, $path);
print_r($qrCodeData);return;
return $qrCodeData;
}
}
/***
* 公众号推送审核信息给经纪人
*/
public function senWxmsgToAgentUser($titdesc="", $remark="")
{ $appId = 'wxb7dd0c03865a94e0';
$appSecret = '6af75a6fb8211da45631630e34769f82';
$openId = 'o5ABA4yWDTLRTf3LkBMMHoV7XOvQ';
$unionId = 'ojyUX6oNFoQMqoCd1JWtfwQs-CeA';
// 获取token
$myurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appId . "&secret=" . $appSecret;
$json_token = http_request($myurl);
$access_tokens = json_decode($json_token, true);
$accessToken = $access_tokens['access_token'];
// 发送消息的接口地址
$sendMessageUrl = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={$accessToken}";
// 构造要发送的消息数据
$data = [
'touser' => $openId,
'msgtype' => 'text',
'text' => [
'content' => '你好,这是一个公众号消息'
]
];
// 对数据进行JSON编码
$jsonData = json_encode($data, JSON_UNESCAPED_UNICODE);
// 发送HTTP POST请求
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $sendMessageUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// 处理响应结果
$result = json_decode($response, true);
if ($result['errcode'] == 0) {
echo "消息发送成功";
} else {
echo "消息发送失败,错误代码:{$result['errcode']},错误信息:{$result['errmsg']}";
}
}
function http_request($url, $data = array())
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
// 我们在POST数据哦!
curl_setopt($ch, CURLOPT_POST, 1);
// 把post的变量加上
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
}
... ...
<?php
return [
'Keep login' => '保持会话',
'Username' => '用户名',
'User id' => '会员ID',
'Nickname' => '昵称',
'Password' => '密码',
'Sign up' => '注 册',
'Sign in' => '登 录',
'Sign out' => '退 出',
'Guest' => '游客',
'Welcome' => '%s,你好!',
'Add' => '添加',
'Edit' => '编辑',
'Delete' => '删除',
'Move' => '移动',
'Name' => '名称',
'Status' => '状态',
'Weigh' => '权重',
'Operate' => '操作',
'Warning' => '温馨提示',
'Default' => '默认',
'Article' => '文章',
'Page' => '单页',
'OK' => '确定',
'Cancel' => '取消',
'Loading' => '加载中',
'More' => '更多',
'Normal' => '正常',
'Hidden' => '隐藏',
'Submit' => '提交',
'Reset' => '重置',
'Execute' => '执行',
'Close' => '关闭',
'Search' => '搜索',
'Refresh' => '刷新',
'First' => '首页',
'Previous' => '上一页',
'Next' => '下一页',
'Last' => '末页',
'None' => '无',
'Home' => '主页',
'Online' => '在线',
'Logout' => '退出',
'Profile' => '个人资料',
'Index' => '首页',
'Hot' => '热门',
'Recommend' => '推荐',
'Dashboard' => '控制台',
'Code' => '编号',
'Message' => '内容',
'Line' => '行号',
'File' => '文件',
'Menu' => '菜单',
'Type' => '类型',
'Title' => '标题',
'Content' => '内容',
'Append' => '追加',
'Memo' => '备注',
'Parent' => '父级',
'Params' => '参数',
'Permission' => '权限',
'Advance search' => '高级搜索',
'Check all' => '选中全部',
'Expand all' => '展开全部',
'Begin time' => '开始时间',
'End time' => '结束时间',
'Create time' => '创建时间',
'Flag' => '标志',
'Please login first' => '请登录后操作',
'Uploaded successful' => '上传成功',
'You can upload up to %d file%s' => '你最多还可以上传%d个文件',
'You can choose up to %d file%s' => '你最多还可以选择%d个文件',
'Chunk file write error' => '分片写入失败',
'Chunk file info error' => '分片文件错误',
'Chunk file merge error' => '分片合并错误',
'Chunk file disabled' => '未开启分片上传功能',
'Cancel upload' => '取消上传',
'Upload canceled' => '上传已取消',
'No file upload or server upload limit exceeded' => '未上传文件或超出服务器上传限制',
'Uploaded file format is limited' => '上传文件格式受限制',
'Uploaded file is not a valid image' => '上传文件不是有效的图片文件',
'Are you sure you want to cancel this upload?' => '确定取消上传?',
'Remove file' => '移除文件',
'You can only upload a maximum of %s files' => '你最多允许上传 %s 个文件',
'You can\'t upload files of this type' => '不允许上传的文件类型',
'Server responded with %s code' => '服务端响应(Code:%s)',
'File is too big (%sMiB), Max filesize: %sMiB' => '当前上传(%sM),最大允许上传文件大小:%sM',
'Redirect now' => '立即跳转',
'Operation completed' => '操作成功!',
'Operation failed' => '操作失败!',
'Unknown data format' => '未知的数据格式!',
'Network error' => '网络错误!',
'Advanced search' => '高级搜索',
'Invalid parameters' => '未知参数',
'No results were found' => '记录未找到',
'Parameter %s can not be empty' => '参数%s不能为空',
'You have no permission' => '你没有权限访问',
'An unexpected error occurred' => '发生了一个意外错误,程序猿正在紧急处理中',
'This page will be re-directed in %s seconds' => '页面将在 %s 秒后自动跳转',
];
... ...
<?php
return [
'User center' => '会员中心',
'Register' => '注册',
'Login' => '登录',
'Sign up successful' => '注册成功',
'Username can not be empty' => '用户名不能为空',
'Username must be 3 to 30 characters' => '用户名必须3-30个字符',
'Username must be 6 to 30 characters' => '用户名必须6-30个字符',
'Password can not be empty' => '密码不能为空',
'Password must be 6 to 30 characters' => '密码必须6-30个字符',
'Mobile is incorrect' => '手机格式不正确',
'Username already exist' => '用户名已经存在',
'Nickname already exist' => '昵称已经存在',
'Email already exist' => '邮箱已经存在',
'Mobile already exist' => '手机号已经存在',
'Username is incorrect' => '用户名不正确',
'Email is incorrect' => '邮箱不正确',
'Account is locked' => '账户已经被锁定',
'Password is incorrect' => '密码不正确',
'Account is incorrect' => '账户不正确',
'Account not exist' => '账户不存在',
'Account can not be empty' => '账户不能为空',
'Username or password is incorrect' => '用户名或密码不正确',
'You are not logged in' => '你当前还未登录',
'You\'ve logged in, do not login again' => '你已经存在,请不要重复登录',
'Profile' => '个人资料',
'Verify email' => '邮箱验证',
'Change password' => '修改密码',
'Captcha is incorrect' => '验证码不正确',
'Logged in successful' => '登录成功',
'Logout successful' => '退出成功',
'Operation failed' => '操作失败',
'Invalid parameters' => '参数不正确',
'Change password failure' => '修改密码失败',
'Change password successful' => '修改密码成功',
'Reset password successful' => '重置密码成功',
];
... ...
<?php
namespace app\api\library;
use Exception;
use think\exception\Handle;
/**
* 自定义API模块的错误显示
*/
class ExceptionHandle extends Handle
{
public function render(Exception $e)
{
// 在生产环境下返回code信息
if (!\think\Config::get('app_debug')) {
$statuscode = $code = 500;
$msg = 'An error occurred';
// 验证异常
if ($e instanceof \think\exception\ValidateException) {
$code = 0;
$statuscode = 200;
$msg = $e->getError();
}
// Http异常
if ($e instanceof \think\exception\HttpException) {
$statuscode = $code = $e->getStatusCode();
}
return json(['code' => $code, 'msg' => $msg, 'time' => time(), 'data' => null], $statuscode);
}
//其它此交由系统处理
return parent::render($e);
}
}
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
... ...
.weixin-menu-setting {
margin: 0;
margin-bottom: 10px;
width: 100%;
}
.mobile-head-title {
color: #fff;
text-align: center;
padding-top: 33px;
font-size: 15px;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-wrap: normal;
margin: 0 40px 0 70px;
}
.weixin-body {
padding: 0;
margin: 0;
margin-left: 337px;
}
.weixin-content, .no-weixin-content {
background-color: #f4f5f9;
border: 1px solid #e7e7eb;
padding: 15px;
}
.no-weixin-content {
border: #fff;
background-color: #fff;
vertical-align: middle;
padding-top: 200px;
text-align: center;
}
@media (max-width: 720px) {
.weixin-body {
margin-left: 0;
margin-top: 560px;
}
}
.weixin-menu-title {
border-bottom: 1px solid #e7e7eb;
font-size: 16px;
padding: 0 20px;
line-height: 55px;
margin-bottom: 20px;
}
.mobile-menu-preview {
display: block;
float: left;
position: relative;
width: 317px;
height: 550px;
background: transparent url(../images/mobile_header_bg.png) no-repeat 0 0;
background-position: 0 0;
border: 1px solid #e7e7eb;
}
.mobile-menu-preview .menu-list {
position: absolute;
height: 50px;
bottom: 0;
left: 0;
right: 0;
border-top: 1px solid #e7e7eb;
background: transparent url(../images/mobile_footer_bg.png) no-repeat 0 0;
background-position: 0 0;
background-repeat: no-repeat;
padding-left: 43px;
margin: 0;
}
.menu-list .menu-item, .menu-list .add-item {
line-height: 50px;
position: relative;
float: left;
text-align: center;
width: 33.33%;
list-style: none;
}
.ui-sortable-placeholder {
background-color: #fff;
}
.menu-item a, .add-item a {
display: block;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-wrap: normal;
color: #616161;
text-decoration: none;
}
.menu-item.current a.menu-link {
border: 1px solid #44b549;
line-height: 48px;
background-color: #fff;
color: #44b549;
}
.menu-item .icon-menu-dot {
background: url(../images/mobile_index.png) 0 0 no-repeat;
width: 7px;
height: 7px;
vertical-align: middle;
display: inline-block;
margin-right: 2px;
margin-top: -2px;
bottom: 60px;
background-color: #fafafa;
border-top-width: 0;
}
.menu-item .menu-link, .add-item .menu-link {
border-left-width: 0;
border-left: 1px solid #e7e7eb;
text-align: center;
}
.sub-menu-item a, .add-sub-item a {
border: 1px solid #d0d0d0;
position: relative;
padding: 0 0.5em;
}
.sub-menu-item.current a {
border: 1px solid #44b549;
background-color: #fff;
color: #44b549;
z-index: 1;
}
.sub-menu-list li a:hover {
background: #f1f1f1;
}
.menu-item.current .menu-link {
border: 1px solid #44b549;
line-height: 48px;
background-color: #fff;
color: #44b549;
}
.sub-menu-box {
position: absolute;
bottom: 60px;
left: 0;
width: 100%;
background-color: #fff;
border-top: none;
}
.sub-menu-list {
line-height: 50px;
margin: 0;
padding: 0;
}
.sub-menu-list li {
line-height: 44px;
margin: -1px -1px 0;
list-style: none;
}
.sub-menu-box .arrow {
position: absolute;
left: 50%;
margin-left: -6px;
}
.sub-menu-box .arrow-in {
bottom: -5px;
display: inline-block;
width: 0;
height: 0;
border-width: 6px;
border-style: dashed;
border-color: transparent;
border-bottom-width: 0;
border-top-color: #fafafa;
border-top-style: solid;
}
.sub-menu-box .arrow-out {
bottom: -6px;
display: inline-block;
width: 0;
height: 0;
border-width: 6px;
border-style: dashed;
border-color: transparent;
border-bottom-width: 0;
border-top-color: #d0d0d0;
border-top-style: solid;
}
.sub-menu-item.current {
}
.sub-menu-inner-add {
display: block;
border-top: 1px solid #e7e7eb;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-wrap: normal;
cursor: pointer;
}
.weixin-icon {
background: url(../images/weixin_icon.png) 0 -4418px no-repeat;
width: 16px;
height: 16px;
vertical-align: middle;
display: inline-block;
line-height: 100px;
overflow: hidden;
}
.weixin-icon.add-gray {
background-position: 0 0;
}
.weixin-icon.sort-gray {
background: url(../images/weixin_icon.png) 0 -32px no-repeat;
background-position: 0 -32px;
margin-top: -1px;
display: none;
width: 20px;
}
.weixin-icon.big-add-gray {
background-position: -36px 0;
width: 36px;
height: 36px;
vertical-align: middle;
}
.menu-item a.menu-link:hover {
}
.add-item.extra, .add-item.extra {
float: none;
width: auto;
overflow: hidden;
}
table.btn-bar {
width: 100%;
}
table.btn-bar td {
text-align: center;
}
.item-info .item-head {
position: relative;
padding: 0;
border-bottom: 1px solid #e7e7eb;
}
.item-info .item-delete {
position: absolute;
top: 0;
right: 0;
}
table.weixin-form td {
vertical-align: middle;
height: 24px;
line-height: 24px;
padding: 8px 0;
}
#menu-content {
background-color: #fff;
padding: 16px 20px;
border: 1px solid #e7e7eb;
}
.menu-content-tips {
color: #8d8d8d;
padding-bottom: 10px;
}
.form-item dl {
position: relative;
margin: 10px 0;
}
.form-item dl dt {
width: 90px;
height: 30px;
line-height: 30px;
text-align: right;
position: absolute;
vertical-align: middle;
top: 0;
left: 0;
bottom: 0;
display: block;
}
.form-item dl dd {
position: relative;
display: block;
margin-left: 90px;
line-height: 30px;
}
.form-item .input-box {
display: inline-block;
position: relative;
height: 30px;
line-height: 30px;
vertical-align: middle;
width: 278px;
font-size: 14px;
padding: 0 10px;
border: 1px solid #e7e7eb;
box-shadow: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
border-radius: 0;
-moz-border-radius: 0;
-webkit-border-radius: 0;
background-color: #fff;
}
.form-item .input-box input {
width: 100%;
background-color: transparent;
border: 0;
outline: 0;
height: 30px;
}
.clickbox {
text-align: center;
margin: 40px 0;
}
.create-click {
display: inline-block;
padding-top: 30px;
position: relative;
width: 240px;
height: 120px;
border: 2px dotted #d9dadc;
text-align: center;
margin-bottom: 20px;
margin-left: 50px;
}
.create-click a {
display: block;
}
.create-click a strong {
display: block;
}
.keytitle {
position: absolute;
width: 100%;
text-align: center;
top: 0px;
height: 35px;
line-height: 35px;
background: #f4f5f9;
}
dl.is-item dd > label {
margin-left: 5px;
}
\ No newline at end of file
... ...