3a892ee0
xu
app-wx(v0.1.0 bui...
|
1
2
3
4
5
6
7
8
|
<?php
namespace domain\user;
use Yii;
use domain\user\models\User as UserModel;
/**
|
afd2f743
xu
app-ht(v0.0.1 bui...
|
9
|
* 维修厂
|
3a892ee0
xu
app-wx(v0.1.0 bui...
|
10
11
12
|
*/
class User
{
|
afd2f743
xu
app-ht(v0.0.1 bui...
|
13
14
15
16
17
|
const STATUS_APPROVE = 1; //审核通过
const STATUS_REVIEWING = 2; //审核中
const STATUS_REJECT = 3; //审核拒绝
|
3a892ee0
xu
app-wx(v0.1.0 bui...
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/**
* @param $data
* @return null|object
* @throws \yii\base\InvalidConfigException
*/
static function create($data)
{
if (empty($data)) {
return null;
}
$classData = [
'class' => UserModel::className()
];
foreach($data as $k => $v) {
$classData[$k] = $v;
}
$userModel = Yii::createObject($classData);
if($userModel->save()) {
return $userModel;
} else {
return null;
}
}
|
afd2f743
xu
app-ht(v0.0.1 bui...
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/**
* @param string $index
* @return array|string
*/
static function getStatusLabels($index = '')
{
$arr = [
self::STATUS_APPROVE => '审核通过',
self::STATUS_REVIEWING => '审核中',
];
if ('' === $index) {
return $arr;
}
if (isset($arr[$index])) {
return $arr[$index];
} else {
return '';
}
}
|
3a892ee0
xu
app-wx(v0.1.0 bui...
|
62
|
}
|