1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| <?php
|
| namespace app\common\model\page;
|
| use app\common\model\BaseModel;
|
| /**
| * app分类页模板模型
| */
| class PageCategory extends BaseModel
| {
| //表名
| protected $name = 'page_category';
| //主键字段名
| protected $pk = 'app_id';
|
| /**
| * 获取应用信息
| */
| public static function detail()
| {
| //全局有app_id,不用加
| $model = (new static())->find();
| // 如果没有默认值,先插入
| if(!$model){
| $model = new self();
| $model->save([
| 'app_id' => self::$app_id,
| 'category_style' => 10
| ]);
| }
| return $model;
| }
|
| }
|
|