正在显示
11 个修改的文件
包含
281 行增加
和
3 行删除
application/admin/controller/Gbanner.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\controller; | ||
4 | + | ||
5 | +use app\common\controller\Backend; | ||
6 | + | ||
7 | +/** | ||
8 | + * 商城banner图标 | ||
9 | + * | ||
10 | + * @icon fa fa-circle-o | ||
11 | + */ | ||
12 | +class Gbanner extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * Gbanner模型对象 | ||
17 | + * @var \app\admin\model\Gbanner | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\Gbanner; | ||
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/lang/zh-cn/gbanner.php
0 → 100644
application/admin/model/Gbanner.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | +class Gbanner extends Model | ||
8 | +{ | ||
9 | + // 表名 | ||
10 | + protected $name = 'gbanner'; | ||
11 | + | ||
12 | + // 自动写入时间戳字段 | ||
13 | + protected $autoWriteTimestamp = 'int'; | ||
14 | + | ||
15 | + // 定义时间戳字段名 | ||
16 | + protected $createTime = 'createtime'; | ||
17 | + protected $updateTime = 'updatetime'; | ||
18 | + | ||
19 | + // 追加属性 | ||
20 | + protected $append = [ | ||
21 | + 'deletetime_text' | ||
22 | + ]; | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + public function getDeletetimeTextAttr($value, $data) | ||
30 | + { | ||
31 | + $value = $value ? $value : (isset($data['deletetime']) ? $data['deletetime'] : ''); | ||
32 | + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; | ||
33 | + } | ||
34 | + | ||
35 | + protected function setDeletetimeAttr($value) | ||
36 | + { | ||
37 | + return $value && !is_numeric($value) ? strtotime($value) : $value; | ||
38 | + } | ||
39 | + | ||
40 | + | ||
41 | +} |
application/admin/validate/Gbanner.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class Gbanner 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/gbanner/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" value=""> | ||
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 layer-footer"> | ||
18 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
19 | + <div class="col-xs-12 col-sm-8"> | ||
20 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
21 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
22 | + </div> | ||
23 | + </div> | ||
24 | +</form> |
application/admin/view/gbanner/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}"> | ||
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 layer-footer"> | ||
18 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
19 | + <div class="col-xs-12 col-sm-8"> | ||
20 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
21 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
22 | + </div> | ||
23 | + </div> | ||
24 | +</form> |
application/admin/view/gbanner/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('gbanner/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('gbanner/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('gbanner/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a> | ||
13 | + <!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('gbanner/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('gbanner/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 | + </div> | ||
23 | + <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | ||
24 | + data-operate-edit="{:$auth->check('gbanner/edit')}" | ||
25 | + data-operate-del="{:$auth->check('gbanner/del')}" | ||
26 | + width="100%"> | ||
27 | + </table> | ||
28 | + </div> | ||
29 | + </div> | ||
30 | + | ||
31 | + </div> | ||
32 | + </div> | ||
33 | +</div> |
@@ -53,8 +53,8 @@ class Index extends Api | @@ -53,8 +53,8 @@ class Index extends Api | ||
53 | } | 53 | } |
54 | 54 | ||
55 | /** | 55 | /** |
56 | - * @ApiTitle (获取banner图) | ||
57 | - * @ApiSummary (获取banner图) | 56 | + * @ApiTitle (获取首页banner图) |
57 | + * @ApiSummary (获取首页banner图) | ||
58 | * @ApiMethod (GET) | 58 | * @ApiMethod (GET) |
59 | * @ApiRoute (/api/index/getBanner) | 59 | * @ApiRoute (/api/index/getBanner) |
60 | * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | 60 | * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") |
@@ -84,4 +84,37 @@ class Index extends Api | @@ -84,4 +84,37 @@ class Index extends Api | ||
84 | $this->error('请求方式错误'); | 84 | $this->error('请求方式错误'); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | + | ||
88 | + /** | ||
89 | + * @ApiTitle (获取商城banner图) | ||
90 | + * @ApiSummary (获取商城banner图) | ||
91 | + * @ApiMethod (GET) | ||
92 | + * @ApiRoute (/api/index/getGoodsBanner) | ||
93 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
94 | + * @ApiReturn ({ | ||
95 | + "code": 1, | ||
96 | + "msg": "成功", | ||
97 | + "time": "1553831004", | ||
98 | + "data": [ | ||
99 | + { | ||
100 | + "id": 1, | ||
101 | + "image": "http://feipin.w.brotop.cn/uploads/20190319/4a4c015ca04593f70a4836da45f2dea4.jpg"//banner图 | ||
102 | + }, | ||
103 | + { | ||
104 | + "id": 2, | ||
105 | + "image": "http://feipin.w.brotop.cn/uploads/20190319/4d82786ab0f7866110519f221cbf29a6.jpg" | ||
106 | + }, | ||
107 | + ] | ||
108 | + }) | ||
109 | + */ | ||
110 | + public function getGoodsBanner(){ | ||
111 | + if($this->request->isGet()){ | ||
112 | + $data = Db::table('gc_gbanner') | ||
113 | + ->field('id,image') | ||
114 | + ->select(); | ||
115 | + $this->success('成功', $data); | ||
116 | + }else{ | ||
117 | + $this->error('请求方式错误'); | ||
118 | + } | ||
119 | + } | ||
87 | } | 120 | } |
@@ -45,6 +45,7 @@ class Person extends Api | @@ -45,6 +45,7 @@ class Person extends Api | ||
45 | "license_num": "",//公司编码 | 45 | "license_num": "",//公司编码 |
46 | "license_img": ""//公司营业执照 | 46 | "license_img": ""//公司营业执照 |
47 | "money":100//账户余额 | 47 | "money":100//账户余额 |
48 | + "avatar"://头像 | ||
48 | } | 49 | } |
49 | }) | 50 | }) |
50 | */ | 51 | */ |
@@ -52,7 +53,7 @@ class Person extends Api | @@ -52,7 +53,7 @@ class Person extends Api | ||
52 | if($this->request->isGet()){ | 53 | if($this->request->isGet()){ |
53 | $data = Db::table('gc_user') | 54 | $data = Db::table('gc_user') |
54 | ->where(['id'=>$this->user_id]) | 55 | ->where(['id'=>$this->user_id]) |
55 | - ->field('id,username,mobile,type,address,id_num,id_img,company_name,license_num,license_img,money') | 56 | + ->field('id,nickname,username,mobile,type,address,id_num,id_img,company_name,license_num,license_img,money,avatar') |
56 | ->find(); | 57 | ->find(); |
57 | $this->success('成功', $data); | 58 | $this->success('成功', $data); |
58 | }else{ | 59 | }else{ |
此 diff 太大无法显示。
public/assets/js/backend/gbanner.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: 'gbanner/index', | ||
9 | + add_url: 'gbanner/add', | ||
10 | + edit_url: 'gbanner/edit', | ||
11 | + del_url: 'gbanner/del', | ||
12 | + multi_url: 'gbanner/multi', | ||
13 | + table: 'gbanner', | ||
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'), 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: 'deletetime', title: __('Deletetime'), 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 | +}); |
-
请 注册 或 登录 后发表评论