Skip to content

Commit 2382ad9

Browse files
author
jianyan74
committed
增加gii使用说明文档
1 parent e534a5a commit 2382ad9

6 files changed

Lines changed: 116 additions & 0 deletions

File tree

docs/guide-zh-CN/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- [表单控件](sys-widget.md)
1818
- [系统组件](sys-subassembly.md)
1919
- [系统JS](sys-js-method.md)
20+
- [Gii](sys-gii.md)
2021
- [权限控制](sys-auth.md)
2122
- [公用支付](sys-payment.md)
2223
- [消息队列](sys-queue.md)
14.7 KB
Loading
37.5 KB
Loading
33.2 KB
Loading

docs/guide-zh-CN/start-update-log.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
> 各个小版本升级例如 2.1.x 升级到 2.2.x 以上不能完美升级最好重新安装
1111
12+
### v2.3.128(待发布)
13+
updated 2019.9.20
14+
15+
- 优化: 公用微信 js 支付,调用 easywechat 的 js 支付视图进行兼容 [@yiirise](https://github.com/yiirise)
16+
1217
### v2.3.127
1318
updated 2019.9.20
1419

docs/guide-zh-CN/sys-gii.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
### Gii
2+
3+
目录
4+
5+
- Model
6+
- CURD
7+
8+
使用条件
9+
10+
- 开发模式
11+
- rageframe 版本号 >= 2.3.94
12+
- backend/gii
13+
14+
### Model
15+
16+
- 表字段已经备注
17+
- Code Template 选择 rageframe
18+
19+
那么你选择一个表进行生成 Model 你会发现 attributeLabels 全部替换成为字段备注,不用再重新修改
20+
21+
```
22+
<?php
23+
24+
namespace app\models;
25+
26+
use Yii;
27+
28+
/**
29+
* This is the model class for table "{{%addon_article_adv}}".
30+
*
31+
* @property int $id 序号
32+
* @property string $merchant_id 商户id
33+
* @property string $title 标题
34+
* @property string $cover 图片
35+
* @property int $location_id 广告位ID
36+
* @property string $silder_text 图片描述
37+
* @property int $start_time 开始时间
38+
* @property int $end_time 结束时间
39+
* @property string $jump_link 跳转链接
40+
* @property int $jump_type 跳转方式[1:新标签; 2:当前页]
41+
* @property int $sort 优先级
42+
* @property int $status 状态
43+
* @property string $created_at 创建时间
44+
* @property string $updated_at 更新时间
45+
*/
46+
class AddonArticleAdv extends \yii\db\ActiveRecord
47+
{
48+
/**
49+
* {@inheritdoc}
50+
*/
51+
public static function tableName()
52+
{
53+
return '{{%addon_article_adv}}';
54+
}
55+
56+
/**
57+
* {@inheritdoc}
58+
*/
59+
public function rules()
60+
{
61+
return [
62+
[['merchant_id', 'location_id', 'start_time', 'end_time', 'jump_type', 'sort', 'status', 'created_at', 'updated_at'], 'integer'],
63+
[['title'], 'string', 'max' => 30],
64+
[['cover'], 'string', 'max' => 100],
65+
[['silder_text', 'jump_link'], 'string', 'max' => 150],
66+
];
67+
}
68+
69+
/**
70+
* {@inheritdoc}
71+
*/
72+
public function attributeLabels()
73+
{
74+
return [
75+
'id' => '序号',
76+
'merchant_id' => '商户id',
77+
'title' => '标题',
78+
'cover' => '图片',
79+
'location_id' => '广告位ID',
80+
'silder_text' => '图片描述',
81+
'start_time' => '开始时间',
82+
'end_time' => '结束时间',
83+
'jump_link' => '跳转链接',
84+
'jump_type' => '跳转方式[1:新标签; 2:当前页]',
85+
'sort' => '优先级',
86+
'status' => '状态',
87+
'created_at' => '创建时间',
88+
'updated_at' => '更新时间',
89+
];
90+
}
91+
}
92+
```
93+
94+
### CURD
95+
96+
1、设置好模型路径(注意是已经创建好的Model),选择生成控制器命名空间和视图文件路径,选择模板为 rageframe 即可进行生成预览
97+
98+
![image](images/gii-curd.jpg)
99+
100+
2、 勾选你首页需要显示的字段和编辑页面需要显示的字段和控件类型即可直接生成一个定制化的 CURD
101+
102+
![image](images/gii-curd-view.jpg)
103+
104+
3、选择后点击预览,没有问题了可直接点击创建进行生成
105+
106+
![image](images/gii-curd-view-files.jpg)
107+
108+
4、访问对应的路径进行查看,这样子关于页面显示、查询、编辑就完成了,就那么简单
109+
110+

0 commit comments

Comments
 (0)