1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace graychen\yii2\jd\deposit\models; |
4
|
|
|
|
5
|
|
|
use Yii; |
6
|
|
|
use yii\base\Model; |
7
|
|
|
use yii\data\ActiveDataProvider; |
8
|
|
|
use graychen\yii2\jd\deposit\models\Order; |
9
|
|
|
use graychen\yii2\jd\deposit\models\OrderDeposit; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* SearchOrder represents the model behind the search form about `common\models\Order`. |
13
|
|
|
*/ |
14
|
|
|
class SearchDeposit extends Order |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @inheritdoc |
18
|
|
|
*/ |
19
|
|
|
public function rules() |
20
|
|
|
{ |
21
|
|
|
return [ |
22
|
|
|
[['id', 'game_id', 'type', 'beauty', 'user_id', 'current_tiers', 'current_divisions', 'target_tiers', 'target_divisions', 'mingwen', 'hours', 'equipment', 'status', 'created_at', 'updated_at', 'payment_method'], 'integer'], |
23
|
|
|
[['sn', 'start_time', 'end_time', 'serverinfo', 'account', 'password', 'remark', 'client_id', 'name', 'description'], 'safe'], |
24
|
|
|
[['count', 'final_price'], 'number'], |
25
|
|
|
]; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @inheritdoc |
30
|
|
|
*/ |
31
|
|
|
public function scenarios() |
32
|
|
|
{ |
33
|
|
|
// bypass scenarios() implementation in the parent class |
34
|
|
|
return Model::scenarios(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Creates data provider instance with search query applied |
39
|
|
|
* |
40
|
|
|
* @param array $params |
41
|
|
|
* |
42
|
|
|
* @return ActiveDataProvider |
43
|
|
|
*/ |
44
|
|
|
public function search($params) |
45
|
|
|
{ |
46
|
|
|
$query = Order::find()->orderBy('id desc')->andFilterWhere(['like', 'sn', OrderDeposit::SOURCE_JD]); |
47
|
|
|
|
48
|
|
|
// add conditions that should always apply here |
49
|
|
|
$dataProvider = new ActiveDataProvider([ |
50
|
|
|
'query' => $query, |
51
|
|
|
]); |
52
|
|
|
|
53
|
|
|
$this->load($params); |
54
|
|
|
|
55
|
|
|
if (!$this->validate()) { |
56
|
|
|
// uncomment the following line if you do not want to return any records when validation fails |
57
|
|
|
return $dataProvider; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
// grid filtering conditions |
61
|
|
|
$query->andFilterWhere([ |
62
|
|
|
'id' => $this->id, |
|
|
|
|
63
|
|
|
'game_id' => $this->game_id, |
|
|
|
|
64
|
|
|
'type' => $this->type, |
|
|
|
|
65
|
|
|
'beauty' => $this->beauty, |
|
|
|
|
66
|
|
|
'user_id' => $this->user_id, |
|
|
|
|
67
|
|
|
'current_tiers' => $this->current_tiers, |
|
|
|
|
68
|
|
|
'current_divisions' => $this->current_divisions, |
|
|
|
|
69
|
|
|
'target_tiers' => $this->target_tiers, |
|
|
|
|
70
|
|
|
'target_divisions' => $this->target_divisions, |
|
|
|
|
71
|
|
|
'mingwen' => $this->mingwen, |
|
|
|
|
72
|
|
|
'count' => $this->count, |
|
|
|
|
73
|
|
|
'hours' => $this->hours, |
|
|
|
|
74
|
|
|
'final_price' => $this->final_price, |
|
|
|
|
75
|
|
|
'equipment' => $this->equipment, |
|
|
|
|
76
|
|
|
'status' => $this->status, |
|
|
|
|
77
|
|
|
'created_at' => $this->created_at, |
|
|
|
|
78
|
|
|
'updated_at' => $this->updated_at, |
|
|
|
|
79
|
|
|
'payment_method' => $this->payment_method, |
|
|
|
|
80
|
|
|
]); |
81
|
|
|
|
82
|
|
|
$query->andFilterWhere(['like', 'sn', $this->sn]) |
|
|
|
|
83
|
|
|
->andFilterWhere(['like', 'start_time', $this->start_time]) |
|
|
|
|
84
|
|
|
->andFilterWhere(['like', 'end_time', $this->end_time]) |
|
|
|
|
85
|
|
|
->andFilterWhere(['like', 'serverinfo', $this->serverinfo]) |
|
|
|
|
86
|
|
|
->andFilterWhere(['like', 'account', $this->account]) |
|
|
|
|
87
|
|
|
->andFilterWhere(['like', 'password', $this->password]) |
|
|
|
|
88
|
|
|
->andFilterWhere(['like', 'remark', $this->remark]) |
|
|
|
|
89
|
|
|
->andFilterWhere(['like', 'client_id', $this->client_id]) |
|
|
|
|
90
|
|
|
->andFilterWhere(['like', 'name', $this->name]) |
|
|
|
|
91
|
|
|
->andFilterWhere(['like', 'description', $this->description]); |
|
|
|
|
92
|
|
|
|
93
|
|
|
return $dataProvider; |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.