123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace common\models;
- use Yii;
- /**
- * This is the model class for table "banner".
- *
- * @property int $id
- * @property int $status 状态
- * @property string $title 记录描述
- * @property string $primaryKey 关键值
- * @property int $admin_id 操作用户ID
- * @property string $admin_name 操作用户名
- * @property int $addtime 记录时间
- * @property string $admin_ip 操作用户IP
- * @property string $admin_agent 操作用户浏览器代理商
- * @property string $model 操作模块(例:文章)
- * @property string $type 操作类型(例:添加)
- * @property int $handle_id 操作对象ID
- * @property string $result 操作结果
- * @property string $describe 备注
- */
- class Banner extends \yii\db\ActiveRecord
- {
- const STATUS_DISPLAY = 0;
- static $mp_status = [
- self::STATUS_DISPLAY => '点击进入未展示',
- ];
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'banner';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['status', 'title', 'primaryKey', 'admin_id', 'admin_name', 'addtime', 'admin_ip', 'admin_agent', 'model', 'type', 'handle_id', 'result', 'describe'], 'required'],
- [['status', 'admin_id', 'addtime', 'handle_id'], 'integer'],
- [['result', 'describe'], 'string'],
- [['title', 'primaryKey', 'admin_name', 'admin_ip', 'admin_agent', 'model', 'type'], 'string', 'max' => 200],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'status' => 'Status',
- 'title' => 'Title',
- 'primaryKey' => 'Primary Key',
- 'admin_id' => 'Admin ID',
- 'admin_name' => 'Admin Name',
- 'addtime' => 'Addtime',
- 'admin_ip' => 'Admin Ip',
- 'admin_agent' => 'Admin Agent',
- 'model' => 'Model',
- 'type' => 'Type',
- 'handle_id' => 'Handle ID',
- 'result' => 'Result',
- 'describe' => 'Describe',
- ];
- }
- public function searchById($id){
- if (($model = Banner::findOne($id)) !== null) {
- return json_encode($model->toArray());
- } else {
- throw new \yii\web\NotFoundHttpException('The requested page does not exist.');
- }
- }
- }
|