Files
xk-api-yii/service/models/forms/AgreementForm.php
2026-06-05 15:31:43 +08:00

43 lines
878 B
PHP

<?php
namespace service\models\forms;
use common\core\BaseModel;
use common\models\oldDb\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' => 2,
'status' => 0,
// 'store_id'=>\Yii::$app->store
])->andWhere(['type'=>[1,2]])
->select(['content', 'change_at'])
->orderBy(['change_at' => SORT_DESC])
->all();
}
}