初始化仓库
This commit is contained in:
43
service/models/forms/AgreementForm.php
Normal file
43
service/models/forms/AgreementForm.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace service\models\forms;
|
||||
|
||||
use common\core\BaseModel;
|
||||
use common\models\BaseConfig;
|
||||
use yii\db\Exception;
|
||||
|
||||
// 协议
|
||||
class AgreementForm extends BaseModel
|
||||
{
|
||||
public $end;
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
['end', 'required'],
|
||||
];
|
||||
}
|
||||
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'end' => '区分端',
|
||||
];
|
||||
}
|
||||
|
||||
public function getAgreement()
|
||||
{
|
||||
if (!$this->validate()){
|
||||
throw new Exception($this->getErrorMsg());
|
||||
}
|
||||
return BaseConfig::find()
|
||||
->where([
|
||||
'end' => $this->end,
|
||||
'status' => 0,
|
||||
'store_id'=>\Yii::$app->store
|
||||
])->andWhere(['type'=>[1,2]])
|
||||
->select(['content', 'change_at'])
|
||||
->orderBy(['change_at' => SORT_DESC])
|
||||
->all();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user