正在显示
36 个修改的文件
包含
1225 行增加
和
21 行删除
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 ProductionDynasty extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * ProductionDynasty模型对象 | ||
17 | + * @var \app\admin\model\ProductionDynasty | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\ProductionDynasty; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + public function import() | ||
29 | + { | ||
30 | + parent::import(); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
35 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
36 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
37 | + */ | ||
38 | + | ||
39 | + | ||
40 | +} |
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 ProductionFormat extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * ProductionFormat模型对象 | ||
17 | + * @var \app\admin\model\ProductionFormat | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\ProductionFormat; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + public function import() | ||
29 | + { | ||
30 | + parent::import(); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
35 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
36 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
37 | + */ | ||
38 | + | ||
39 | + | ||
40 | +} |
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 ProductionTypeface extends Backend | ||
13 | +{ | ||
14 | + | ||
15 | + /** | ||
16 | + * ProductionTypeface模型对象 | ||
17 | + * @var \app\admin\model\ProductionTypeface | ||
18 | + */ | ||
19 | + protected $model = null; | ||
20 | + | ||
21 | + public function _initialize() | ||
22 | + { | ||
23 | + parent::_initialize(); | ||
24 | + $this->model = new \app\admin\model\ProductionTypeface; | ||
25 | + | ||
26 | + } | ||
27 | + | ||
28 | + public function import() | ||
29 | + { | ||
30 | + parent::import(); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 | ||
35 | + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 | ||
36 | + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 | ||
37 | + */ | ||
38 | + | ||
39 | + | ||
40 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class ProductionDynasty extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'production_dynasty'; | ||
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 | + protected static function init() | ||
33 | + { | ||
34 | + self::afterInsert(function ($row) { | ||
35 | + if (!$row['weigh']) { | ||
36 | + $pk = $row->getPk(); | ||
37 | + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); | ||
38 | + } | ||
39 | + }); | ||
40 | + } | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | +} |
application/admin/model/ProductionFormat.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class ProductionFormat extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'production_format'; | ||
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 | + protected static function init() | ||
33 | + { | ||
34 | + self::afterInsert(function ($row) { | ||
35 | + if (!$row['weigh']) { | ||
36 | + $pk = $row->getPk(); | ||
37 | + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); | ||
38 | + } | ||
39 | + }); | ||
40 | + } | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\model; | ||
4 | + | ||
5 | +use think\Model; | ||
6 | + | ||
7 | + | ||
8 | +class ProductionTypeface extends Model | ||
9 | +{ | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + // 表名 | ||
16 | + protected $name = 'production_typeface'; | ||
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 | + protected static function init() | ||
33 | + { | ||
34 | + self::afterInsert(function ($row) { | ||
35 | + if (!$row['weigh']) { | ||
36 | + $pk = $row->getPk(); | ||
37 | + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); | ||
38 | + } | ||
39 | + }); | ||
40 | + } | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class ProductionDynasty 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 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class ProductionFormat 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 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace app\admin\validate; | ||
4 | + | ||
5 | +use think\Validate; | ||
6 | + | ||
7 | +class ProductionTypeface 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 | +} |
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">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" class="form-control" name="row[name]" type="text"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-weigh" class="form-control" name="row[weigh]" type="number"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group layer-footer"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
19 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</form> |
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">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group layer-footer"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
19 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</form> |
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('production_dynasty/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('production_dynasty/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('production_dynasty/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> | ||
13 | +<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('production_dynasty/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('production_dynasty/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('production_dynasty/edit')}" | ||
27 | + data-operate-del="{:$auth->check('production_dynasty/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
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">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" class="form-control" name="row[name]" type="text"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-weigh" class="form-control" name="row[weigh]" type="number"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group layer-footer"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
19 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</form> |
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">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group layer-footer"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
19 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</form> |
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('production_format/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('production_format/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('production_format/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> | ||
13 | +<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('production_format/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('production_format/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('production_format/edit')}" | ||
27 | + data-operate-del="{:$auth->check('production_format/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
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">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" class="form-control" name="row[name]" type="text"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-weigh" class="form-control" name="row[weigh]" type="number"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group layer-footer"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
19 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</form> |
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">{:__('Name')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}"> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}"> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + <div class="form-group layer-footer"> | ||
16 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
17 | + <div class="col-xs-12 col-sm-8"> | ||
18 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
19 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</form> |
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('production_typeface/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('production_typeface/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('production_typeface/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>--> | ||
13 | +<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('production_typeface/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('production_typeface/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('production_typeface/edit')}" | ||
27 | + data-operate-del="{:$auth->check('production_typeface/del')}" | ||
28 | + width="100%"> | ||
29 | + </table> | ||
30 | + </div> | ||
31 | + </div> | ||
32 | + | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> |
@@ -73,7 +73,9 @@ class Article extends BaseApi | @@ -73,7 +73,9 @@ class Article extends BaseApi | ||
73 | 'content'=>$data['content'], | 73 | 'content'=>$data['content'], |
74 | 'images'=>$images | 74 | 'images'=>$images |
75 | ]); | 75 | ]); |
76 | - //6.返回结果 | 76 | + //6.查询数据 |
77 | + $article = model('article')->where('id',$article['id'])->find(); | ||
78 | + //7.返回结果 | ||
77 | $this->success('增加动态成功',$article); | 79 | $this->success('增加动态成功',$article); |
78 | } | 80 | } |
79 | /** | 81 | /** |
@@ -550,7 +552,7 @@ class Article extends BaseApi | @@ -550,7 +552,7 @@ class Article extends BaseApi | ||
550 | */ | 552 | */ |
551 | public function getArticleGift(){ | 553 | public function getArticleGift(){ |
552 | //1.获取礼物数据 | 554 | //1.获取礼物数据 |
553 | - $list = model('article_gift')->order('weigh','desc')->limit(7)->select(); | 555 | + $list = model('gift')->order('weigh','desc')->limit(7)->select(); |
554 | //2.返回数据 | 556 | //2.返回数据 |
555 | $this->success('获取数据成功',$list); | 557 | $this->success('获取数据成功',$list); |
556 | } | 558 | } |
@@ -560,9 +562,9 @@ class Article extends BaseApi | @@ -560,9 +562,9 @@ class Article extends BaseApi | ||
560 | * @ApiMethod (POST) | 562 | * @ApiMethod (POST) |
561 | * @ApiRoute (/api/article/giveGift) | 563 | * @ApiRoute (/api/article/giveGift) |
562 | * @ApiParams (name="article_id", type="integer", required=true, description="动态id") | 564 | * @ApiParams (name="article_id", type="integer", required=true, description="动态id") |
563 | - * @ApiParams (name="article_gift_id", type="integer", required=true, description="礼物id") | 565 | + * @ApiParams (name="gift_id", type="integer", required=true, description="礼物id") |
564 | * @ApiParams (name="price", type="integer", required=true, description="价格") | 566 | * @ApiParams (name="price", type="integer", required=true, description="价格") |
565 | - * @ApiParams (name="status", type="integer", required=true, description="是否是自定义价格:0=不是{需要填写article_gift_id},1=是{需要填写金额}") | 567 | + * @ApiParams (name="status", type="integer", required=true, description="是否是自定义价格:0=不是{需要填写gift_id},1=是{需要填写金额}") |
566 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | 568 | * @ApiReturnParams (name="code", type="integer", required=true, sample="0") |
567 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | 569 | * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") |
568 | * @ApiReturnParams (name="data", type="object", description="扩展数据返回") | 570 | * @ApiReturnParams (name="data", type="object", description="扩展数据返回") |
@@ -584,12 +586,12 @@ class Article extends BaseApi | @@ -584,12 +586,12 @@ class Article extends BaseApi | ||
584 | //3.判断不是自定义价格 | 586 | //3.判断不是自定义价格 |
585 | if ($data['status'] == 0){ | 587 | if ($data['status'] == 0){ |
586 | //3.1 查询礼物 | 588 | //3.1 查询礼物 |
587 | - $article_gift = model('article_gift')->where('id',$this->get_data('article_gift_id','礼物id不能为空'))->find(); | ||
588 | - if (!$article_gift)$this->error('未查询到相关礼物,请您检查article_gift_id'); | 589 | + $article_gift = model('gift')->where('id',$this->get_data('gift_id','礼物id不能为空'))->find(); |
590 | + if (!$article_gift)$this->error('未查询到相关礼物,请您检查gift_id'); | ||
589 | //3.2 查询礼物订单 | 591 | //3.2 查询礼物订单 |
590 | $is_order = model('article_gift_order') | 592 | $is_order = model('article_gift_order') |
591 | ->where('article_id',$article['id']) | 593 | ->where('article_id',$article['id']) |
592 | - ->where('article_gift_id',$article_gift['id']) | 594 | + ->where('gift_id',$article_gift['id']) |
593 | ->where('is_custom',0) | 595 | ->where('is_custom',0) |
594 | ->where('status',0) | 596 | ->where('status',0) |
595 | ->where('price',$article_gift['price']) | 597 | ->where('price',$article_gift['price']) |
@@ -607,7 +609,7 @@ class Article extends BaseApi | @@ -607,7 +609,7 @@ class Article extends BaseApi | ||
607 | 'price'=>$article_gift['price'], | 609 | 'price'=>$article_gift['price'], |
608 | 'status'=>0, | 610 | 'status'=>0, |
609 | 'is_custom'=>0, | 611 | 'is_custom'=>0, |
610 | - 'article_gift_id'=>$article_gift['id'], | 612 | + 'gift_id'=>$article_gift['id'], |
611 | 'article_gift_name'=>$article_gift['name'], | 613 | 'article_gift_name'=>$article_gift['name'], |
612 | ]; | 614 | ]; |
613 | $is_order = model('article_gift_order')->create($a_data); | 615 | $is_order = model('article_gift_order')->create($a_data); |
@@ -648,18 +650,17 @@ class Article extends BaseApi | @@ -648,18 +650,17 @@ class Article extends BaseApi | ||
648 | $app = Factory::payment($config); | 650 | $app = Factory::payment($config); |
649 | //6.查询用户的第三方登录信息 | 651 | //6.查询用户的第三方登录信息 |
650 | $fa_third = Db::name('third')->where('user_id',$this->auth->id)->find(); | 652 | $fa_third = Db::name('third')->where('user_id',$this->auth->id)->find(); |
651 | - dd($fa_third); | 653 | + if (!$fa_third)$this->error('第三方授权数据不存在'); |
652 | //3.统一下单接口 | 654 | //3.统一下单接口 |
653 | $result = $app->order->unify([ | 655 | $result = $app->order->unify([ |
654 | 'body' => '送出礼物', | 656 | 'body' => '送出礼物', |
655 | 'out_trade_no' => $is_order['number'], | 657 | 'out_trade_no' => $is_order['number'], |
656 | //'total_fee' => $order['price'] * 100, | 658 | //'total_fee' => $order['price'] * 100, |
657 | 'total_fee' => 1, | 659 | 'total_fee' => 1, |
658 | - 'notify_url' =>this_url().'/api/course_order/setWechatNotify', // 支付结果通知网址,如果不设置则会使用配置里的默认地址 | 660 | + 'notify_url' =>this_url().'/api/article/setWechatGiftNotify', // 支付结果通知网址,如果不设置则会使用配置里的默认地址 |
659 | 'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型 | 661 | 'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型 |
660 | 'openid' => $fa_third['openid'], | 662 | 'openid' => $fa_third['openid'], |
661 | ]); | 663 | ]); |
662 | - dd($result); | ||
663 | //4.判断返回结果 | 664 | //4.判断返回结果 |
664 | if ($result['result_code'] == 'SUCCESS' && $result['return_code'] == 'SUCCESS') { | 665 | if ($result['result_code'] == 'SUCCESS' && $result['return_code'] == 'SUCCESS') { |
665 | $prepayId = $result['prepay_id']; | 666 | $prepayId = $result['prepay_id']; |
@@ -669,16 +670,29 @@ class Article extends BaseApi | @@ -669,16 +670,29 @@ class Article extends BaseApi | ||
669 | } else { | 670 | } else { |
670 | $this->error('失败',$result); | 671 | $this->error('失败',$result); |
671 | } | 672 | } |
672 | - | ||
673 | - | ||
674 | $list = model('article_gift')->order('weigh','desc')->limit(7)->select(); | 673 | $list = model('article_gift')->order('weigh','desc')->limit(7)->select(); |
675 | //2.返回数据 | 674 | //2.返回数据 |
676 | $this->success('获取数据成功',$list); | 675 | $this->success('获取数据成功',$list); |
677 | } | 676 | } |
678 | - | ||
679 | - | ||
680 | - | ||
681 | - | ||
682 | - | ||
683 | - | 677 | + /** |
678 | + * 支付礼物回调 | ||
679 | + * @ApiMethod (POST) | ||
680 | + * @ApiRoute (/api/article/setWechatGiftNotify) | ||
681 | + * @ApiReturn () | ||
682 | + */ | ||
683 | + public function setWechatNotify(){ | ||
684 | + $config = config('EasyWeChat'); | ||
685 | + $app = Factory::payment($config); | ||
686 | + $response = $app->handlePaidNotify(function ($message, $fail) { | ||
687 | + //将礼物进行支付 | ||
688 | + $order = model('article_gift_order')->where('number',$message['out_trade_no'])->find(); | ||
689 | + if (!$order)$fail('订单不存在'); | ||
690 | + if ($order['status'] == 1)$fail('您的订单已经支付'); | ||
691 | + $order->status = 1; | ||
692 | + $order->save(); | ||
693 | + //给礼物用户一个通知 | ||
694 | + // | ||
695 | + }); | ||
696 | + $response->send(); // Laravel 里请使用:return $response; | ||
697 | + } | ||
684 | } | 698 | } |
@@ -3,6 +3,8 @@ | @@ -3,6 +3,8 @@ | ||
3 | 3 | ||
4 | namespace app\api\controller; | 4 | namespace app\api\controller; |
5 | 5 | ||
6 | +use function Couchbase\defaultDecoder; | ||
7 | + | ||
6 | /** | 8 | /** |
7 | * 首页相关 | 9 | * 首页相关 |
8 | * @package app\api\controller | 10 | * @package app\api\controller |
@@ -93,6 +95,107 @@ class Index extends BaseApi | @@ -93,6 +95,107 @@ class Index extends BaseApi | ||
93 | $this->success('查询数据成功',$art_list); | 95 | $this->success('查询数据成功',$art_list); |
94 | } | 96 | } |
95 | /** | 97 | /** |
98 | + * 获取动态栏目列表 | ||
99 | + * @ApiTitle (获取动态栏目列表) | ||
100 | + * @ApiMethod (POST) | ||
101 | + * @ApiRoute (/api/index/articleCategoryList) | ||
102 | + * @ApiParams (name="num", type="integer", required=false, description="请求数量 传为所有") | ||
103 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
104 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
105 | + * @ApiReturnParams (name="data", type="object", description="扩展数据返回") | ||
106 | + * @ApiReturn () | ||
107 | + */ | ||
108 | + public function articleCategoryList(){ | ||
109 | + $num = input('param.num'); | ||
110 | + if ($num){ | ||
111 | + $articleCategoryList = model('article_category')->order('weigh','desc')->limit($num)->select(); | ||
112 | + }else{ | ||
113 | + $articleCategoryList = model('article_category')->order('weigh','desc')->select(); | ||
114 | + } | ||
115 | + $this->success('查询成功',$articleCategoryList); | ||
116 | + } | ||
117 | + /** | ||
118 | + * 首页分类列表+搜索 | ||
119 | + * @ApiTitle (首页分类列表+搜索) | ||
120 | + * @ApiMethod (POST) | ||
121 | + * @ApiRoute (/api/index/CategoryList) | ||
122 | + * @ApiParams (name="page", type="integer", required=true, description="分页次数") | ||
123 | + * @ApiParams (name="num", type="integer", required=true, description="分页数量") | ||
124 | + * @ApiParams (name="article_category_id", type="integer", required=true, description="动态栏目id") | ||
125 | + * @ApiParams (name="search", type="string", required=false, description="搜索内容") | ||
126 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
127 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
128 | + * @ApiReturnParams (name="data", type="object", description="扩展数据返回") | ||
129 | + * @ApiReturn ({ | ||
130 | + "code": 1, | ||
131 | + "msg": "查询数据成功", | ||
132 | + "time": "1608857680", | ||
133 | + "data": [ | ||
134 | + { | ||
135 | + "id": 9, | ||
136 | + "user_id": 1, | ||
137 | + "article_category_id": 7, | ||
138 | + "content": "内", | ||
139 | + "images": [ | ||
140 | + "http://qldk2g57y.hn-bkt.clouddn.com/uploads/20201221/667431fe2f31e5d0e76344ba7545ea20.jpg" | ||
141 | + ], | ||
142 | + "createtime": "2020-12-24 15:13:48", | ||
143 | + "updatetime": "2020-12-24 15:13:48", | ||
144 | + "deletetime": null, | ||
145 | + "message": null, | ||
146 | + "is_friend": "是否是好友 1=是 0=不是", | ||
147 | + "str_time": "首页显示时间" | ||
148 | + } | ||
149 | + ] | ||
150 | + }) | ||
151 | + */ | ||
152 | + public function CategoryList(){ | ||
153 | + //1.获取数据 | ||
154 | + $data = $this->get_data_array([ | ||
155 | + ['page','分页次数不能为空'], | ||
156 | + ['num','分页数量不能为空'], | ||
157 | + ['article_category_id','动态栏目id必须填写'], | ||
158 | + ]); | ||
159 | + //2.获取列表数据 | ||
160 | + $art_list = model('article') | ||
161 | + ->where('deletetime',null) | ||
162 | + ->where('article_category_id',$data['article_category_id']) | ||
163 | + ->with(['user']) | ||
164 | + ->order('createtime','desc') | ||
165 | + ->page($data['page'],$data['num']) | ||
166 | + ->select(); | ||
167 | + //3.判断是不是搜索 | ||
168 | + $search = input('param.search'); | ||
169 | + if (isset($search) && !empty($search)){ | ||
170 | + $art_list = model('article') | ||
171 | + ->where('deletetime',null) | ||
172 | + ->where('article_category_id',$data['article_category_id']) | ||
173 | + ->where('content','like','%'.$search.'%') | ||
174 | + ->with(['user']) | ||
175 | + ->order('createtime','desc') | ||
176 | + ->page($data['page'],$data['num']) | ||
177 | + ->select(); | ||
178 | + } | ||
179 | + //3.判断是不是好友 | ||
180 | + $user_id = $this->auth->id; | ||
181 | + if (!empty($art_list)){ | ||
182 | + foreach ($art_list as $key => $val){ | ||
183 | + //1.查询关注和被关注 | ||
184 | + $attention = model('user_attention')->where(function ($query) use ($val,$user_id){ | ||
185 | + $query->where('user_id',$user_id)->where('in_user_id',$val['user_id']); | ||
186 | + })->whereOr(function ($query) use ($val,$user_id){ | ||
187 | + $query->where('user_id',$val['user_id'])->where('in_user_id',$user_id); | ||
188 | + })->count(); | ||
189 | + if ($attention == 2){ | ||
190 | + $art_list[$key]['is_friend'] = 1; | ||
191 | + }else{ | ||
192 | + $art_list[$key]['is_friend'] = 1; | ||
193 | + } | ||
194 | + } | ||
195 | + } | ||
196 | + $this->success('查询数据成功',$art_list); | ||
197 | + } | ||
198 | + /** | ||
96 | * 搜索动态 | 199 | * 搜索动态 |
97 | * @ApiTitle (搜索动态) | 200 | * @ApiTitle (搜索动态) |
98 | * @ApiMethod (POST) | 201 | * @ApiMethod (POST) |
application/api/controller/Production.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | + | ||
4 | +namespace app\api\controller; | ||
5 | + | ||
6 | +/** | ||
7 | + * 作品相关 | ||
8 | + * @package app\api\controller | ||
9 | + */ | ||
10 | +class Production extends BaseApi | ||
11 | +{ | ||
12 | + | ||
13 | + protected $noNeedLogin = ''; | ||
14 | + protected $noNeedRight = '*'; | ||
15 | + | ||
16 | + /** | ||
17 | + * 获取作品朝代 | ||
18 | + */ | ||
19 | + public function getDynasty(){ | ||
20 | + $dynasty = model('production_dynasty')->order('weigh','desc')->field('id,name,createtime')->select(); | ||
21 | + $this->success('查询成功',$dynasty); | ||
22 | + } | ||
23 | + /** | ||
24 | + * 获取作品格式 | ||
25 | + */ | ||
26 | + public function getFormat(){ | ||
27 | + $forma = model('production_tforma')->order('weigh','desc')->field('id,name,createtime')->select(); | ||
28 | + $this->success('查询成功',$forma); | ||
29 | + } | ||
30 | + /** | ||
31 | + * 获取作品字体 | ||
32 | + */ | ||
33 | + public function getTypeface(){ | ||
34 | + $typeface = model('production_typeface')->order('weigh','desc')->field('id,name,createtime')->select(); | ||
35 | + $this->success('查询成功',$typeface); | ||
36 | + } | ||
37 | + /** | ||
38 | + * 增加作品 | ||
39 | + * @ApiTitle (增加作品) | ||
40 | + * @ApiMethod (POST) | ||
41 | + * @ApiRoute (/api/production/addProduction) | ||
42 | + * @ApiParams (name="title", type="string", required=true, description="作品标题") | ||
43 | + * @ApiParams (name="content", type="string", required=true, description="内容") | ||
44 | + * @ApiParams (name="images", type="string", required=true, description="图片数组(不带域名)") | ||
45 | + * @ApiParams (name="typeface_id", type="integer", required=true, description="字体ID") | ||
46 | + * @ApiParams (name="dynasty_id", type="integer", required=true, description="朝代ID") | ||
47 | + * @ApiParams (name="format_id", type="integer", required=true, description="格式ID") | ||
48 | + * @ApiParams (name="width", type="integer", required=true, description="宽度") | ||
49 | + * @ApiParams (name="height", type="integer", required=true, description="高度") | ||
50 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
51 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
52 | + * @ApiReturnParams (name="data", type="object", description="扩展数据返回") | ||
53 | + * @ApiReturn ({ | ||
54 | + "code": 1, | ||
55 | + "msg": "增加作品成功", | ||
56 | + "time": "1609213602", | ||
57 | + "data": { | ||
58 | + "title": "作品标题", | ||
59 | + "content": "作品内容", | ||
60 | + "images": "作品图片", | ||
61 | + "typeface_id": "字体ID", | ||
62 | + "dynasty_id": "朝代ID", | ||
63 | + "format_id": "格式ID", | ||
64 | + "width": "宽度", | ||
65 | + "height": "高度", | ||
66 | + "typeface": "字体", | ||
67 | + "dynasty": "朝代", | ||
68 | + "format": "格式", | ||
69 | + "user_id": "用户ID", | ||
70 | + "avatar": "头像", | ||
71 | + "nickname": "署名", | ||
72 | + "fenxiang_num": "分享数量", | ||
73 | + "zan_num": "点赞数量", | ||
74 | + "ping_num": "点赞数量", | ||
75 | + "price_num": "打赏总数", | ||
76 | + "shoucang_num": "收藏数量", | ||
77 | + "createtime": "2020-12-29 11:46:43", | ||
78 | + "updatetime": "2020-12-29 11:46:43", | ||
79 | + "id": "2" | ||
80 | + } | ||
81 | + }) | ||
82 | + */ | ||
83 | + public function addProduction(){ | ||
84 | + //1.验证用户权限 | ||
85 | + if ($this->auth->authlist == '' || $this->auth->authlist == ','){ | ||
86 | + $this->error('请您先实名认证'); | ||
87 | + } | ||
88 | + //2.获取数据 | ||
89 | + $data = $this->get_data_array([ | ||
90 | + ['title','作品标题不能为空'], | ||
91 | + ['content','内容不存在'], | ||
92 | + ['images','图片必须上传'], | ||
93 | + ['typeface_id','字体ID必须传入'], | ||
94 | + ['dynasty_id','朝代ID必须传入'], | ||
95 | + ['format_id','格式ID必须传入'], | ||
96 | + ['width','宽度'], | ||
97 | + ['height','高度'], | ||
98 | + ]); | ||
99 | + //3.获取图片数据 | ||
100 | + $files = str_replace('"','"',$data['images']); | ||
101 | + $images = implode(',',json_decode($files,true)); | ||
102 | + //4.查询数据 | ||
103 | + $typeface = model('production_typeface')->where('id',$data['typeface_id'])->find(); | ||
104 | + $dynasty = model('production_dynasty')->where('id',$data['dynasty_id'])->find(); | ||
105 | + $format = model('production_format')->where('id',$data['format_id'])->find(); | ||
106 | + if (!$typeface || !$dynasty || !$format){ | ||
107 | + $this->error('数据不存在'); | ||
108 | + } | ||
109 | + $data['typeface'] = $typeface['name']; | ||
110 | + $data['dynasty'] = $dynasty['name']; | ||
111 | + $data['format'] = $format['name']; | ||
112 | + $data['user_id'] = $this->auth->id; | ||
113 | + $data['avatar'] = $this->auth->avatar; | ||
114 | + $data['nickname'] = $this->auth->nickname; | ||
115 | + $data['images'] = $images; | ||
116 | + //5.增加作品 | ||
117 | + $production = model('production')->create($data); | ||
118 | + //6.查询数据 | ||
119 | + $production = model('production')->where('id',$production['id'])->find(); | ||
120 | + //7.返回结果 | ||
121 | + $this->success('增加作品成功',$production); | ||
122 | + } | ||
123 | + /** | ||
124 | + * 增加作品列表 | ||
125 | + * @ApiTitle (获取首页动态) | ||
126 | + * @ApiMethod (POST) | ||
127 | + * @ApiRoute (/api/production/articleList) | ||
128 | + * @ApiParams (name="page", type="integer", required=true, description="分页次数") | ||
129 | + * @ApiParams (name="num", type="integer", required=true, description="分页数量") | ||
130 | + * @ApiParams (name="status", type="integer", required=true, description="1=最热,2=最新作品,3=书体筛选") | ||
131 | + * @ApiParams (name="production_typeface_id", type="integer", required=true, description="1=最热,2=最新作品,3=书体筛选") | ||
132 | + * @ApiReturnParams (name="code", type="integer", required=true, sample="0") | ||
133 | + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功") | ||
134 | + * @ApiReturnParams (name="data", type="object", description="扩展数据返回") | ||
135 | + * @ApiReturn ({ | ||
136 | + "code": 1, | ||
137 | + "msg": "增加作品成功", | ||
138 | + "time": "1609213602", | ||
139 | + "data": { | ||
140 | + "title": "作品标题", | ||
141 | + "content": "作品内容", | ||
142 | + "images": "作品图片", | ||
143 | + "typeface_id": "字体ID", | ||
144 | + "dynasty_id": "朝代ID", | ||
145 | + "format_id": "格式ID", | ||
146 | + "width": "宽度", | ||
147 | + "height": "高度", | ||
148 | + "typeface": "字体", | ||
149 | + "dynasty": "朝代", | ||
150 | + "format": "格式", | ||
151 | + "user_id": "用户ID", | ||
152 | + "avatar": "头像", | ||
153 | + "nickname": "署名", | ||
154 | + "fenxiang_num": "分享数量", | ||
155 | + "zan_num": "点赞数量", | ||
156 | + "ping_num": "点赞数量", | ||
157 | + "price_num": "打赏总数", | ||
158 | + "shoucang_num": "收藏数量", | ||
159 | + "createtime": "2020-12-29 11:46:43", | ||
160 | + "updatetime": "2020-12-29 11:46:43", | ||
161 | + "id": "2" | ||
162 | + } | ||
163 | + }) | ||
164 | + */ | ||
165 | + public function ProductionList(){ | ||
166 | + //1.获取数据 | ||
167 | + $data = $this->get_data_array([ | ||
168 | + ['page','分页次数不能为空'], | ||
169 | + ['num','分页数量不能为空'], | ||
170 | + ['status','状态必须填写'], | ||
171 | + ]); | ||
172 | + //2.获取列表数据 | ||
173 | + if ($data['status'] == 1){ | ||
174 | + //最热 | ||
175 | + $Pro_list = model('production') | ||
176 | + ->where('deletetime',null) | ||
177 | + ->with(['user']) | ||
178 | + ->order('zan_num','desc') | ||
179 | + ->page($data['page'],$data['num']) | ||
180 | + ->select(); | ||
181 | + }else if ($data['status'] == 2){ | ||
182 | + //最新作品 | ||
183 | + $Pro_list = model('production') | ||
184 | + ->where('deletetime',null) | ||
185 | + ->with(['user']) | ||
186 | + ->order('createtime','desc') | ||
187 | + ->page($data['page'],$data['num']) | ||
188 | + ->select(); | ||
189 | + }else if ($data['status'] == 2){ | ||
190 | + $typeface_id = $this->get_data('typeface_id','字体ID不能为空'); | ||
191 | + //最新作品 | ||
192 | + $Pro_list = model('production') | ||
193 | + ->where('deletetime',null) | ||
194 | + ->with(['user']) | ||
195 | + ->where('typeface_id',$typeface_id) | ||
196 | + ->page($data['page'],$data['num']) | ||
197 | + ->select(); | ||
198 | + } | ||
199 | + //3.判断是不是好友 | ||
200 | + $user_id = $this->auth->id; | ||
201 | + if (!empty($Pro_list)){ | ||
202 | + foreach ($Pro_list as $key => $val){ | ||
203 | + //1.查询关注和被关注 | ||
204 | + $attention = model('production_zan')->where('','')->where('','')->count(); | ||
205 | + if ($attention == 2){ | ||
206 | + $art_list[$key]['is_friend'] = 1; | ||
207 | + }else{ | ||
208 | + $art_list[$key]['is_friend'] = 1; | ||
209 | + } | ||
210 | + } | ||
211 | + } | ||
212 | + $this->success('查询数据成功',$art_list); | ||
213 | + } | ||
214 | + | ||
215 | +} |
@@ -469,3 +469,27 @@ if (!function_exists('this_url')){ | @@ -469,3 +469,27 @@ if (!function_exists('this_url')){ | ||
469 | } | 469 | } |
470 | } | 470 | } |
471 | 471 | ||
472 | + | ||
473 | +/** | ||
474 | + * 打印数据 | ||
475 | + * @param string $name 数据 | ||
476 | + * @return mixed | ||
477 | + */ | ||
478 | +if (!function_exists('dd')) { | ||
479 | + function dd($name,$stu = true){ | ||
480 | + if (is_string($name)){ | ||
481 | + echo gettype($name); | ||
482 | + echo '</br>'; | ||
483 | + echo $name; | ||
484 | + exit(); | ||
485 | + } | ||
486 | + if ($stu){ | ||
487 | + echo json_encode($name); | ||
488 | + }else{ | ||
489 | + echo "<pre>"; | ||
490 | + var_dump($name); | ||
491 | + echo "</pre>"; | ||
492 | + } | ||
493 | + exit(); | ||
494 | + } | ||
495 | +} |
application/common/model/Production.php
0 → 100644
application/common/model/ProductionZan.php
0 → 100644
@@ -290,7 +290,7 @@ return [ | @@ -290,7 +290,7 @@ return [ | ||
290 | //插件纯净模式,插件启用后是否删除插件目录的application、public和assets文件夹 | 290 | //插件纯净模式,插件启用后是否删除插件目录的application、public和assets文件夹 |
291 | 'addon_pure_mode' => true, | 291 | 'addon_pure_mode' => true, |
292 | //允许跨域的域名,多个以,分隔 | 292 | //允许跨域的域名,多个以,分隔 |
293 | - 'cors_request_domain' => 'localhost,127.0.0.1', | 293 | + 'cors_request_domain' => 'localhost,127.0.0.1,sjbk.h.brofirst.cn', |
294 | //版本号 | 294 | //版本号 |
295 | 'version' => '1.2.0.20201008_beta', | 295 | 'version' => '1.2.0.20201008_beta', |
296 | //API接口地址 | 296 | //API接口地址 |
此 diff 太大无法显示。
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: 'production_dynasty/index' + location.search, | ||
9 | + add_url: 'production_dynasty/add', | ||
10 | + edit_url: 'production_dynasty/edit', | ||
11 | + del_url: 'production_dynasty/del', | ||
12 | + multi_url: 'production_dynasty/multi', | ||
13 | + import_url: 'production_dynasty/import', | ||
14 | + table: 'production_dynasty', | ||
15 | + } | ||
16 | + }); | ||
17 | + | ||
18 | + var table = $("#table"); | ||
19 | + | ||
20 | + // 初始化表格 | ||
21 | + table.bootstrapTable({ | ||
22 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
23 | + pk: 'id', | ||
24 | + sortName: 'weigh', | ||
25 | + search:false, | ||
26 | + visible: false, | ||
27 | + showToggle: false, | ||
28 | + showColumns: false, | ||
29 | + howExport: false, | ||
30 | + commonSearch: false, | ||
31 | + operate: false, | ||
32 | + columns: [ | ||
33 | + [ | ||
34 | + {checkbox: true}, | ||
35 | + {field: 'id', title: __('Id')}, | ||
36 | + {field: 'name', title: __('Name'), operate: 'LIKE'}, | ||
37 | + {field: 'weigh', title: __('Weigh'), operate: false}, | ||
38 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
39 | + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
40 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
41 | + ] | ||
42 | + ] | ||
43 | + }); | ||
44 | + | ||
45 | + // 为表格绑定事件 | ||
46 | + Table.api.bindevent(table); | ||
47 | + }, | ||
48 | + add: function () { | ||
49 | + Controller.api.bindevent(); | ||
50 | + }, | ||
51 | + edit: function () { | ||
52 | + Controller.api.bindevent(); | ||
53 | + }, | ||
54 | + api: { | ||
55 | + bindevent: function () { | ||
56 | + Form.api.bindevent($("form[role=form]")); | ||
57 | + } | ||
58 | + } | ||
59 | + }; | ||
60 | + return Controller; | ||
61 | +}); |
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: 'production_format/index' + location.search, | ||
9 | + add_url: 'production_format/add', | ||
10 | + edit_url: 'production_format/edit', | ||
11 | + del_url: 'production_format/del', | ||
12 | + multi_url: 'production_format/multi', | ||
13 | + import_url: 'production_format/import', | ||
14 | + table: 'production_format', | ||
15 | + } | ||
16 | + }); | ||
17 | + | ||
18 | + var table = $("#table"); | ||
19 | + | ||
20 | + // 初始化表格 | ||
21 | + table.bootstrapTable({ | ||
22 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
23 | + pk: 'id', | ||
24 | + sortName: 'weigh', | ||
25 | + search:false, | ||
26 | + visible: false, | ||
27 | + showToggle: false, | ||
28 | + showColumns: false, | ||
29 | + howExport: false, | ||
30 | + commonSearch: false, | ||
31 | + operate: false, | ||
32 | + columns: [ | ||
33 | + [ | ||
34 | + {checkbox: true}, | ||
35 | + {field: 'id', title: __('Id')}, | ||
36 | + {field: 'name', title: __('Name'), operate: 'LIKE'}, | ||
37 | + {field: 'weigh', title: __('Weigh'), operate: false}, | ||
38 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
39 | + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
40 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
41 | + ] | ||
42 | + ] | ||
43 | + }); | ||
44 | + | ||
45 | + // 为表格绑定事件 | ||
46 | + Table.api.bindevent(table); | ||
47 | + }, | ||
48 | + add: function () { | ||
49 | + Controller.api.bindevent(); | ||
50 | + }, | ||
51 | + edit: function () { | ||
52 | + Controller.api.bindevent(); | ||
53 | + }, | ||
54 | + api: { | ||
55 | + bindevent: function () { | ||
56 | + Form.api.bindevent($("form[role=form]")); | ||
57 | + } | ||
58 | + } | ||
59 | + }; | ||
60 | + return Controller; | ||
61 | +}); |
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: 'production_typeface/index' + location.search, | ||
9 | + add_url: 'production_typeface/add', | ||
10 | + edit_url: 'production_typeface/edit', | ||
11 | + del_url: 'production_typeface/del', | ||
12 | + multi_url: 'production_typeface/multi', | ||
13 | + import_url: 'production_typeface/import', | ||
14 | + table: 'production_typeface', | ||
15 | + } | ||
16 | + }); | ||
17 | + | ||
18 | + var table = $("#table"); | ||
19 | + | ||
20 | + // 初始化表格 | ||
21 | + table.bootstrapTable({ | ||
22 | + url: $.fn.bootstrapTable.defaults.extend.index_url, | ||
23 | + pk: 'id', | ||
24 | + sortName: 'weigh', | ||
25 | + search:false, | ||
26 | + visible: false, | ||
27 | + showToggle: false, | ||
28 | + showColumns: false, | ||
29 | + howExport: false, | ||
30 | + commonSearch: false, | ||
31 | + operate: false, | ||
32 | + columns: [ | ||
33 | + [ | ||
34 | + {checkbox: true}, | ||
35 | + {field: 'id', title: __('Id')}, | ||
36 | + {field: 'name', title: __('Name'), operate: 'LIKE'}, | ||
37 | + {field: 'weigh', title: __('Weigh'), operate: false}, | ||
38 | + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
39 | + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
40 | + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | ||
41 | + ] | ||
42 | + ] | ||
43 | + }); | ||
44 | + | ||
45 | + // 为表格绑定事件 | ||
46 | + Table.api.bindevent(table); | ||
47 | + }, | ||
48 | + add: function () { | ||
49 | + Controller.api.bindevent(); | ||
50 | + }, | ||
51 | + edit: function () { | ||
52 | + Controller.api.bindevent(); | ||
53 | + }, | ||
54 | + api: { | ||
55 | + bindevent: function () { | ||
56 | + Form.api.bindevent($("form[role=form]")); | ||
57 | + } | ||
58 | + } | ||
59 | + }; | ||
60 | + return Controller; | ||
61 | +}); |
-
请 注册 或 登录 后发表评论