|
- <?php
-
- namespace backend\modules\api\models;
-
- use yii\db\ActiveRecord;
-
- /**
- * This is the model class for table "base_resource_matrix".
- *
- * @property integer $ID
- * @property integer $CANCEL_FLAG
- * @property integer $CREATE_USER_ID
- * @property string $CREATE_TIME
- * @property integer $UPDATE_USER_ID
- * @property string $UPDATE_TIME
- * @property integer $RES_ID
- * @property integer $POS_X
- * @property integer $POS_Y
- * @property integer $POS_TYPE
- * @property integer $POS_SEQ_ID
- * @property string $POS_NAME
- */
- class BaseResourceMatrix extends ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'base_resource_matrix';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID', 'RES_ID', 'POS_X', 'POS_Y', 'POS_TYPE', 'POS_SEQ_ID'], 'integer'],
- [['CREATE_TIME', 'UPDATE_TIME'], 'string', 'max' => 20],
- [['POS_NAME'], 'string', 'max' => 100],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'ID' => 'ID',
- 'CANCEL_FLAG' => '记录有效性标记,CANCEL_FLAG=0记录有效;CANCEL_FLAG=1,记录已删除',
- 'CREATE_USER_ID' => '记录创建用户ID',
- 'CREATE_TIME' => '记录创建时间',
- 'UPDATE_USER_ID' => '记录最后更新用户ID',
- 'UPDATE_TIME' => '记录最后更新时间',
- 'RES_ID' => '资源ID',
- 'POS_X' => 'X座标',
- 'POS_Y' => 'Y座标',
- 'POS_TYPE' => '座位类别,DICT_TYPE.ID',
- 'POS_SEQ_ID' => '座位名称,自动选位时,以此作为是否连续座位的判断依据',
- 'POS_NAME' => '座位名称,在客人购买的票面上,显示此值作为客人购买的座位号',
- ];
- }
-
- /**
- * Function Description:获取车次座位图
- * Function Name: getMatrixArr
- * @param int $bus_type_res_id 车型资源id
- *
- * @return array|bool|ActiveRecord[]
- *
- * @author 张帅
- */
- public function getMatrixArr($bus_type_res_id)
- {
- $result = self::find()
- ->select([
- 'pos_x',
- 'pos_y',
- 'pos_type',
- 'pos_seq_id',
- 'pos_name',
- ])
- ->where([
- 'and',
- ['=', 'res_id', $bus_type_res_id],
- ['=', 'cancel_flag', 0],
- ])
- ->asArray()->all();
-
- if(count($result) == 0){
- return false;
- }
- return $result;
- }
- }
|