Skip to content

Commit cdea452

Browse files
authored
Merge pull request #18 from windhoney/develop
user表多余字段删除,添加realname字段
2 parents a67fcd4 + 1bff1af commit cdea452

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ yii migrate --migrationPath=@vendor/windhoney/yii2-rest-rbac/migrations
6767
```php
6868
yii migrate --migrationPath=@yii/rbac/migrations/
6969
```
70-
>> `auth_item` 表添加一个字段 `parent_name` varchar(30) COLLATE utf8_unicode_ci DEFAULT '' COMMENT '父级名称',
71-
> ###### 3. oauth2相关表
70+
71+
> **_**`auth_item` 表添加一个字段 `parent_name` varchar(30) COLLATE utf8_unicode_ci DEFAULT '' COMMENT '父级名称'**_**,
72+
###### 3. oauth2相关表
73+
7274
```php
7375
yii migrate --migrationPath=@vendor/filsh/yii2-oauth2-server/migrations
7476
```

migrations/m160312_050000_create_user.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public function up()
2121
$this->createTable($userTable, [
2222
'id' => $this->primaryKey(),
2323
'username' => $this->string(32)->notNull(),
24+
'realname' => $this->string(100)->notNull(),
2425
'auth_key' => $this->string(32)->notNull(),
2526
'password_hash' => $this->string()->notNull(),
2627
'password_reset_token' => $this->string(),

models/searchs/User.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,13 @@ public function search($params)
5555
"role",
5656
"status",
5757
"created_at",
58-
// "updated_at",
59-
"store_id",
60-
// "dingId"
6158
]);
6259
$query->andFilterWhere(['like', 'username', $this->username])
6360
->andFilterWhere(['like', 'auth_key', $this->auth_key])
6461
->andFilterWhere(['like', 'password_hash', $this->password_hash])
6562
->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token])
6663
->andFilterWhere(['like', 'email', $this->email]);
67-
$query->andWhere(['status' => 10]);
64+
$query->andWhere(['status' => parent::STATUS_ACTIVE]);
6865
$query->orderBy(['id' => 'asc']);
6966
$result = $query->asArray()->all();
7067
foreach ($result as $key => $value) {
@@ -82,7 +79,7 @@ public function allUsers($select = '*')
8279
{
8380
$query = UserModel::find();
8481
$query->select($select);
85-
$query->andWhere(['status' => 10]);
82+
$query->andWhere(['status' => parent::STATUS_ACTIVE]);
8683
$result = $query->asArray()->all();
8784

8885
return $result;

0 commit comments

Comments
 (0)