| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use app\models\common\Upload;
- use Yii;
- /**
- * This is the model class for table "{{%banner}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property string $pic_url
- * @property string $title
- * @property string $page_url
- * @property integer $sort
- * @property integer $created_at
- * @property integer $is_delete
- * @property integer $type
- * @property string $open_type
- * @property integer $md_id
- */
- class BusinessRightInfo extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%business_right_info}}';
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'name' => '权限名称',
- 'explanation' => '权限说明',
- ];
- }
- public static function resetRightInfo($rightIds = [], $field = '') {
- $query = self::find()->where(['is_delete' => 0])->orderBy('id ASC');
- if (!empty($rightIds)) {
- $query->andWhere(['id' => $rightIds]);
- }
- if (trim($field)) {
- $query->select($field);
- }
- $rightInfo = $query->asArray()->all();
- $resetData = [];
- foreach ($rightInfo as $index => &$item) {
- if (intval($item['id']) === 3) {
- $resetData = $item;
- unset($rightInfo[$index]);
- }
- if (intval($item['id']) === 4) {
- $item['name'] = $resetData['name'];
- $item['explanation'] = $resetData['explanation'];
- }
- }
- return array_values($rightInfo);
- }
- }
|