作者 jinglong

增加首页接口

... ... @@ -52,6 +52,7 @@ class User extends Backend
->select();
foreach ($list as $k => $v) {
$v->hidden(['password', 'salt']);
$v->nickname = \app\admin\model\User::emoji_decode($v->nickname);
}
$result = array("total" => $total, "rows" => $list);
... ...
... ... @@ -388,10 +388,8 @@ trait Backend
} else {
$reader = new Xlsx();
}
//导入文件首行类型,默认是注释,如果需要使用字段名称请使用name
$importHeadType = isset($this->importHeadType) ? $this->importHeadType : 'comment';
$table = $this->model->getQuery()->getTable();
$database = \think\Config::get('database.database');
$fieldArr = [];
... ... @@ -463,6 +461,7 @@ trait Backend
}
}
}
var_dump($insert);exit;
$this->model->saveAll($insert);
} catch (PDOException $exception) {
$msg = $exception->getMessage();
... ...
... ... @@ -106,4 +106,11 @@ class User extends Model
return $this->belongsTo('UserGroup', 'group_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
//字符转表情
public static function emoji_decode($str){
$strDecode = preg_replace_callback('|\[\[EMOJI:(.*?)\]\]|', function ($matches) {
return rawurldecode($matches[1]);
}, $str);
return $strDecode;
}
}
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\api\controller;
use think\Db;
use think\db\Query;
/**
* 公共方法
*/
class Common
{
/**
* 查找单条数据(有排序)
* @ApiInternal
*/
public static function findWhereData($table,$where,$field,$order='id desc'){
$res = Db::name($table)
->where($where)
->field($field)
->order($order)
->find();
return $res;
}
/**
* 查找单条数据(软删除)
* @ApiInternal
*/
public static function findSoftWhereData($table,$where,$field,$order='id desc'){
$res = Db::name($table)
->where($where)
->field($field)
->order($order)
->useSoftDelete('deletetime')
->find();
return $res;
}
/**
* 查找多条数据(无条件)
* @ApiInternal
*/
public static function selectData($table,$field,$order='id desc'){
$res = Db::name($table)
->field($field)
->order($order)
->select();
return $res;
}
/**
* 查找多条数据
* @ApiInternal
*/
public static function selectWhereData($table,$where,$field,$order='id desc'){
$res = Db::name($table)
->where($where)
->field($field)
->order($order)
->select();
return $res;
}
/**
* 查找多条数据
* @ApiInternal
*/
public static function selectSoftWhereData($table,$where,$field,$order='id desc'){
$res = Db::name($table)
->where($where)
->field($field)
->order($order)
->select();
return $res;
}
/**
* 单张相对路径转绝对路径
* @ApiInternal
*/
public static function absolutionUrlOne($image){
$url = '';
if(!empty($image)){
$host = config('verify.host');
$url = $host.$image;
}
return $url;
}
}
... ...
... ... @@ -13,11 +13,133 @@ class Index extends Api
protected $noNeedRight = ['*'];
/**
* 首页
*
* @ApiTitle (首页)
* @ApiSummary (首页)
* @ApiMethod (GET)
* @ApiRoute (/api/index/index)
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578463253",
"data": {
"banner": [//轮播图
{
"id": 2,//id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片路径
"sort": 0
},
{
"id": 1,
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",
"sort": 0
}
],
"thumbnail": {//缩略图
"introduce": "http://mite.w.brotop.cn/uploads/20200107/e0bf0b8d402b5447575389b8bd57c225.png",//公司简介缩略图
"service": "http://mite.w.brotop.cn/uploads/20200107/b48a6582d12da1fdafce424afbb3384d.png",//服务介绍缩略图
"experience": "http://mite.w.brotop.cn/uploads/20200107/95539a1899f02bda4fe1920597affe37.png",//服务体验缩略图
"center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员中心缩略图
}
}
})
*/
public function index()
{
$this->success('请求成功');
public function index(){
if($this->request->isGet()){
$arr = [];
//轮播图
$banner = Common::selectData('banner','id,image,sort','sort desc,id desc');
foreach ($banner as &$b_value){
$b_value['image'] = Common::absolutionUrlOne($b_value['image']);
}
$arr['banner'] = $banner;
//缩略图
$introduce = Common::findWhereData('platform',['id'=>1],'id,thumbnail');//公司简介
$service = Common::findWhereData('platform',['id'=>2],'id,thumbnail');//服务介绍
$experience = Common::findWhereData('platform',['id'=>3],'id,thumbnail');//服务体验
$center = Common::findWhereData('platform',['id'=>4],'id,thumbnail');//会员中心
$arr['thumbnail']['introduce'] = Common::absolutionUrlOne($introduce['thumbnail']);
$arr['thumbnail']['service'] = Common::absolutionUrlOne($service['thumbnail']);
$arr['thumbnail']['experience'] = Common::absolutionUrlOne($experience['thumbnail']);
$arr['thumbnail']['center'] = Common::absolutionUrlOne($center['thumbnail']);
$this->success('成功',$arr);
}else{
$this->error('请求方式错误');
}
}
/**
* @ApiTitle (公司简介详情)
* @ApiSummary (公司简介详情)
* @ApiMethod (GET)
* @ApiRoute (/api/index/introduceDetail)
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 1,//详情id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片
"content": "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lorem ipsum dolor sit amet, consectetu s"//内容(富文本)
}
})
*/
public function introduceDetail(){
if($this->request->isGet()){
$res = Common::findWhereData('platform',['id'=>1],'id,image,content');
$res['image'] = Common::absolutionUrlOne($res['image']);
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
/**
* @ApiTitle (服务介绍详情)
* @ApiSummary (服务介绍详情)
* @ApiMethod (GET)
* @ApiRoute (/api/index/serviceDetail)
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 2,//详情id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片
"content": "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lorem ipsum dolor sit amet, consectetu s"//内容(富文本)
}
})
*/
public function serviceDetail(){
if($this->request->isGet()){
$res = Common::findWhereData('platform',['id'=>2],'id,image,content');
$res['image'] = Common::absolutionUrlOne($res['image']);
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
/**
* @ApiTitle (服务体验详情)
* @ApiSummary (服务体验详情)
* @ApiMethod (GET)
* @ApiRoute (/api/index/experienceDetail)
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 3,//详情id
"content": "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lorem ipsum dolor sit amet, consectetu s"//内容
}
})
*/
public function experienceDetail(){
if($this->request->isGet()){
$res = Common::findWhereData('platform',['id'=>3],'id,content');
$this->success('成功',$res);
}else{
$this->error('请求方式错误');
}
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace app\api\controller;
use app\admin\model\Collection;
use app\admin\model\Free;
use app\admin\model\Rcoupon;
use app\common\controller\Api;
use fast\Http;
... ... @@ -91,4 +92,40 @@ class User extends Api
$this->error('请求方式错误');
}
}
/**
* @ApiTitle (免费预约)
* @ApiSummary (免费预约)
* @ApiMethod (POST)
* @ApiRoute (/api/user/freeBook)
* @ApiParams (name="user_name", type="string", required=true, description="姓名")
* @ApiParams (name="mobile", type="number", required=true, description="手机号")
* @ApiParams (name="province", type="string", required=true, description="省")
* @ApiParams (name="city", type="string", required=true, description="市")
* @ApiParams (name="district", type="string", required=true, description="区")
* @ApiParams (name="address", type="string", required=true, description="详细地址")
* @ApiReturn()
*/
public function freeBook(){
if($this->request->isPost()){
$data = $this->request->post();
//验证表数据
$rule = config('verify.free_book');
$validate = new Validate($rule['rule'],$rule['msg']);
if (!$validate->check($data)) {
$this->error($validate->getError());
}
$freeModel = new Free();
$data['uid'] = $this->uid;
$res = $freeModel->create($data);
if($res){
$this->success('成功');
}else{
$this->error('失败');
}
}else{
$this->error('请求方式错误');
}
}
}
... ...
... ... @@ -103,7 +103,7 @@ class Auth
$this->_user = $user;
$this->_logined = true;
$this->_token = $token;
$this->user_id = $user_id;
//初始化成功的事件
Hook::listen("user_init_successed", $this->_user);
... ...
... ... @@ -2,9 +2,10 @@
return [
//小程序参数
'raw' => [
'app_id' => 'wx322817859bfe5db1',//app_id
'secret' => '99031bb53087e80ae0ff93411f7ae01d',//秘钥
'app_id' => 'wxaf46d7ba4df8c0d2',//app_id(瑜伽的)
'secret' => '5d00cce7afaad45b27e16817d403b1dc',//秘钥(瑜伽的)
],
'host' => 'http://mite.w.brotop.cn',
//小程序登录
'user' => [
'rule' => [
... ... @@ -18,5 +19,24 @@ return [
'avatar' => '头像不能为空',
]
],
//免费预约
'free_book' => [
'rule' => [
'user_name' => 'require',
'mobile' => ['require','regex'=>'/^0?1[3|4|5|6|7|8|9][0-9]\d{8}$/'],
'province' => 'require',
'city' => 'require',
'district' => 'require',
'address' => 'require',
],
'msg' => [
'user_name.require'=> '姓名不能为空',
'mobile.require' => '手机号不能为空',
'mobile' => '手机号格式不正确',
'province.require' => '省不能为空',
'city.require' => '市不能为空',
'district.require' => '区不能为空',
'address.require' => '详细地址不能为空',
]
],
];
\ No newline at end of file
... ...
... ... @@ -139,17 +139,26 @@
<!-- menu -->
<div id="sidebar">
<div class="list-group panel">
<a href="#公共方法" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">公共方法 <i class="fa fa-caret-down"></i></a>
<div class="child collapse" id="公共方法">
</div>
<a href="#首页接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">首页接口 <i class="fa fa-caret-down"></i></a>
<div class="child collapse" id="首页接口">
<a href="javascript:;" data-id="0" class="list-group-item">首页</a>
<a href="javascript:;" data-id="1" class="list-group-item">公司简介详情</a>
<a href="javascript:;" data-id="2" class="list-group-item">服务介绍详情</a>
<a href="javascript:;" data-id="3" class="list-group-item">服务体验详情</a>
</div>
<a href="#个人中心接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">个人中心接口 <i class="fa fa-caret-down"></i></a>
<div class="child collapse" id="个人中心接口">
<a href="javascript:;" data-id="1" class="list-group-item">小程序登录</a>
<a href="javascript:;" data-id="4" class="list-group-item">小程序登录</a>
<a href="javascript:;" data-id="5" class="list-group-item">免费预约</a>
</div>
</div>
</div>
<div class="panel-group" id="accordion">
<h2>公共方法</h2>
<hr>
<h2>首页接口</h2>
<hr>
<div class="panel panel-default">
... ... @@ -200,7 +209,7 @@
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="get" name="form0" id="form0">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/index" method="GET" name="form0" id="form0">
<div class="form-group">
</div>
... ... @@ -235,7 +244,31 @@
<div class="tab-pane" id="sample0">
<div class="row">
<div class="col-md-12">
<pre id="sample_response0"></pre>
<pre id="sample_response0">{
"code": 1,
"msg": "成功",
"time": "1578463253",
"data": {
"banner": [//轮播图
{
"id": 2,//id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片路径
"sort": 0
},
{
"id": 1,
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",
"sort": 0
}
],
"thumbnail": {//缩略图
"introduce": "http://mite.w.brotop.cn/uploads/20200107/e0bf0b8d402b5447575389b8bd57c225.png",//公司简介缩略图
"service": "http://mite.w.brotop.cn/uploads/20200107/b48a6582d12da1fdafce424afbb3384d.png",//服务介绍缩略图
"experience": "http://mite.w.brotop.cn/uploads/20200107/95539a1899f02bda4fe1920597affe37.png",//服务体验缩略图
"center": "http://mite.w.brotop.cn/uploads/20200107/18e49cc54b697d369a143c9f1f369ac0.png"//会员中心缩略图
}
}
}</pre>
</div>
</div>
</div><!-- #sample -->
... ... @@ -244,13 +277,11 @@
</div>
</div>
</div>
<h2>个人中心接口</h2>
<hr>
<div class="panel panel-default">
<div class="panel-heading" id="heading-1">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion1" href="#collapseOne1"> 小程序登录 <span class="text-muted">/api/user/login</span></a>
<span class="label label-success">GET</span>
<a data-toggle="collapse" data-parent="#accordion1" href="#collapseOne1"> 公司简介详情 <span class="text-muted">/api/index/introduceDetail</span></a>
</h4>
</div>
<div id="collapseOne1" class="panel-collapse collapse">
... ... @@ -268,6 +299,310 @@
<div class="tab-pane active" id="info1">
<div class="well">
公司简介详情 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>正文</strong></div>
<div class="panel-body">
</div>
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox1">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/introduceDetail" method="GET" name="form1" id="form1">
<div class="form-group">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="1">提交</button>
<button type="reset" class="btn btn-info" rel="1">重置</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>响应输出</strong></div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers1"></pre>
<pre id="response1"></pre>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>返回参数</strong></div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample1">
<div class="row">
<div class="col-md-12">
<pre id="sample_response1">{
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 1,//详情id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片
"content": "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lorem ipsum dolor sit amet, consectetu s"//内容(富文本)
}
}</pre>
</div>
</div>
</div><!-- #sample -->
</div><!-- .tab-content -->
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-2">
<h4 class="panel-title">
<span class="label label-success">GET</span>
<a data-toggle="collapse" data-parent="#accordion2" href="#collapseOne2"> 服务介绍详情 <span class="text-muted">/api/index/serviceDetail</span></a>
</h4>
</div>
<div id="collapseOne2" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab2">
<li class="active"><a href="#info2" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox2" data-toggle="tab">在线测试</a></li>
<li><a href="#sample2" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info2">
<div class="well">
服务介绍详情 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>正文</strong></div>
<div class="panel-body">
</div>
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox2">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/serviceDetail" method="GET" name="form2" id="form2">
<div class="form-group">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="2">提交</button>
<button type="reset" class="btn btn-info" rel="2">重置</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>响应输出</strong></div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers2"></pre>
<pre id="response2"></pre>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>返回参数</strong></div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample2">
<div class="row">
<div class="col-md-12">
<pre id="sample_response2">{
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 2,//详情id
"image": "http://mite.w.brotop.cn/uploads/20200107/5ec13062630d25da83a305f5657822ee.png",//图片
"content": "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lorem ipsum dolor sit amet, consectetu s"//内容(富文本)
}
}</pre>
</div>
</div>
</div><!-- #sample -->
</div><!-- .tab-content -->
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-3">
<h4 class="panel-title">
<span class="label label-success">GET</span>
<a data-toggle="collapse" data-parent="#accordion3" href="#collapseOne3"> 服务体验详情 <span class="text-muted">/api/index/experienceDetail</span></a>
</h4>
</div>
<div id="collapseOne3" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab3">
<li class="active"><a href="#info3" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox3" data-toggle="tab">在线测试</a></li>
<li><a href="#sample3" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info3">
<div class="well">
服务体验详情 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>正文</strong></div>
<div class="panel-body">
</div>
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox3">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/index/experienceDetail" method="GET" name="form3" id="form3">
<div class="form-group">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="3">提交</button>
<button type="reset" class="btn btn-info" rel="3">重置</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>响应输出</strong></div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers3"></pre>
<pre id="response3"></pre>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>返回参数</strong></div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample3">
<div class="row">
<div class="col-md-12">
<pre id="sample_response3">{
"code": 1,
"msg": "成功",
"time": "1578463676",
"data": {
"id": 3,//详情id
"content": "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lorem ipsum dolor sit amet, consectetu s"//内容
}
}</pre>
</div>
</div>
</div><!-- #sample -->
</div><!-- .tab-content -->
</div>
</div>
</div>
<h2>个人中心接口</h2>
<hr>
<div class="panel panel-default">
<div class="panel-heading" id="heading-4">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion4" href="#collapseOne4"> 小程序登录 <span class="text-muted">/api/user/login</span></a>
</h4>
</div>
<div id="collapseOne4" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab4">
<li class="active"><a href="#info4" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox4" data-toggle="tab">在线测试</a></li>
<li><a href="#sample4" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info4">
<div class="well">
小程序登录 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
... ... @@ -317,13 +652,13 @@
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox1">
<div class="tab-pane" id="sandbox4">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/login" method="POST" name="form1" id="form1">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/login" method="POST" name="form4" id="form4">
<div class="form-group">
<label class="control-label" for="code">code</label>
<input type="string" class="form-control input-sm" id="code" required placeholder="小程序code" name="code">
... ... @@ -337,8 +672,8 @@
<input type="string" class="form-control input-sm" id="avatar" required placeholder="小程序头像" name="avatar">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="1">提交</button>
<button type="reset" class="btn btn-info" rel="1">重置</button>
<button type="submit" class="btn btn-success send" rel="4">提交</button>
<button type="reset" class="btn btn-info" rel="4">重置</button>
</div>
</form>
</div>
... ... @@ -348,8 +683,8 @@
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers1"></pre>
<pre id="response1"></pre>
<pre id="response_headers4"></pre>
<pre id="response4"></pre>
</div>
</div>
</div>
... ... @@ -364,10 +699,10 @@
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample1">
<div class="tab-pane" id="sample4">
<div class="row">
<div class="col-md-12">
<pre id="sample_response1">{
<pre id="sample_response4">{
"code": 1,
"msg": "登录成功",
"time": "1553839125",
... ... @@ -387,13 +722,173 @@
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-5">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion5" href="#collapseOne5"> 免费预约 <span class="text-muted">/api/user/freeBook</span></a>
</h4>
</div>
<div id="collapseOne5" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab5">
<li class="active"><a href="#info5" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox5" data-toggle="tab">在线测试</a></li>
<li><a href="#sample5" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info5">
<div class="well">
免费预约 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>user_name</td>
<td>string</td>
<td></td>
<td>姓名</td>
</tr>
<tr>
<td>mobile</td>
<td>number</td>
<td></td>
<td>手机号</td>
</tr>
<tr>
<td>province</td>
<td>string</td>
<td></td>
<td></td>
</tr>
<tr>
<td>city</td>
<td>string</td>
<td></td>
<td></td>
</tr>
<tr>
<td>district</td>
<td>string</td>
<td></td>
<td></td>
</tr>
<tr>
<td>address</td>
<td>string</td>
<td></td>
<td>详细地址</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>正文</strong></div>
<div class="panel-body">
</div>
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox5">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/api/user/freeBook" method="POST" name="form5" id="form5">
<div class="form-group">
<label class="control-label" for="user_name">user_name</label>
<input type="string" class="form-control input-sm" id="user_name" required placeholder="姓名" name="user_name">
</div>
<div class="form-group">
<label class="control-label" for="mobile">mobile</label>
<input type="number" class="form-control input-sm" id="mobile" required placeholder="手机号" name="mobile">
</div>
<div class="form-group">
<label class="control-label" for="province">province</label>
<input type="string" class="form-control input-sm" id="province" required placeholder="省" name="province">
</div>
<div class="form-group">
<label class="control-label" for="city">city</label>
<input type="string" class="form-control input-sm" id="city" required placeholder="市" name="city">
</div>
<div class="form-group">
<label class="control-label" for="district">district</label>
<input type="string" class="form-control input-sm" id="district" required placeholder="区" name="district">
</div>
<div class="form-group">
<label class="control-label" for="address">address</label>
<input type="string" class="form-control input-sm" id="address" required placeholder="详细地址" name="address">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="5">提交</button>
<button type="reset" class="btn btn-info" rel="5">重置</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>响应输出</strong></div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers5"></pre>
<pre id="response5"></pre>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>返回参数</strong></div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample5">
<div class="row">
<div class="col-md-12">
<pre id="sample_response5"></pre>
</div>
</div>
</div><!-- #sample -->
</div><!-- .tab-content -->
</div>
</div>
</div>
</div>
<hr>
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-01-07 16:30:24 </div>
Generated on 2020-01-08 14:47:17 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...
... ... @@ -25,21 +25,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{checkbox: true},
{field: 'id', title: __('Id'), sortable: true},
{field: 'group.name', title: __('Group')},
{field: 'username', title: __('Username'), operate: 'LIKE'},
// {field: 'group.name', title: __('Group')},
// {field: 'username', title: __('Username'), operate: 'LIKE'},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'email', title: __('Email'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
{field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
{field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
{field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
{field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
// {field: 'email', title: __('Email'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
// {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
// {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
// {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
{field: 'successions', title: __('Successions'), visible: false, operate: false, sortable: true},
{field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: false, sortable: true},
{field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: false, addclass: 'datetimerange', sortable: true},
// {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: false, addclass: 'datetimerange', sortable: true},
// {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
... ...