正在显示
56 个修改的文件
包含
1417 行增加
和
915 行删除
1 | -1 |
application/admin/controller/Banner.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 首页轮播图管理 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Banner extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Banner模型对象 | ||
17 | + * @var \app\admin\model\Banner | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\Banner; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
30 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
31 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
32 | + */ | ||
33 | + | ||
34 | + | ||
35 | +} |
application/admin/controller/Center.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 会员中心 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Center extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Platform模型对象 | ||
17 | + * @var \app\admin\model\Platform | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\Platform; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
30 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
31 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
32 | + */ | ||
33 | + | ||
34 | + /** | ||
35 | + * 查看 | ||
36 | + */ | ||
37 | + public function index() | ||
38 | + { | ||
39 | + //设置过滤方法 | ||
40 | + $this->request->filter(['strip_tags']); | ||
41 | + if ($this->request->isAjax()) { | ||
42 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
43 | + if ($this->request->request('keyField')) { | ||
44 | + return $this->selectpage(); | ||
45 | + } | ||
46 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
47 | + $total = $this->model | ||
48 | + ->where($where) | ||
49 | + ->where('id',4) | ||
50 | + ->order($sort, $order) | ||
51 | + ->count(); | ||
52 | + | ||
53 | + $list = $this->model | ||
54 | + ->where($where) | ||
55 | + ->where('id',4) | ||
56 | + ->order($sort, $order) | ||
57 | + ->limit($offset, $limit) | ||
58 | + ->select(); | ||
59 | + | ||
60 | + $list = collection($list)->toArray(); | ||
61 | + $result = array("total" => $total, "rows" => $list); | ||
62 | + | ||
63 | + return json($result); | ||
64 | + } | ||
65 | + return $this->view->fetch(); | ||
66 | + } | ||
67 | + | ||
68 | +} |
application/admin/controller/Experience.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 服务体验 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Experience extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Platform模型对象 | ||
17 | + * @var \app\admin\model\Platform | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\Platform; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
30 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
31 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
32 | + */ | ||
33 | + | ||
34 | + /** | ||
35 | + * 查看 | ||
36 | + */ | ||
37 | + public function index() | ||
38 | + { | ||
39 | + //设置过滤方法 | ||
40 | + $this->request->filter(['strip_tags']); | ||
41 | + if ($this->request->isAjax()) { | ||
42 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
43 | + if ($this->request->request('keyField')) { | ||
44 | + return $this->selectpage(); | ||
45 | + } | ||
46 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
47 | + $total = $this->model | ||
48 | + ->where($where) | ||
49 | + ->where('id',3) | ||
50 | + ->order($sort, $order) | ||
51 | + ->count(); | ||
52 | + | ||
53 | + $list = $this->model | ||
54 | + ->where($where) | ||
55 | + ->where('id',3) | ||
56 | + ->order($sort, $order) | ||
57 | + ->limit($offset, $limit) | ||
58 | + ->select(); | ||
59 | + | ||
60 | + $list = collection($list)->toArray(); | ||
61 | + $result = array("total" => $total, "rows" => $list); | ||
62 | + | ||
63 | + return json($result); | ||
64 | + } | ||
65 | + return $this->view->fetch(); | ||
66 | + } | ||
67 | + | ||
68 | +} |
application/admin/controller/Platform.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 公司介绍 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Platform extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Platform模型对象 | ||
17 | + * @var \app\admin\model\Platform | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\Platform; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
30 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
31 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
32 | + */ | ||
33 | + | ||
34 | + /** | ||
35 | + * 查看 | ||
36 | + */ | ||
37 | + public function index() | ||
38 | + { | ||
39 | + //设置过滤方法 | ||
40 | + $this->request->filter(['strip_tags']); | ||
41 | + if ($this->request->isAjax()) { | ||
42 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
43 | + if ($this->request->request('keyField')) { | ||
44 | + return $this->selectpage(); | ||
45 | + } | ||
46 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
47 | + $total = $this->model | ||
48 | + ->where($where) | ||
49 | + ->where('id',1) | ||
50 | + ->order($sort, $order) | ||
51 | + ->count(); | ||
52 | + | ||
53 | + $list = $this->model | ||
54 | + ->where($where) | ||
55 | + ->where('id',1) | ||
56 | + ->order($sort, $order) | ||
57 | + ->limit($offset, $limit) | ||
58 | + ->select(); | ||
59 | + | ||
60 | + $list = collection($list)->toArray(); | ||
61 | + $result = array("total" => $total, "rows" => $list); | ||
62 | + | ||
63 | + return json($result); | ||
64 | + } | ||
65 | + return $this->view->fetch(); | ||
66 | + } | ||
67 | + | ||
68 | +} |
application/admin/controller/Service.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 服务介绍 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Service extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Platform模型对象 | ||
17 | + * @var \app\admin\model\Platform | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\Platform; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + /** | ||
29 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
30 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
31 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
32 | + */ | ||
33 | + | ||
34 | + /** | ||
35 | + * 查看 | ||
36 | + */ | ||
37 | + public function index() | ||
38 | + { | ||
39 | + //设置过滤方法 | ||
40 | + $this->request->filter(['strip_tags']); | ||
41 | + if ($this->request->isAjax()) { | ||
42 | + //如果发送的来源是Selectpage,则转发到Selectpage | ||
43 | + if ($this->request->request('keyField')) { | ||
44 | + return $this->selectpage(); | ||
45 | + } | ||
46 | + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | ||
47 | + $total = $this->model | ||
48 | + ->where($where) | ||
49 | + ->where('id',2) | ||
50 | + ->order($sort, $order) | ||
51 | + ->count(); | ||
52 | + | ||
53 | + $list = $this->model | ||
54 | + ->where($where) | ||
55 | + ->where('id',2) | ||
56 | + ->order($sort, $order) | ||
57 | + ->limit($offset, $limit) | ||
58 | + ->select(); | ||
59 | + | ||
60 | + $list = collection($list)->toArray(); | ||
61 | + $result = array("total" => $total, "rows" => $list); | ||
62 | + | ||
63 | + return json($result); | ||
64 | + } | ||
65 | + return $this->view->fetch(); | ||
66 | + } | ||
67 | + | ||
68 | +} |
application/admin/lang/zh-cn/banner.php
0 → 100644
application/admin/lang/zh-cn/center.php
0 → 100644
application/admin/lang/zh-cn/experience.php
0 → 100644
application/admin/lang/zh-cn/platform.php
0 → 100644
application/admin/lang/zh-cn/service.php
0 → 100644
application/admin/model/Banner.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class Banner extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'banner'; | ||
17 | + | ||
18 | + // 自动写入时间戳字段 | ||
19 | + protected $autoWriteTimestamp = 'int'; | ||
20 | + | ||
21 | + // 定义时间戳字段名 | ||
22 | + protected $createTime = 'createtime'; | ||
23 | + protected $updateTime = 'updatetime'; | ||
24 | + protected $deleteTime = false; | ||
25 | + | ||
26 | + // 追加属性 | ||
27 | + protected $append = [ | ||
28 | + | ||
29 | + ]; | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | +} |
application/admin/model/Platform.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class Platform extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'platform'; | ||
17 | + | ||
18 | + // 自动写入时间戳字段 | ||
19 | + protected $autoWriteTimestamp = 'int'; | ||
20 | + | ||
21 | + // 定义时间戳字段名 | ||
22 | + protected $createTime = 'createtime'; | ||
23 | + protected $updateTime = 'updatetime'; | ||
24 | + protected $deleteTime = false; | ||
25 | + | ||
26 | + // 追加属性 | ||
27 | + protected $append = [ | ||
28 | + | ||
29 | + ]; | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | +} |
application/admin/validate/Banner.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Banner extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
application/admin/validate/Center.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Center extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
application/admin/validate/Experience.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Experience extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
application/admin/validate/Platform.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Platform extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
application/admin/validate/Service.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Service extends Validate | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 验证规则 | ||
11 | + */ | ||
12 | + protected $rule = [ | ||
13 | + ]; | ||
14 | + /** | ||
15 | + * 提示消息 | ||
16 | + */ | ||
17 | + protected $message = [ | ||
18 | + ]; | ||
19 | + /** | ||
20 | + * 验证场景 | ||
21 | + */ | ||
22 | + protected $scene = [ | ||
23 | + 'add' => [], | ||
24 | + 'edit' => [], | ||
25 | + ]; | ||
26 | + | ||
27 | +} |
application/admin/view/banner/add.html
0 → 100644
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <div class="input-group"> | ||
7 | + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text"> | ||
8 | + <div class="input-group-addon no-border no-padding"> | ||
9 | + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
10 | + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
11 | + </div> | ||
12 | + <span class="msg-box n-right" for="c-image"></span> | ||
13 | + </div> | ||
14 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <div class="form-group"> | ||
18 | + <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label> | ||
19 | + <div class="col-xs-12 col-sm-8"> | ||
20 | + <input id="c-sort" data-rule="required" class="form-control" name="row[sort]" type="number" value="0"> | ||
21 | + </div> | ||
22 | + </div> | ||
23 | + <div class="form-group layer-footer"> | ||
24 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
25 | + <div class="col-xs-12 col-sm-8"> | ||
26 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
27 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
28 | + </div> | ||
29 | + </div> | ||
30 | +</form> |
application/admin/view/banner/edit.html
0 → 100644
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <div class="input-group"> | ||
7 | + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}"> | ||
8 | + <div class="input-group-addon no-border no-padding"> | ||
9 | + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
10 | + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
11 | + </div> | ||
12 | + <span class="msg-box n-right" for="c-image"></span> | ||
13 | + </div> | ||
14 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <div class="form-group"> | ||
18 | + <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label> | ||
19 | + <div class="col-xs-12 col-sm-8"> | ||
20 | + <input id="c-sort" data-rule="required" class="form-control" name="row[sort]" type="number" value="{$row.sort|htmlentities}"> | ||
21 | + </div> | ||
22 | + </div> | ||
23 | + <div class="form-group layer-footer"> | ||
24 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
25 | + <div class="col-xs-12 col-sm-8"> | ||
26 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
27 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
28 | + </div> | ||
29 | + </div> | ||
30 | +</form> |
application/admin/view/banner/index.html
0 → 100644
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
10 | + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('banner/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a> | ||
11 | + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('banner/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | ||
12 | + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('banner/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | ||
13 | + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('banner/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> | ||
14 | + | ||
15 | + <!--<div class="dropdown btn-group {:$auth->check('banner/multi')?'':'hide'}">--> | ||
16 | + <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | ||
17 | + <!--<ul class="dropdown-menu text-left" role="menu">--> | ||
18 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>--> | ||
19 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>--> | ||
20 | + <!--</ul>--> | ||
21 | + <!--</div>--> | ||
22 | + | ||
23 | + | ||
24 | + </div> | ||
25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
26 | + data-operate-edit="{:$auth->check('banner/edit')}" | ||
27 | + data-operate-del="{:$auth->check('banner/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
application/admin/view/center/edit.html
0 → 100644
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <div class="input-group"> | ||
7 | + <input id="c-thumbnail" data-rule="required" class="form-control" size="50" name="row[thumbnail]" type="text" value="{$row.thumbnail|htmlentities}"> | ||
8 | + <div class="input-group-addon no-border no-padding"> | ||
9 | + <span><button type="button" id="plupload-thumbnail" class="btn btn-danger plupload" data-input-id="c-thumbnail" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-thumbnail"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
10 | + <span><button type="button" id="fachoose-thumbnail" class="btn btn-primary fachoose" data-input-id="c-thumbnail" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
11 | + </div> | ||
12 | + <span class="msg-box n-right" for="c-thumbnail"></span> | ||
13 | + </div> | ||
14 | + <ul class="row list-inline plupload-preview" id="p-thumbnail"></ul> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + | ||
18 | + <div class="form-group layer-footer"> | ||
19 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
20 | + <div class="col-xs-12 col-sm-8"> | ||
21 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
22 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
23 | + </div> | ||
24 | + </div> | ||
25 | +</form> |
application/admin/view/center/index.html
0 → 100644
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
10 | + <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('center/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>--> | ||
11 | + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('center/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | ||
12 | + <!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('center/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> | ||
13 | + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('center/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> | ||
14 | + | ||
15 | + <!--<div class="dropdown btn-group {:$auth->check('center/multi')?'':'hide'}">--> | ||
16 | + <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | ||
17 | + <!--<ul class="dropdown-menu text-left" role="menu">--> | ||
18 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>--> | ||
19 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>--> | ||
20 | + <!--</ul>--> | ||
21 | + <!--</div>--> | ||
22 | + | ||
23 | + | ||
24 | + </div> | ||
25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
26 | + data-operate-edit="{:$auth->check('center/edit')}" | ||
27 | + data-operate-del="{:$auth->check('center/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
application/admin/view/experience/edit.html
0 → 100644
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <div class="input-group"> | ||
7 | + <input id="c-thumbnail" data-rule="required" class="form-control" size="50" name="row[thumbnail]" type="text" value="{$row.thumbnail|htmlentities}"> | ||
8 | + <div class="input-group-addon no-border no-padding"> | ||
9 | + <span><button type="button" id="plupload-thumbnail" class="btn btn-danger plupload" data-input-id="c-thumbnail" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-thumbnail"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
10 | + <span><button type="button" id="fachoose-thumbnail" class="btn btn-primary fachoose" data-input-id="c-thumbnail" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
11 | + </div> | ||
12 | + <span class="msg-box n-right" for="c-thumbnail"></span> | ||
13 | + </div> | ||
14 | + <ul class="row list-inline plupload-preview" id="p-thumbnail"></ul> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + | ||
18 | + <div class="form-group"> | ||
19 | + <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
20 | + <div class="col-xs-12 col-sm-8"> | ||
21 | + <textarea id="c-content" data-rule="required" class="form-control" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea> | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + <div class="form-group layer-footer"> | ||
25 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
26 | + <div class="col-xs-12 col-sm-8"> | ||
27 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
28 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
29 | + </div> | ||
30 | + </div> | ||
31 | +</form> |
application/admin/view/experience/index.html
0 → 100644
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
10 | + <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('experience/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>--> | ||
11 | + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('experience/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | ||
12 | + <!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('experience/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> | ||
13 | + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('experience/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> | ||
14 | + | ||
15 | + <!--<div class="dropdown btn-group {:$auth->check('experience/multi')?'':'hide'}">--> | ||
16 | + <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | ||
17 | + <!--<ul class="dropdown-menu text-left" role="menu">--> | ||
18 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>--> | ||
19 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>--> | ||
20 | + <!--</ul>--> | ||
21 | + <!--</div>--> | ||
22 | + | ||
23 | + | ||
24 | + </div> | ||
25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
26 | + data-operate-edit="{:$auth->check('experience/edit')}" | ||
27 | + data-operate-del="{:$auth->check('experience/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
application/admin/view/platform/add.html
0 → 100644
1 | +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <div class="input-group"> | ||
7 | + <input id="c-thumbnail" data-rule="required" class="form-control" size="50" name="row[thumbnail]" type="text"> | ||
8 | + <div class="input-group-addon no-border no-padding"> | ||
9 | + <span><button type="button" id="plupload-thumbnail" class="btn btn-danger plupload" data-input-id="c-thumbnail" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-thumbnail"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
10 | + <span><button type="button" id="fachoose-thumbnail" class="btn btn-primary fachoose" data-input-id="c-thumbnail" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
11 | + </div> | ||
12 | + <span class="msg-box n-right" for="c-thumbnail"></span> | ||
13 | + </div> | ||
14 | + <ul class="row list-inline plupload-preview" id="p-thumbnail"></ul> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <div class="form-group"> | ||
18 | + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
19 | + <div class="col-xs-12 col-sm-8"> | ||
20 | + <div class="input-group"> | ||
21 | + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text"> | ||
22 | + <div class="input-group-addon no-border no-padding"> | ||
23 | + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
24 | + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
25 | + </div> | ||
26 | + <span class="msg-box n-right" for="c-image"></span> | ||
27 | + </div> | ||
28 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
29 | + </div> | ||
30 | + </div> | ||
31 | + <div class="form-group"> | ||
32 | + <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
33 | + <div class="col-xs-12 col-sm-8"> | ||
34 | + <textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea> | ||
35 | + </div> | ||
36 | + </div> | ||
37 | + <div class="form-group layer-footer"> | ||
38 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
39 | + <div class="col-xs-12 col-sm-8"> | ||
40 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
41 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | +</form> |
application/admin/view/platform/edit.html
0 → 100644
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <div class="input-group"> | ||
7 | + <input id="c-thumbnail" data-rule="required" class="form-control" size="50" name="row[thumbnail]" type="text" value="{$row.thumbnail|htmlentities}"> | ||
8 | + <div class="input-group-addon no-border no-padding"> | ||
9 | + <span><button type="button" id="plupload-thumbnail" class="btn btn-danger plupload" data-input-id="c-thumbnail" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-thumbnail"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
10 | + <span><button type="button" id="fachoose-thumbnail" class="btn btn-primary fachoose" data-input-id="c-thumbnail" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
11 | + </div> | ||
12 | + <span class="msg-box n-right" for="c-thumbnail"></span> | ||
13 | + </div> | ||
14 | + <ul class="row list-inline plupload-preview" id="p-thumbnail"></ul> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <div class="form-group"> | ||
18 | + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
19 | + <div class="col-xs-12 col-sm-8"> | ||
20 | + <div class="input-group"> | ||
21 | + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}"> | ||
22 | + <div class="input-group-addon no-border no-padding"> | ||
23 | + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
24 | + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
25 | + </div> | ||
26 | + <span class="msg-box n-right" for="c-image"></span> | ||
27 | + </div> | ||
28 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
29 | + </div> | ||
30 | + </div> | ||
31 | + <div class="form-group"> | ||
32 | + <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
33 | + <div class="col-xs-12 col-sm-8"> | ||
34 | + <textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea> | ||
35 | + </div> | ||
36 | + </div> | ||
37 | + <div class="form-group layer-footer"> | ||
38 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
39 | + <div class="col-xs-12 col-sm-8"> | ||
40 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
41 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | +</form> |
application/admin/view/platform/index.html
0 → 100644
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
10 | + <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('platform/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>--> | ||
11 | + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('platform/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | ||
12 | + <!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('platform/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> | ||
13 | + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('platform/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> | ||
14 | + | ||
15 | + <!--<div class="dropdown btn-group {:$auth->check('platform/multi')?'':'hide'}">--> | ||
16 | + <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | ||
17 | + <!--<ul class="dropdown-menu text-left" role="menu">--> | ||
18 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>--> | ||
19 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>--> | ||
20 | + <!--</ul>--> | ||
21 | + <!--</div>--> | ||
22 | + | ||
23 | + | ||
24 | + </div> | ||
25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
26 | + data-operate-edit="{:$auth->check('platform/edit')}" | ||
27 | + data-operate-del="{:$auth->check('platform/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
application/admin/view/service/edit.html
0 → 100644
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2">{:__('Thumbnail')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <div class="input-group"> | ||
7 | + <input id="c-thumbnail" data-rule="required" class="form-control" size="50" name="row[thumbnail]" type="text" value="{$row.thumbnail|htmlentities}"> | ||
8 | + <div class="input-group-addon no-border no-padding"> | ||
9 | + <span><button type="button" id="plupload-thumbnail" class="btn btn-danger plupload" data-input-id="c-thumbnail" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-thumbnail"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
10 | + <span><button type="button" id="fachoose-thumbnail" class="btn btn-primary fachoose" data-input-id="c-thumbnail" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
11 | + </div> | ||
12 | + <span class="msg-box n-right" for="c-thumbnail"></span> | ||
13 | + </div> | ||
14 | + <ul class="row list-inline plupload-preview" id="p-thumbnail"></ul> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | + <div class="form-group"> | ||
18 | + <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label> | ||
19 | + <div class="col-xs-12 col-sm-8"> | ||
20 | + <div class="input-group"> | ||
21 | + <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}"> | ||
22 | + <div class="input-group-addon no-border no-padding"> | ||
23 | + <span><button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span> | ||
24 | + <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span> | ||
25 | + </div> | ||
26 | + <span class="msg-box n-right" for="c-image"></span> | ||
27 | + </div> | ||
28 | + <ul class="row list-inline plupload-preview" id="p-image"></ul> | ||
29 | + </div> | ||
30 | + </div> | ||
31 | + <div class="form-group"> | ||
32 | + <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label> | ||
33 | + <div class="col-xs-12 col-sm-8"> | ||
34 | + <textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea> | ||
35 | + </div> | ||
36 | + </div> | ||
37 | + <div class="form-group layer-footer"> | ||
38 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
39 | + <div class="col-xs-12 col-sm-8"> | ||
40 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
41 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | +</form> |
application/admin/view/service/index.html
0 → 100644
1 | +<div class="panel panel-default panel-intro"> | ||
2 | + {:build_heading()} | ||
3 | + | ||
4 | + <div class="panel-body"> | ||
5 | + <div id="myTabContent" class="tab-content"> | ||
6 | + <div class="tab-pane fade active in" id="one"> | ||
7 | + <div class="widget-body no-padding"> | ||
8 | + <div id="toolbar" class="toolbar"> | ||
9 | + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a> | ||
10 | + <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('service/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>--> | ||
11 | + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('service/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a> | ||
12 | + <!--<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('service/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> | ||
13 | + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('service/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>--> | ||
14 | + | ||
15 | + <!--<div class="dropdown btn-group {:$auth->check('service/multi')?'':'hide'}">--> | ||
16 | + <!--<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>--> | ||
17 | + <!--<ul class="dropdown-menu text-left" role="menu">--> | ||
18 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>--> | ||
19 | + <!--<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>--> | ||
20 | + <!--</ul>--> | ||
21 | + <!--</div>--> | ||
22 | + | ||
23 | + | ||
24 | + </div> | ||
25 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
26 | + data-operate-edit="{:$auth->check('service/edit')}" | ||
27 | + data-operate-del="{:$auth->check('service/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
application/api/controller/Common.php
已删除
100644 → 0
1 | -<?php | ||
2 | - | ||
3 | -namespace app\api\controller; | ||
4 | - | ||
5 | -use app\common\controller\Api; | ||
6 | -use app\common\model\Area; | ||
7 | -use app\common\model\Version; | ||
8 | -use fast\Random; | ||
9 | -use think\Config; | ||
10 | - | ||
11 | -/** | ||
12 | - * 公共接口 | ||
13 | - */ | ||
14 | -class Common extends Api | ||
15 | -{ | ||
16 | - protected $noNeedLogin = ['init']; | ||
17 | - protected $noNeedRight = '*'; | ||
18 | - | ||
19 | - /** | ||
20 | - * 加载初始化 | ||
21 | - * | ||
22 | - * @param string $version 版本号 | ||
23 | - * @param string $lng 经度 | ||
24 | - * @param string $lat 纬度 | ||
25 | - */ | ||
26 | - public function init() | ||
27 | - { | ||
28 | - if ($version = $this->request->request('version')) { | ||
29 | - $lng = $this->request->request('lng'); | ||
30 | - $lat = $this->request->request('lat'); | ||
31 | - $content = [ | ||
32 | - 'citydata' => Area::getCityFromLngLat($lng, $lat), | ||
33 | - 'versiondata' => Version::check($version), | ||
34 | - 'uploaddata' => Config::get('upload'), | ||
35 | - 'coverdata' => Config::get("cover"), | ||
36 | - ]; | ||
37 | - $this->success('', $content); | ||
38 | - } else { | ||
39 | - $this->error(__('Invalid parameters')); | ||
40 | - } | ||
41 | - } | ||
42 | - | ||
43 | - /** | ||
44 | - * 上传文件 | ||
45 | - * @ApiMethod (POST) | ||
46 | - * @param File $file 文件流 | ||
47 | - */ | ||
48 | - public function upload() | ||
49 | - { | ||
50 | - $file = $this->request->file('file'); | ||
51 | - if (empty($file)) { | ||
52 | - $this->error(__('No file upload or server upload limit exceeded')); | ||
53 | - } | ||
54 | - | ||
55 | - //判断是否已经存在附件 | ||
56 | - $sha1 = $file->hash(); | ||
57 | - | ||
58 | - $upload = Config::get('upload'); | ||
59 | - | ||
60 | - preg_match('/(\d+)(\w+)/', $upload['maxsize'], $matches); | ||
61 | - $type = strtolower($matches[2]); | ||
62 | - $typeDict = ['b' => 0, 'k' => 1, 'kb' => 1, 'm' => 2, 'mb' => 2, 'gb' => 3, 'g' => 3]; | ||
63 | - $size = (int)$upload['maxsize'] * pow(1024, isset($typeDict[$type]) ? $typeDict[$type] : 0); | ||
64 | - $fileInfo = $file->getInfo(); | ||
65 | - $suffix = strtolower(pathinfo($fileInfo['name'], PATHINFO_EXTENSION)); | ||
66 | - $suffix = $suffix && preg_match("/^[a-zA-Z0-9]+$/", $suffix) ? $suffix : 'file'; | ||
67 | - | ||
68 | - $mimetypeArr = explode(',', strtolower($upload['mimetype'])); | ||
69 | - $typeArr = explode('/', $fileInfo['type']); | ||
70 | - | ||
71 | - //禁止上传PHP和HTML文件 | ||
72 | - if (in_array($fileInfo['type'], ['text/x-php', 'text/html']) || in_array($suffix, ['php', 'html', 'htm'])) { | ||
73 | - $this->error(__('Uploaded file format is limited')); | ||
74 | - } | ||
75 | - //验证文件后缀 | ||
76 | - if ($upload['mimetype'] !== '*' && | ||
77 | - ( | ||
78 | - !in_array($suffix, $mimetypeArr) | ||
79 | - || (stripos($typeArr[0] . '/', $upload['mimetype']) !== false && (!in_array($fileInfo['type'], $mimetypeArr) && !in_array($typeArr[0] . '/*', $mimetypeArr))) | ||
80 | - ) | ||
81 | - ) { | ||
82 | - $this->error(__('Uploaded file format is limited')); | ||
83 | - } | ||
84 | - //验证是否为图片文件 | ||
85 | - $imagewidth = $imageheight = 0; | ||
86 | - if (in_array($fileInfo['type'], ['image/gif', 'image/jpg', 'image/jpeg', 'image/bmp', 'image/png', 'image/webp']) || in_array($suffix, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'webp'])) { | ||
87 | - $imgInfo = getimagesize($fileInfo['tmp_name']); | ||
88 | - if (!$imgInfo || !isset($imgInfo[0]) || !isset($imgInfo[1])) { | ||
89 | - $this->error(__('Uploaded file is not a valid image')); | ||
90 | - } | ||
91 | - $imagewidth = isset($imgInfo[0]) ? $imgInfo[0] : $imagewidth; | ||
92 | - $imageheight = isset($imgInfo[1]) ? $imgInfo[1] : $imageheight; | ||
93 | - } | ||
94 | - $replaceArr = [ | ||
95 | - '{year}' => date("Y"), | ||
96 | - '{mon}' => date("m"), | ||
97 | - '{day}' => date("d"), | ||
98 | - '{hour}' => date("H"), | ||
99 | - '{min}' => date("i"), | ||
100 | - '{sec}' => date("s"), | ||
101 | - '{random}' => Random::alnum(16), | ||
102 | - '{random32}' => Random::alnum(32), | ||
103 | - '{filename}' => $suffix ? substr($fileInfo['name'], 0, strripos($fileInfo['name'], '.')) : $fileInfo['name'], | ||
104 | - '{suffix}' => $suffix, | ||
105 | - '{.suffix}' => $suffix ? '.' . $suffix : '', | ||
106 | - '{filemd5}' => md5_file($fileInfo['tmp_name']), | ||
107 | - ]; | ||
108 | - $savekey = $upload['savekey']; | ||
109 | - $savekey = str_replace(array_keys($replaceArr), array_values($replaceArr), $savekey); | ||
110 | - | ||
111 | - $uploadDir = substr($savekey, 0, strripos($savekey, '/') + 1); | ||
112 | - $fileName = substr($savekey, strripos($savekey, '/') + 1); | ||
113 | - // | ||
114 | - $splInfo = $file->validate(['size' => $size])->move(ROOT_PATH . '/public' . $uploadDir, $fileName); | ||
115 | - if ($splInfo) { | ||
116 | - $params = array( | ||
117 | - 'admin_id' => 0, | ||
118 | - 'user_id' => (int)$this->auth->id, | ||
119 | - 'filesize' => $fileInfo['size'], | ||
120 | - 'imagewidth' => $imagewidth, | ||
121 | - 'imageheight' => $imageheight, | ||
122 | - 'imagetype' => $suffix, | ||
123 | - 'imageframes' => 0, | ||
124 | - 'mimetype' => $fileInfo['type'], | ||
125 | - 'url' => $uploadDir . $splInfo->getSaveName(), | ||
126 | - 'uploadtime' => time(), | ||
127 | - 'storage' => 'local', | ||
128 | - 'sha1' => $sha1, | ||
129 | - ); | ||
130 | - $attachment = model("attachment"); | ||
131 | - $attachment->data(array_filter($params)); | ||
132 | - $attachment->save(); | ||
133 | - \think\Hook::listen("upload_after", $attachment); | ||
134 | - $this->success(__('Upload successful'), [ | ||
135 | - 'url' => $uploadDir . $splInfo->getSaveName() | ||
136 | - ]); | ||
137 | - } else { | ||
138 | - // 上传失败获取错误信息 | ||
139 | - $this->error($file->getError()); | ||
140 | - } | ||
141 | - } | ||
142 | -} |
application/api/controller/Demo.php
已删除
100644 → 0
1 | -<?php | ||
2 | - | ||
3 | -namespace app\api\controller; | ||
4 | - | ||
5 | -use app\common\controller\Api; | ||
6 | - | ||
7 | -/** | ||
8 | - * 示例接口 | ||
9 | - */ | ||
10 | -class Demo extends Api | ||
11 | -{ | ||
12 | - | ||
13 | - //如果$noNeedLogin为空表示所有接口都需要登录才能请求 | ||
14 | - //如果$noNeedRight为空表示所有接口都需要验证权限才能请求 | ||
15 | - //如果接口已经设置无需登录,那也就无需鉴权了 | ||
16 | - // | ||
17 | - // 无需登录的接口,*表示全部 | ||
18 | - protected $noNeedLogin = ['test', 'test1']; | ||
19 | - // 无需鉴权的接口,*表示全部 | ||
20 | - protected $noNeedRight = ['test2']; | ||
21 | - | ||
22 | - /** | ||
23 | - * 测试方法 | ||
24 | - * | ||
25 | - * @ApiTitle (测试名称) | ||
26 | - * @ApiSummary (测试描述信息) | ||
27 | - * @ApiMethod (POST) | ||
28 | - * @ApiRoute (/api/demo/test/id/{id}/name/{name}) | ||
29 | - * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
30 | - * @ApiParams (name="id", type="integer", required=true, description="会员ID") | ||
31 | - * @ApiParams (name="name", type="string", required=true, description="用户名") | ||
32 | - * @ApiParams (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据") | ||
33 | - * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
34 | - * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
35 | - * @ApiReturnParams (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据返回") | ||
36 | - * @ApiReturn ({ | ||
37 | - 'code':'1', | ||
38 | - 'msg':'返回成功' | ||
39 | - }) | ||
40 | - */ | ||
41 | - public function test() | ||
42 | - { | ||
43 | - $this->success('返回成功', $this->request->param()); | ||
44 | - } | ||
45 | - | ||
46 | - /** | ||
47 | - * 无需登录的接口 | ||
48 | - * | ||
49 | - */ | ||
50 | - public function test1() | ||
51 | - { | ||
52 | - $this->success('返回成功', ['action' => 'test1']); | ||
53 | - } | ||
54 | - | ||
55 | - /** | ||
56 | - * 需要登录的接口 | ||
57 | - * | ||
58 | - */ | ||
59 | - public function test2() | ||
60 | - { | ||
61 | - $this->success('返回成功', ['action' => 'test2']); | ||
62 | - } | ||
63 | - | ||
64 | - /** | ||
65 | - * 需要登录且需要验证有相应组的权限 | ||
66 | - * | ||
67 | - */ | ||
68 | - public function test3() | ||
69 | - { | ||
70 | - $this->success('返回成功', ['action' => 'test3']); | ||
71 | - } | ||
72 | - | ||
73 | -} |
application/api/controller/Ems.php
已删除
100644 → 0
1 | -<?php | ||
2 | - | ||
3 | -namespace app\api\controller; | ||
4 | - | ||
5 | -use app\common\controller\Api; | ||
6 | -use app\common\library\Ems as Emslib; | ||
7 | -use app\common\model\User; | ||
8 | - | ||
9 | -/** | ||
10 | - * 邮箱验证码接口 | ||
11 | - */ | ||
12 | -class Ems extends Api | ||
13 | -{ | ||
14 | - protected $noNeedLogin = '*'; | ||
15 | - protected $noNeedRight = '*'; | ||
16 | - | ||
17 | - public function _initialize() | ||
18 | - { | ||
19 | - parent::_initialize(); | ||
20 | - \think\Hook::add('ems_send', function ($params) { | ||
21 | - $obj = \app\common\library\Email::instance(); | ||
22 | - $result = $obj | ||
23 | - ->to($params->email) | ||
24 | - ->subject('验证码') | ||
25 | - ->message("你的验证码是:" . $params->code) | ||
26 | - ->send(); | ||
27 | - return $result; | ||
28 | - }); | ||
29 | - } | ||
30 | - | ||
31 | - /** | ||
32 | - * 发送验证码 | ||
33 | - * | ||
34 | - * @param string $email 邮箱 | ||
35 | - * @param string $event 事件名称 | ||
36 | - */ | ||
37 | - public function send() | ||
38 | - { | ||
39 | - $email = $this->request->request("email"); | ||
40 | - $event = $this->request->request("event"); | ||
41 | - $event = $event ? $event : 'register'; | ||
42 | - | ||
43 | - $last = Emslib::get($email, $event); | ||
44 | - if ($last && time() - $last['createtime'] < 60) { | ||
45 | - $this->error(__('发送频繁')); | ||
46 | - } | ||
47 | - if ($event) { | ||
48 | - $userinfo = User::getByEmail($email); | ||
49 | - if ($event == 'register' && $userinfo) { | ||
50 | - //已被注册 | ||
51 | - $this->error(__('已被注册')); | ||
52 | - } elseif (in_array($event, ['changeemail']) && $userinfo) { | ||
53 | - //被占用 | ||
54 | - $this->error(__('已被占用')); | ||
55 | - } elseif (in_array($event, ['changepwd', 'resetpwd']) && !$userinfo) { | ||
56 | - //未注册 | ||
57 | - $this->error(__('未注册')); | ||
58 | - } | ||
59 | - } | ||
60 | - $ret = Emslib::send($email, null, $event); | ||
61 | - if ($ret) { | ||
62 | - $this->success(__('发送成功')); | ||
63 | - } else { | ||
64 | - $this->error(__('发送失败')); | ||
65 | - } | ||
66 | - } | ||
67 | - | ||
68 | - /** | ||
69 | - * 检测验证码 | ||
70 | - * | ||
71 | - * @param string $email 邮箱 | ||
72 | - * @param string $event 事件名称 | ||
73 | - * @param string $captcha 验证码 | ||
74 | - */ | ||
75 | - public function check() | ||
76 | - { | ||
77 | - $email = $this->request->request("email"); | ||
78 | - $event = $this->request->request("event"); | ||
79 | - $event = $event ? $event : 'register'; | ||
80 | - $captcha = $this->request->request("captcha"); | ||
81 | - | ||
82 | - if ($event) { | ||
83 | - $userinfo = User::getByEmail($email); | ||
84 | - if ($event == 'register' && $userinfo) { | ||
85 | - //已被注册 | ||
86 | - $this->error(__('已被注册')); | ||
87 | - } elseif (in_array($event, ['changeemail']) && $userinfo) { | ||
88 | - //被占用 | ||
89 | - $this->error(__('已被占用')); | ||
90 | - } elseif (in_array($event, ['changepwd', 'resetpwd']) && !$userinfo) { | ||
91 | - //未注册 | ||
92 | - $this->error(__('未注册')); | ||
93 | - } | ||
94 | - } | ||
95 | - $ret = Emslib::check($email, $captcha, $event); | ||
96 | - if ($ret) { | ||
97 | - $this->success(__('成功')); | ||
98 | - } else { | ||
99 | - $this->error(__('验证码不正确')); | ||
100 | - } | ||
101 | - } | ||
102 | -} |
application/api/controller/Sms.php
已删除
100644 → 0
1 | -<?php | ||
2 | - | ||
3 | -namespace app\api\controller; | ||
4 | - | ||
5 | -use app\common\controller\Api; | ||
6 | -use app\common\library\Sms as Smslib; | ||
7 | -use app\common\model\User; | ||
8 | -use think\Hook; | ||
9 | - | ||
10 | -/** | ||
11 | - * 手机短信接口 | ||
12 | - */ | ||
13 | -class Sms extends Api | ||
14 | -{ | ||
15 | - protected $noNeedLogin = '*'; | ||
16 | - protected $noNeedRight = '*'; | ||
17 | - | ||
18 | - /** | ||
19 | - * 发送验证码 | ||
20 | - * | ||
21 | - * @param string $mobile 手机号 | ||
22 | - * @param string $event 事件名称 | ||
23 | - */ | ||
24 | - public function send() | ||
25 | - { | ||
26 | - $mobile = $this->request->request("mobile"); | ||
27 | - $event = $this->request->request("event"); | ||
28 | - $event = $event ? $event : 'register'; | ||
29 | - | ||
30 | - if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { | ||
31 | - $this->error(__('手机号不正确')); | ||
32 | - } | ||
33 | - $last = Smslib::get($mobile, $event); | ||
34 | - if ($last && time() - $last['createtime'] < 60) { | ||
35 | - $this->error(__('发送频繁')); | ||
36 | - } | ||
37 | - $ipSendTotal = \app\common\model\Sms::where(['ip' => $this->request->ip()])->whereTime('createtime', '-1 hours')->count(); | ||
38 | - if ($ipSendTotal >= 5) { | ||
39 | - $this->error(__('发送频繁')); | ||
40 | - } | ||
41 | - if ($event) { | ||
42 | - $userinfo = User::getByMobile($mobile); | ||
43 | - if ($event == 'register' && $userinfo) { | ||
44 | - //已被注册 | ||
45 | - $this->error(__('已被注册')); | ||
46 | - } elseif (in_array($event, ['changemobile']) && $userinfo) { | ||
47 | - //被占用 | ||
48 | - $this->error(__('已被占用')); | ||
49 | - } elseif (in_array($event, ['changepwd', 'resetpwd']) && !$userinfo) { | ||
50 | - //未注册 | ||
51 | - $this->error(__('未注册')); | ||
52 | - } | ||
53 | - } | ||
54 | - if (!Hook::get('sms_send')) { | ||
55 | - $this->error(__('请在后台插件管理安装短信验证插件')); | ||
56 | - } | ||
57 | - $ret = Smslib::send($mobile, null, $event); | ||
58 | - if ($ret) { | ||
59 | - $this->success(__('发送成功')); | ||
60 | - } else { | ||
61 | - $this->error(__('发送失败,请检查短信配置是否正确')); | ||
62 | - } | ||
63 | - } | ||
64 | - | ||
65 | - /** | ||
66 | - * 检测验证码 | ||
67 | - * | ||
68 | - * @param string $mobile 手机号 | ||
69 | - * @param string $event 事件名称 | ||
70 | - * @param string $captcha 验证码 | ||
71 | - */ | ||
72 | - public function check() | ||
73 | - { | ||
74 | - $mobile = $this->request->request("mobile"); | ||
75 | - $event = $this->request->request("event"); | ||
76 | - $event = $event ? $event : 'register'; | ||
77 | - $captcha = $this->request->request("captcha"); | ||
78 | - | ||
79 | - if (!$mobile || !\think\Validate::regex($mobile, "^1\d{10}$")) { | ||
80 | - $this->error(__('手机号不正确')); | ||
81 | - } | ||
82 | - if ($event) { | ||
83 | - $userinfo = User::getByMobile($mobile); | ||
84 | - if ($event == 'register' && $userinfo) { | ||
85 | - //已被注册 | ||
86 | - $this->error(__('已被注册')); | ||
87 | - } elseif (in_array($event, ['changemobile']) && $userinfo) { | ||
88 | - //被占用 | ||
89 | - $this->error(__('已被占用')); | ||
90 | - } elseif (in_array($event, ['changepwd', 'resetpwd']) && !$userinfo) { | ||
91 | - //未注册 | ||
92 | - $this->error(__('未注册')); | ||
93 | - } | ||
94 | - } | ||
95 | - $ret = Smslib::check($mobile, $captcha, $event); | ||
96 | - if ($ret) { | ||
97 | - $this->success(__('成功')); | ||
98 | - } else { | ||
99 | - $this->error(__('验证码不正确')); | ||
100 | - } | ||
101 | - } | ||
102 | -} |
application/api/controller/Token.php
已删除
100644 → 0
1 | -<?php | ||
2 | - | ||
3 | -namespace app\api\controller; | ||
4 | - | ||
5 | -use app\common\controller\Api; | ||
6 | -use fast\Random; | ||
7 | - | ||
8 | -/** | ||
9 | - * Token接口 | ||
10 | - */ | ||
11 | -class Token extends Api | ||
12 | -{ | ||
13 | - protected $noNeedLogin = []; | ||
14 | - protected $noNeedRight = '*'; | ||
15 | - | ||
16 | - /** | ||
17 | - * 检测Token是否过期 | ||
18 | - * | ||
19 | - */ | ||
20 | - public function check() | ||
21 | - { | ||
22 | - $token = $this->auth->getToken(); | ||
23 | - $tokenInfo = \app\common\library\Token::get($token); | ||
24 | - $this->success('', ['token' => $tokenInfo['token'], 'expires_in' => $tokenInfo['expires_in']]); | ||
25 | - } | ||
26 | - | ||
27 | - /** | ||
28 | - * 刷新Token | ||
29 | - * | ||
30 | - */ | ||
31 | - public function refresh() | ||
32 | - { | ||
33 | - //删除源Token | ||
34 | - $token = $this->auth->getToken(); | ||
35 | - \app\common\library\Token::delete($token); | ||
36 | - //创建新Token | ||
37 | - $token = Random::uuid(); | ||
38 | - \app\common\library\Token::set($token, $this->auth->id, 2592000); | ||
39 | - $tokenInfo = \app\common\library\Token::get($token); | ||
40 | - $this->success('', ['token' => $tokenInfo['token'], 'expires_in' => $tokenInfo['expires_in']]); | ||
41 | - } | ||
42 | -} |
@@ -2,319 +2,93 @@ | @@ -2,319 +2,93 @@ | ||
2 | 2 | ||
3 | namespace app\api\controller; | 3 | namespace app\api\controller; |
4 | 4 | ||
5 | +use app\admin\model\Collection; | ||
6 | +use app\admin\model\Rcoupon; | ||
5 | use app\common\controller\Api; | 7 | use app\common\controller\Api; |
6 | -use app\common\library\Ems; | ||
7 | -use app\common\library\Sms; | ||
8 | -use fast\Random; | 8 | +use fast\Http; |
9 | +use think\db\Query; | ||
9 | use think\Validate; | 10 | use think\Validate; |
11 | +use think\Db; | ||
12 | +use think\db\Expression; | ||
10 | 13 | ||
11 | /** | 14 | /** |
12 | - * 会员接口 | 15 | + * 个人中心接口 |
13 | */ | 16 | */ |
14 | class User extends Api | 17 | class User extends Api |
15 | { | 18 | { |
16 | - protected $noNeedLogin = ['login', 'mobilelogin', 'register', 'resetpwd', 'changeemail', 'changemobile', 'third']; | 19 | + //无需登录,*表都不需要 |
20 | +// protected $noNeedLogin = ['login', 'mobilelogin']; | ||
21 | + protected $noNeedLogin = ['login']; | ||
17 | protected $noNeedRight = '*'; | 22 | protected $noNeedRight = '*'; |
18 | - | 23 | + protected $uid = ''; |
19 | public function _initialize() | 24 | public function _initialize() |
20 | { | 25 | { |
21 | parent::_initialize(); | 26 | parent::_initialize(); |
27 | + $this->uid = $this->auth->getUserId(); | ||
22 | } | 28 | } |
23 | 29 | ||
24 | /** | 30 | /** |
25 | - * 会员中心 | ||
26 | - */ | ||
27 | - public function index() | ||
28 | - { | ||
29 | - $this->success('', ['welcome' => $this->auth->nickname]); | ||
30 | - } | ||
31 | - | ||
32 | - /** | ||
33 | - * 会员登录 | ||
34 | - * | ||
35 | - * @param string $account 账号 | ||
36 | - * @param string $password 密码 | 31 | + * @ApiTitle (小程序登录) |
32 | + * @ApiSummary (小程序登录) | ||
33 | + * @ApiMethod (POST) | ||
34 | + * @ApiRoute (/api/user/login) | ||
35 | + * @ApiParams (name="code", type="string", required=true, description="小程序code") | ||
36 | + * @ApiParams (name="nickname", type="string", required=true, description="小程序昵称") | ||
37 | + * @ApiParams (name="avatar", type="string", required=true, description="小程序头像") | ||
38 | + * @ApiReturn({ | ||
39 | + "code": 1, | ||
40 | + "msg": "登录成功", | ||
41 | + "time": "1553839125", | ||
42 | + "data": { | ||
43 | + "token": "677afb39-1a4f-4492-84d3-0bcf32016b8a",//token | ||
44 | + "user_id": 27,//用户id | ||
45 | + "createtime": 1553839125,//登录时间 | ||
46 | + "expiretime": 1556431125,//token失效时间 | ||
47 | + "expires_in": 2592000//token失效剩余时间(单位s) | ||
48 | + "openid": 1485212522522//openid | ||
49 | + }) | ||
37 | */ | 50 | */ |
38 | - public function login() | ||
39 | - { | ||
40 | - $account = $this->request->request('account'); | ||
41 | - $password = $this->request->request('password'); | ||
42 | - if (!$account || !$password) { | ||
43 | - $this->error(__('Invalid parameters')); | ||
44 | - } | ||
45 | - $ret = $this->auth->login($account, $password); | ||
46 | - if ($ret) { | ||
47 | - $data = ['userinfo' => $this->auth->getUserinfo()]; | ||
48 | - $this->success(__('Logged in successful'), $data); | ||
49 | - } else { | ||
50 | - $this->error($this->auth->getError()); | ||
51 | - } | ||
52 | - } | ||
53 | - | ||
54 | - /** | ||
55 | - * 手机验证码登录 | ||
56 | - * | ||
57 | - * @param string $mobile 手机号 | ||
58 | - * @param string $captcha 验证码 | ||
59 | - */ | ||
60 | - public function mobilelogin() | ||
61 | - { | ||
62 | - $mobile = $this->request->request('mobile'); | ||
63 | - $captcha = $this->request->request('captcha'); | ||
64 | - if (!$mobile || !$captcha) { | ||
65 | - $this->error(__('Invalid parameters')); | ||
66 | - } | ||
67 | - if (!Validate::regex($mobile, "^1\d{10}$")) { | ||
68 | - $this->error(__('Mobile is incorrect')); | ||
69 | - } | ||
70 | - if (!Sms::check($mobile, $captcha, 'mobilelogin')) { | ||
71 | - $this->error(__('Captcha is incorrect')); | ||
72 | - } | ||
73 | - $user = \app\common\model\User::getByMobile($mobile); | ||
74 | - if ($user) { | ||
75 | - if ($user->status != 'normal') { | ||
76 | - $this->error(__('Account is locked')); | 51 | + public function login(){ |
52 | + if($this->request->isPost()){ | ||
53 | + //小程序配置 | ||
54 | + $config = config('verify.raw'); | ||
55 | + //小程序传递数据,包含昵称,头像,code | ||
56 | + $raw_data = $this->request->post(); | ||
57 | + //验证表数据 | ||
58 | + $rule = config('verify.user'); | ||
59 | + $validate = new Validate($rule['rule'],$rule['msg']); | ||
60 | + if (!$validate->check($raw_data)) { | ||
61 | + $this->error($validate->getError()); | ||
77 | } | 62 | } |
78 | - //如果已经有账号则直接登录 | ||
79 | - $ret = $this->auth->direct($user->id); | ||
80 | - } else { | ||
81 | - $ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, []); | ||
82 | - } | ||
83 | - if ($ret) { | ||
84 | - Sms::flush($mobile, 'mobilelogin'); | ||
85 | - $data = ['userinfo' => $this->auth->getUserinfo()]; | ||
86 | - $this->success(__('Logged in successful'), $data); | ||
87 | - } else { | ||
88 | - $this->error($this->auth->getError()); | ||
89 | - } | ||
90 | - } | ||
91 | - | ||
92 | - /** | ||
93 | - * 注册会员 | ||
94 | - * | ||
95 | - * @param string $username 用户名 | ||
96 | - * @param string $password 密码 | ||
97 | - * @param string $email 邮箱 | ||
98 | - * @param string $mobile 手机号 | ||
99 | - * @param string $code 验证码 | ||
100 | - */ | ||
101 | - public function register() | ||
102 | - { | ||
103 | - $username = $this->request->request('username'); | ||
104 | - $password = $this->request->request('password'); | ||
105 | - $email = $this->request->request('email'); | ||
106 | - $mobile = $this->request->request('mobile'); | ||
107 | - $code = $this->request->request('code'); | ||
108 | - if (!$username || !$password) { | ||
109 | - $this->error(__('Invalid parameters')); | ||
110 | - } | ||
111 | - if ($email && !Validate::is($email, "email")) { | ||
112 | - $this->error(__('Email is incorrect')); | ||
113 | - } | ||
114 | - if ($mobile && !Validate::regex($mobile, "^1\d{10}$")) { | ||
115 | - $this->error(__('Mobile is incorrect')); | ||
116 | - } | ||
117 | - $ret = Sms::check($mobile, $code, 'register'); | ||
118 | - if (!$ret) { | ||
119 | - $this->error(__('Captcha is incorrect')); | ||
120 | - } | ||
121 | - $ret = $this->auth->register($username, $password, $email, $mobile, []); | ||
122 | - if ($ret) { | ||
123 | - $data = ['userinfo' => $this->auth->getUserinfo()]; | ||
124 | - $this->success(__('Sign up successful'), $data); | ||
125 | - } else { | ||
126 | - $this->error($this->auth->getError()); | ||
127 | - } | ||
128 | - } | ||
129 | - | ||
130 | - /** | ||
131 | - * 注销登录 | ||
132 | - */ | ||
133 | - public function logout() | ||
134 | - { | ||
135 | - $this->auth->logout(); | ||
136 | - $this->success(__('Logout successful')); | ||
137 | - } | ||
138 | - | ||
139 | - /** | ||
140 | - * 修改会员个人信息 | ||
141 | - * | ||
142 | - * @param string $avatar 头像地址 | ||
143 | - * @param string $username 用户名 | ||
144 | - * @param string $nickname 昵称 | ||
145 | - * @param string $bio 个人简介 | ||
146 | - */ | ||
147 | - public function profile() | ||
148 | - { | ||
149 | - $user = $this->auth->getUser(); | ||
150 | - $username = $this->request->request('username'); | ||
151 | - $nickname = $this->request->request('nickname'); | ||
152 | - $bio = $this->request->request('bio'); | ||
153 | - $avatar = $this->request->request('avatar', '', 'trim,strip_tags,htmlspecialchars'); | ||
154 | - if ($username) { | ||
155 | - $exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find(); | ||
156 | - if ($exists) { | ||
157 | - $this->error(__('Username already exists')); | 63 | + $params = [ |
64 | + 'appid' => $config['app_id'], | ||
65 | + 'secret' => $config['secret'], | ||
66 | + 'js_code' => $raw_data['code'], | ||
67 | + 'grant_type' => 'authorization_code' | ||
68 | + ]; | ||
69 | + $result = Http::sendRequest("https://api.weixin.qq.com/sns/jscode2session", $params, 'GET'); | ||
70 | + if ($result['ret']) { | ||
71 | + $json = (array)json_decode($result['msg'], true); | ||
72 | + if (isset($json['openid'])) { | ||
73 | + $result = [ | ||
74 | + 'openid' => $json['openid'], | ||
75 | + 'nickname' => $raw_data['nickname'], | ||
76 | + 'avatar' => $raw_data['avatar'] | ||
77 | + ]; | ||
78 | + $ret = $this->auth->login($result); | ||
79 | + if ($ret) { | ||
80 | + $data = $this->auth->getUserinfo(); | ||
81 | + $data['nickname'] = $this->auth->emoji_decode($data['nickname']); | ||
82 | + $this->success('登录成功', $data); | ||
83 | + }else { | ||
84 | + $this->error($this->auth->getError()); | ||
85 | + } | ||
86 | + } else { | ||
87 | + $this->error("登录失败",$json); | ||
88 | + } | ||
158 | } | 89 | } |
159 | - $user->username = $username; | ||
160 | - } | ||
161 | - $user->nickname = $nickname; | ||
162 | - $user->bio = $bio; | ||
163 | - $user->avatar = $avatar; | ||
164 | - $user->save(); | ||
165 | - $this->success(); | ||
166 | - } | ||
167 | - | ||
168 | - /** | ||
169 | - * 修改邮箱 | ||
170 | - * | ||
171 | - * @param string $email 邮箱 | ||
172 | - * @param string $captcha 验证码 | ||
173 | - */ | ||
174 | - public function changeemail() | ||
175 | - { | ||
176 | - $user = $this->auth->getUser(); | ||
177 | - $email = $this->request->post('email'); | ||
178 | - $captcha = $this->request->request('captcha'); | ||
179 | - if (!$email || !$captcha) { | ||
180 | - $this->error(__('Invalid parameters')); | ||
181 | - } | ||
182 | - if (!Validate::is($email, "email")) { | ||
183 | - $this->error(__('Email is incorrect')); | ||
184 | - } | ||
185 | - if (\app\common\model\User::where('email', $email)->where('id', '<>', $user->id)->find()) { | ||
186 | - $this->error(__('Email already exists')); | ||
187 | - } | ||
188 | - $result = Ems::check($email, $captcha, 'changeemail'); | ||
189 | - if (!$result) { | ||
190 | - $this->error(__('Captcha is incorrect')); | ||
191 | - } | ||
192 | - $verification = $user->verification; | ||
193 | - $verification->email = 1; | ||
194 | - $user->verification = $verification; | ||
195 | - $user->email = $email; | ||
196 | - $user->save(); | ||
197 | - | ||
198 | - Ems::flush($email, 'changeemail'); | ||
199 | - $this->success(); | ||
200 | - } | ||
201 | - | ||
202 | - /** | ||
203 | - * 修改手机号 | ||
204 | - * | ||
205 | - * @param string $email 手机号 | ||
206 | - * @param string $captcha 验证码 | ||
207 | - */ | ||
208 | - public function changemobile() | ||
209 | - { | ||
210 | - $user = $this->auth->getUser(); | ||
211 | - $mobile = $this->request->request('mobile'); | ||
212 | - $captcha = $this->request->request('captcha'); | ||
213 | - if (!$mobile || !$captcha) { | ||
214 | - $this->error(__('Invalid parameters')); | ||
215 | - } | ||
216 | - if (!Validate::regex($mobile, "^1\d{10}$")) { | ||
217 | - $this->error(__('Mobile is incorrect')); | ||
218 | - } | ||
219 | - if (\app\common\model\User::where('mobile', $mobile)->where('id', '<>', $user->id)->find()) { | ||
220 | - $this->error(__('Mobile already exists')); | ||
221 | - } | ||
222 | - $result = Sms::check($mobile, $captcha, 'changemobile'); | ||
223 | - if (!$result) { | ||
224 | - $this->error(__('Captcha is incorrect')); | ||
225 | - } | ||
226 | - $verification = $user->verification; | ||
227 | - $verification->mobile = 1; | ||
228 | - $user->verification = $verification; | ||
229 | - $user->mobile = $mobile; | ||
230 | - $user->save(); | ||
231 | - | ||
232 | - Sms::flush($mobile, 'changemobile'); | ||
233 | - $this->success(); | ||
234 | - } | ||
235 | - | ||
236 | - /** | ||
237 | - * 第三方登录 | ||
238 | - * | ||
239 | - * @param string $platform 平台名称 | ||
240 | - * @param string $code Code码 | ||
241 | - */ | ||
242 | - public function third() | ||
243 | - { | ||
244 | - $url = url('user/index'); | ||
245 | - $platform = $this->request->request("platform"); | ||
246 | - $code = $this->request->request("code"); | ||
247 | - $config = get_addon_config('third'); | ||
248 | - if (!$config || !isset($config[$platform])) { | ||
249 | - $this->error(__('Invalid parameters')); | ||
250 | - } | ||
251 | - $app = new \addons\third\library\Application($config); | ||
252 | - //通过code换access_token和绑定会员 | ||
253 | - $result = $app->{$platform}->getUserInfo(['code' => $code]); | ||
254 | - if ($result) { | ||
255 | - $loginret = \addons\third\library\Service::connect($platform, $result); | ||
256 | - if ($loginret) { | ||
257 | - $data = [ | ||
258 | - 'userinfo' => $this->auth->getUserinfo(), | ||
259 | - 'thirdinfo' => $result | ||
260 | - ]; | ||
261 | - $this->success(__('Logged in successful'), $data); | ||
262 | - } | ||
263 | - } | ||
264 | - $this->error(__('Operation failed'), $url); | ||
265 | - } | ||
266 | - | ||
267 | - /** | ||
268 | - * 重置密码 | ||
269 | - * | ||
270 | - * @param string $mobile 手机号 | ||
271 | - * @param string $newpassword 新密码 | ||
272 | - * @param string $captcha 验证码 | ||
273 | - */ | ||
274 | - public function resetpwd() | ||
275 | - { | ||
276 | - $type = $this->request->request("type"); | ||
277 | - $mobile = $this->request->request("mobile"); | ||
278 | - $email = $this->request->request("email"); | ||
279 | - $newpassword = $this->request->request("newpassword"); | ||
280 | - $captcha = $this->request->request("captcha"); | ||
281 | - if (!$newpassword || !$captcha) { | ||
282 | - $this->error(__('Invalid parameters')); | ||
283 | - } | ||
284 | - if ($type == 'mobile') { | ||
285 | - if (!Validate::regex($mobile, "^1\d{10}$")) { | ||
286 | - $this->error(__('Mobile is incorrect')); | ||
287 | - } | ||
288 | - $user = \app\common\model\User::getByMobile($mobile); | ||
289 | - if (!$user) { | ||
290 | - $this->error(__('User not found')); | ||
291 | - } | ||
292 | - $ret = Sms::check($mobile, $captcha, 'resetpwd'); | ||
293 | - if (!$ret) { | ||
294 | - $this->error(__('Captcha is incorrect')); | ||
295 | - } | ||
296 | - Sms::flush($mobile, 'resetpwd'); | ||
297 | - } else { | ||
298 | - if (!Validate::is($email, "email")) { | ||
299 | - $this->error(__('Email is incorrect')); | ||
300 | - } | ||
301 | - $user = \app\common\model\User::getByEmail($email); | ||
302 | - if (!$user) { | ||
303 | - $this->error(__('User not found')); | ||
304 | - } | ||
305 | - $ret = Ems::check($email, $captcha, 'resetpwd'); | ||
306 | - if (!$ret) { | ||
307 | - $this->error(__('Captcha is incorrect')); | ||
308 | - } | ||
309 | - Ems::flush($email, 'resetpwd'); | ||
310 | - } | ||
311 | - //模拟一次登录 | ||
312 | - $this->auth->direct($user->id); | ||
313 | - $ret = $this->auth->changepwd($newpassword, '', true); | ||
314 | - if ($ret) { | ||
315 | - $this->success(__('Reset password successful')); | ||
316 | - } else { | ||
317 | - $this->error($this->auth->getError()); | 90 | + }else{ |
91 | + $this->error('请求方式错误'); | ||
318 | } | 92 | } |
319 | } | 93 | } |
320 | } | 94 | } |
application/api/controller/Validate.php
已删除
100644 → 0
1 | -<?php | ||
2 | - | ||
3 | -namespace app\api\controller; | ||
4 | - | ||
5 | -use app\common\controller\Api; | ||
6 | -use app\common\model\User; | ||
7 | - | ||
8 | -/** | ||
9 | - * 验证接口 | ||
10 | - */ | ||
11 | -class Validate extends Api | ||
12 | -{ | ||
13 | - protected $noNeedLogin = '*'; | ||
14 | - protected $layout = ''; | ||
15 | - protected $error = null; | ||
16 | - | ||
17 | - public function _initialize() | ||
18 | - { | ||
19 | - parent::_initialize(); | ||
20 | - } | ||
21 | - | ||
22 | - /** | ||
23 | - * 检测邮箱 | ||
24 | - * | ||
25 | - * @param string $email 邮箱 | ||
26 | - * @param string $id 排除会员ID | ||
27 | - */ | ||
28 | - public function check_email_available() | ||
29 | - { | ||
30 | - $email = $this->request->request('email'); | ||
31 | - $id = (int)$this->request->request('id'); | ||
32 | - $count = User::where('email', '=', $email)->where('id', '<>', $id)->count(); | ||
33 | - if ($count > 0) { | ||
34 | - $this->error(__('邮箱已经被占用')); | ||
35 | - } | ||
36 | - $this->success(); | ||
37 | - } | ||
38 | - | ||
39 | - /** | ||
40 | - * 检测用户名 | ||
41 | - * | ||
42 | - * @param string $username 用户名 | ||
43 | - * @param string $id 排除会员ID | ||
44 | - */ | ||
45 | - public function check_username_available() | ||
46 | - { | ||
47 | - $email = $this->request->request('username'); | ||
48 | - $id = (int)$this->request->request('id'); | ||
49 | - $count = User::where('username', '=', $email)->where('id', '<>', $id)->count(); | ||
50 | - if ($count > 0) { | ||
51 | - $this->error(__('用户名已经被占用')); | ||
52 | - } | ||
53 | - $this->success(); | ||
54 | - } | ||
55 | - | ||
56 | - /** | ||
57 | - * 检测手机 | ||
58 | - * | ||
59 | - * @param string $mobile 手机号 | ||
60 | - * @param string $id 排除会员ID | ||
61 | - */ | ||
62 | - public function check_mobile_available() | ||
63 | - { | ||
64 | - $mobile = $this->request->request('mobile'); | ||
65 | - $id = (int)$this->request->request('id'); | ||
66 | - $count = User::where('mobile', '=', $mobile)->where('id', '<>', $id)->count(); | ||
67 | - if ($count > 0) { | ||
68 | - $this->error(__('该手机号已经占用')); | ||
69 | - } | ||
70 | - $this->success(); | ||
71 | - } | ||
72 | - | ||
73 | - /** | ||
74 | - * 检测手机 | ||
75 | - * | ||
76 | - * @param string $mobile 手机号 | ||
77 | - */ | ||
78 | - public function check_mobile_exist() | ||
79 | - { | ||
80 | - $mobile = $this->request->request('mobile'); | ||
81 | - $count = User::where('mobile', '=', $mobile)->count(); | ||
82 | - if (!$count) { | ||
83 | - $this->error(__('手机号不存在')); | ||
84 | - } | ||
85 | - $this->success(); | ||
86 | - } | ||
87 | - | ||
88 | - /** | ||
89 | - * 检测邮箱 | ||
90 | - * | ||
91 | - * @param string $mobile 邮箱 | ||
92 | - */ | ||
93 | - public function check_email_exist() | ||
94 | - { | ||
95 | - $email = $this->request->request('email'); | ||
96 | - $count = User::where('email', '=', $email)->count(); | ||
97 | - if (!$count) { | ||
98 | - $this->error(__('邮箱不存在')); | ||
99 | - } | ||
100 | - $this->success(); | ||
101 | - } | ||
102 | - | ||
103 | - /** | ||
104 | - * 检测手机验证码 | ||
105 | - * | ||
106 | - * @param string $mobile 手机号 | ||
107 | - * @param string $captcha 验证码 | ||
108 | - * @param string $event 事件 | ||
109 | - */ | ||
110 | - public function check_sms_correct() | ||
111 | - { | ||
112 | - $mobile = $this->request->request('mobile'); | ||
113 | - $captcha = $this->request->request('captcha'); | ||
114 | - $event = $this->request->request('event'); | ||
115 | - if (!\app\common\library\Sms::check($mobile, $captcha, $event)) { | ||
116 | - $this->error(__('验证码不正确')); | ||
117 | - } | ||
118 | - $this->success(); | ||
119 | - } | ||
120 | - | ||
121 | - /** | ||
122 | - * 检测邮箱验证码 | ||
123 | - * | ||
124 | - * @param string $email 邮箱 | ||
125 | - * @param string $captcha 验证码 | ||
126 | - * @param string $event 事件 | ||
127 | - */ | ||
128 | - public function check_ems_correct() | ||
129 | - { | ||
130 | - $email = $this->request->request('email'); | ||
131 | - $captcha = $this->request->request('captcha'); | ||
132 | - $event = $this->request->request('event'); | ||
133 | - if (!\app\common\library\Ems::check($email, $captcha, $event)) { | ||
134 | - $this->error(__('验证码不正确')); | ||
135 | - } | ||
136 | - $this->success(); | ||
137 | - } | ||
138 | -} |
@@ -131,13 +131,13 @@ class Api | @@ -131,13 +131,13 @@ class Api | ||
131 | $this->auth->init($token); | 131 | $this->auth->init($token); |
132 | //检测是否登录 | 132 | //检测是否登录 |
133 | if (!$this->auth->isLogin()) { | 133 | if (!$this->auth->isLogin()) { |
134 | - $this->error(__('Please login first'), null, 401); | 134 | + $this->error(__('Please login first')); |
135 | } | 135 | } |
136 | // 判断是否需要验证权限 | 136 | // 判断是否需要验证权限 |
137 | if (!$this->auth->match($this->noNeedRight)) { | 137 | if (!$this->auth->match($this->noNeedRight)) { |
138 | // 判断控制器和方法判断是否有对应权限 | 138 | // 判断控制器和方法判断是否有对应权限 |
139 | if (!$this->auth->check($path)) { | 139 | if (!$this->auth->check($path)) { |
140 | - $this->error(__('You have no permission'), null, 403); | 140 | + $this->error(__('You have no permission')); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } else { | 143 | } else { |
@@ -19,6 +19,7 @@ class Auth | @@ -19,6 +19,7 @@ class Auth | ||
19 | protected $_logined = false; | 19 | protected $_logined = false; |
20 | protected $_user = null; | 20 | protected $_user = null; |
21 | protected $_token = ''; | 21 | protected $_token = ''; |
22 | + protected $user_id = ''; | ||
22 | //Token默认有效时长 | 23 | //Token默认有效时长 |
23 | protected $keeptime = 2592000; | 24 | protected $keeptime = 2592000; |
24 | protected $requestUri = ''; | 25 | protected $requestUri = ''; |
@@ -26,7 +27,7 @@ class Auth | @@ -26,7 +27,7 @@ class Auth | ||
26 | //默认配置 | 27 | //默认配置 |
27 | protected $config = []; | 28 | protected $config = []; |
28 | protected $options = []; | 29 | protected $options = []; |
29 | - protected $allowFields = ['id', 'username', 'nickname', 'mobile', 'avatar', 'score']; | 30 | + protected $allowFields = ['id', 'nickname', 'mobile', 'avatar','openid']; |
30 | 31 | ||
31 | public function __construct($options = []) | 32 | public function __construct($options = []) |
32 | { | 33 | { |
@@ -193,23 +194,35 @@ class Auth | @@ -193,23 +194,35 @@ class Auth | ||
193 | * @param string $password 密码 | 194 | * @param string $password 密码 |
194 | * @return boolean | 195 | * @return boolean |
195 | */ | 196 | */ |
196 | - public function login($account, $password) | 197 | + public function login($result) |
197 | { | 198 | { |
198 | - $field = Validate::is($account, 'email') ? 'email' : (Validate::regex($account, '/^1\d{10}$/') ? 'mobile' : 'username'); | ||
199 | - $user = User::get([$field => $account]); | ||
200 | - if (!$user) { | ||
201 | - $this->setError('Account is incorrect'); | ||
202 | - return false; | ||
203 | - } | ||
204 | - | ||
205 | - if ($user->status != 'normal') { | ||
206 | - $this->setError('Account is locked'); | ||
207 | - return false; | ||
208 | - } | ||
209 | - if ($user->password != $this->getEncryptPassword($password, $user->salt)) { | ||
210 | - $this->setError('Password is incorrect'); | ||
211 | - return false; | 199 | +// $field = Validate::is($account, 'email') ? 'email' : (Validate::regex($account, '/^1\d{10}$/') ? 'mobile' : 'username'); |
200 | +// $user = User::get([$field => $account]); | ||
201 | +// if (!$user) { | ||
202 | +// $this->setError('Account is incorrect'); | ||
203 | +// return false; | ||
204 | +// } | ||
205 | +// | ||
206 | +// if ($user->status != 'normal') { | ||
207 | +// $this->setError('Account is locked'); | ||
208 | +// return false; | ||
209 | +// } | ||
210 | +// if ($user->password != $this->getEncryptPassword($password, $user->salt)) { | ||
211 | +// $this->setError('Password is incorrect'); | ||
212 | +// return false; | ||
213 | +// } | ||
214 | + $userModel = new \app\admin\model\User(); | ||
215 | + $where = ['openid'=>$result['openid']]; | ||
216 | + $result['nickname'] = $this->emoji_encode($result['nickname']); | ||
217 | + $ret = $userModel->where($where)->find(); | ||
218 | + if ($ret) { | ||
219 | + $userModel->where($where)->update($result); | ||
220 | + } else { | ||
221 | + $result['jointime'] = time(); | ||
222 | + $result['joinip'] = request()->ip(); | ||
223 | + $userModel->create($result); | ||
212 | } | 224 | } |
225 | + $user = User::get($where); | ||
213 | 226 | ||
214 | //直接登录会员 | 227 | //直接登录会员 |
215 | $this->direct($user->id); | 228 | $this->direct($user->id); |
@@ -325,6 +338,15 @@ class Auth | @@ -325,6 +338,15 @@ class Auth | ||
325 | } | 338 | } |
326 | 339 | ||
327 | /** | 340 | /** |
341 | + * 获取user_id | ||
342 | + * @return mixed | ||
343 | + */ | ||
344 | + public function getUserId() | ||
345 | + { | ||
346 | + return $this->user_id; | ||
347 | + } | ||
348 | + | ||
349 | + /** | ||
328 | * 检测是否是否有对应权限 | 350 | * 检测是否是否有对应权限 |
329 | * @param string $path 控制器/方法 | 351 | * @param string $path 控制器/方法 |
330 | * @param string $module 模块 默认为当前模块 | 352 | * @param string $module 模块 默认为当前模块 |
@@ -560,4 +582,36 @@ class Auth | @@ -560,4 +582,36 @@ class Auth | ||
560 | { | 582 | { |
561 | return $this->_error ? __($this->_error) : ''; | 583 | return $this->_error ? __($this->_error) : ''; |
562 | } | 584 | } |
585 | + | ||
586 | + | ||
587 | + | ||
588 | + | ||
589 | + | ||
590 | + | ||
591 | + | ||
592 | + | ||
593 | + | ||
594 | + | ||
595 | + //表情转字符 | ||
596 | + public function emoji_encode($str){ | ||
597 | + $strEncode = ''; | ||
598 | + $length = mb_strlen($str,'utf-8'); | ||
599 | + for ($i=0; $i < $length; $i++) { | ||
600 | + $_tmpStr = mb_substr($str,$i,1,'utf-8'); | ||
601 | + if(strlen($_tmpStr) >= 4){ | ||
602 | + $strEncode .= '[[EMOJI:'.rawurlencode($_tmpStr).']]'; | ||
603 | + }else{ | ||
604 | + $strEncode .= $_tmpStr; | ||
605 | + } | ||
606 | + } | ||
607 | + return $strEncode; | ||
608 | + } | ||
609 | + | ||
610 | + //字符转表情 | ||
611 | + public function emoji_decode($str){ | ||
612 | + $strDecode = preg_replace_callback('|\[\[EMOJI:(.*?)\]\]|', function ($matches) { | ||
613 | + return rawurldecode($matches[1]); | ||
614 | + }, $str); | ||
615 | + return $strDecode; | ||
616 | + } | ||
563 | } | 617 | } |
@@ -18,7 +18,7 @@ return [ | @@ -18,7 +18,7 @@ return [ | ||
18 | // 应用命名空间 | 18 | // 应用命名空间 |
19 | 'app_namespace' => 'app', | 19 | 'app_namespace' => 'app', |
20 | // 应用调试模式 | 20 | // 应用调试模式 |
21 | - 'app_debug' => Env::get('app.debug', false), | 21 | + 'app_debug' => Env::get('app.debug', true), |
22 | // 应用Trace | 22 | // 应用Trace |
23 | 'app_trace' => Env::get('app.trace', false), | 23 | 'app_trace' => Env::get('app.trace', false), |
24 | // 应用模式状态 | 24 | // 应用模式状态 |
application/extra/verify.php
0 → 100644
1 | +<?php | ||
2 | +return [ | ||
3 | + //小程序参数 | ||
4 | + 'raw' => [ | ||
5 | + 'app_id' => 'wx322817859bfe5db1',//app_id | ||
6 | + 'secret' => '99031bb53087e80ae0ff93411f7ae01d',//秘钥 | ||
7 | + ], | ||
8 | + //小程序登录 | ||
9 | + 'user' => [ | ||
10 | + 'rule' => [ | ||
11 | + 'code' => 'require', | ||
12 | + 'nickname' => 'require', | ||
13 | + 'avatar' => 'require', | ||
14 | + ], | ||
15 | + 'msg' => [ | ||
16 | + 'name.require' => '昵称不能为空', | ||
17 | + 'code.require' => 'code码不能为空', | ||
18 | + 'avatar' => '头像不能为空', | ||
19 | + ] | ||
20 | + ], | ||
21 | + | ||
22 | +]; |
此 diff 太大无法显示。
public/assets/js/backend/banner.js
0 → 100644
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'banner/index' + location.search, | ||
9 | + add_url: 'banner/add', | ||
10 | + edit_url: 'banner/edit', | ||
11 | + del_url: 'banner/del', | ||
12 | + multi_url: 'banner/multi', | ||
13 | + table: 'banner', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: __('Id')}, | ||
28 | + {field: 'image', title: __('Image'), events: Table.api.events.image, formatter: Table.api.formatter.image}, | ||
29 | + {field: 'sort', title: __('Sort'),sortable: true}, | ||
30 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
31 | + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
32 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
33 | + ] | ||
34 | + ] | ||
35 | + }); | ||
36 | + | ||
37 | + // 为表格绑定事件 | ||
38 | + Table.api.bindevent(table); | ||
39 | + }, | ||
40 | + add: function () { | ||
41 | + Controller.api.bindevent(); | ||
42 | + }, | ||
43 | + edit: function () { | ||
44 | + Controller.api.bindevent(); | ||
45 | + }, | ||
46 | + api: { | ||
47 | + bindevent: function () { | ||
48 | + Form.api.bindevent($("form[role=form]")); | ||
49 | + } | ||
50 | + } | ||
51 | + }; | ||
52 | + return Controller; | ||
53 | +}); |
public/assets/js/backend/center.js
0 → 100644
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'center/index' + location.search, | ||
9 | + // add_url: 'center/add', | ||
10 | + edit_url: 'center/edit', | ||
11 | + // del_url: 'center/del', | ||
12 | + multi_url: 'center/multi', | ||
13 | + table: 'center', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: __('Id')}, | ||
28 | + {field: 'thumbnail', title: __('Thumbnail'),events: Table.api.events.image, formatter: Table.api.formatter.image}, | ||
29 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
30 | + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
31 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
32 | + ] | ||
33 | + ] | ||
34 | + }); | ||
35 | + | ||
36 | + // 为表格绑定事件 | ||
37 | + Table.api.bindevent(table); | ||
38 | + }, | ||
39 | + add: function () { | ||
40 | + Controller.api.bindevent(); | ||
41 | + }, | ||
42 | + edit: function () { | ||
43 | + Controller.api.bindevent(); | ||
44 | + }, | ||
45 | + api: { | ||
46 | + bindevent: function () { | ||
47 | + Form.api.bindevent($("form[role=form]")); | ||
48 | + } | ||
49 | + } | ||
50 | + }; | ||
51 | + return Controller; | ||
52 | +}); |
public/assets/js/backend/experience.js
0 → 100644
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'experience/index' + location.search, | ||
9 | + // add_url: 'experience/add', | ||
10 | + edit_url: 'experience/edit', | ||
11 | + // del_url: 'experience/del', | ||
12 | + multi_url: 'experience/multi', | ||
13 | + table: 'experience', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: __('Id')}, | ||
28 | + {field: 'thumbnail', title: __('Thumbnail'),events: Table.api.events.image, formatter: Table.api.formatter.image}, | ||
29 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
30 | + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
31 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
32 | + ] | ||
33 | + ] | ||
34 | + }); | ||
35 | + | ||
36 | + // 为表格绑定事件 | ||
37 | + Table.api.bindevent(table); | ||
38 | + }, | ||
39 | + add: function () { | ||
40 | + Controller.api.bindevent(); | ||
41 | + }, | ||
42 | + edit: function () { | ||
43 | + Controller.api.bindevent(); | ||
44 | + }, | ||
45 | + api: { | ||
46 | + bindevent: function () { | ||
47 | + Form.api.bindevent($("form[role=form]")); | ||
48 | + } | ||
49 | + } | ||
50 | + }; | ||
51 | + return Controller; | ||
52 | +}); |
public/assets/js/backend/platform.js
0 → 100644
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'platform/index' + location.search, | ||
9 | + // add_url: 'platform/add', | ||
10 | + edit_url: 'platform/edit', | ||
11 | + // del_url: 'platform/del', | ||
12 | + multi_url: 'platform/multi', | ||
13 | + table: 'platform', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: __('Id')}, | ||
28 | + {field: 'thumbnail', title: __('Thumbnail'),events: Table.api.events.image, formatter: Table.api.formatter.image}, | ||
29 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
30 | + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
31 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
32 | + ] | ||
33 | + ] | ||
34 | + }); | ||
35 | + | ||
36 | + // 为表格绑定事件 | ||
37 | + Table.api.bindevent(table); | ||
38 | + }, | ||
39 | + add: function () { | ||
40 | + Controller.api.bindevent(); | ||
41 | + }, | ||
42 | + edit: function () { | ||
43 | + Controller.api.bindevent(); | ||
44 | + }, | ||
45 | + api: { | ||
46 | + bindevent: function () { | ||
47 | + Form.api.bindevent($("form[role=form]")); | ||
48 | + } | ||
49 | + } | ||
50 | + }; | ||
51 | + return Controller; | ||
52 | +}); |
public/assets/js/backend/service.js
0 → 100644
1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | ||
2 | + | ||
3 | + var Controller = { | ||
4 | + index: function () { | ||
5 | + // 初始化表格参数配置 | ||
6 | + Table.api.init({ | ||
7 | + extend: { | ||
8 | + index_url: 'service/index' + location.search, | ||
9 | + // add_url: 'service/add', | ||
10 | + edit_url: 'service/edit', | ||
11 | + // del_url: 'service/del', | ||
12 | + multi_url: 'service/multi', | ||
13 | + table: 'service', | ||
14 | + } | ||
15 | + }); | ||
16 | + | ||
17 | + var table = $("#table"); | ||
18 | + | ||
19 | + // 初始化表格 | ||
20 | + table.bootstrapTable({ | ||
21 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
22 | + pk: 'id', | ||
23 | + sortName: 'id', | ||
24 | + columns: [ | ||
25 | + [ | ||
26 | + {checkbox: true}, | ||
27 | + {field: 'id', title: __('Id')}, | ||
28 | + {field: 'thumbnail', title: __('Thumbnail'),events: Table.api.events.image, formatter: Table.api.formatter.image}, | ||
29 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
30 | + // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | ||
31 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
32 | + ] | ||
33 | + ] | ||
34 | + }); | ||
35 | + | ||
36 | + // 为表格绑定事件 | ||
37 | + Table.api.bindevent(table); | ||
38 | + }, | ||
39 | + add: function () { | ||
40 | + Controller.api.bindevent(); | ||
41 | + }, | ||
42 | + edit: function () { | ||
43 | + Controller.api.bindevent(); | ||
44 | + }, | ||
45 | + api: { | ||
46 | + bindevent: function () { | ||
47 | + Form.api.bindevent($("form[role=form]")); | ||
48 | + } | ||
49 | + } | ||
50 | + }; | ||
51 | + return Controller; | ||
52 | +}); |
17.9 KB
473.2 KB
548.3 KB
916.2 KB
371.0 KB
889.7 KB
308.4 KB
267.6 KB
498.7 KB
-
请 注册 或 登录 后发表评论