Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

98 Zeilen
2.6 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use yii\db\ActiveRecord;
  4. /**
  5. * This is the model class for table "base_resource_matrix".
  6. *
  7. * @property integer $ID
  8. * @property integer $CANCEL_FLAG
  9. * @property integer $CREATE_USER_ID
  10. * @property string $CREATE_TIME
  11. * @property integer $UPDATE_USER_ID
  12. * @property string $UPDATE_TIME
  13. * @property integer $RES_ID
  14. * @property integer $POS_X
  15. * @property integer $POS_Y
  16. * @property integer $POS_TYPE
  17. * @property integer $POS_SEQ_ID
  18. * @property string $POS_NAME
  19. */
  20. class BaseResourceMatrix extends ActiveRecord
  21. {
  22. /**
  23. * @inheritdoc
  24. */
  25. public static function tableName()
  26. {
  27. return 'base_resource_matrix';
  28. }
  29. /**
  30. * @inheritdoc
  31. */
  32. public function rules()
  33. {
  34. return [
  35. [['CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID', 'RES_ID', 'POS_X', 'POS_Y', 'POS_TYPE', 'POS_SEQ_ID'], 'integer'],
  36. [['CREATE_TIME', 'UPDATE_TIME'], 'string', 'max' => 20],
  37. [['POS_NAME'], 'string', 'max' => 100],
  38. ];
  39. }
  40. /**
  41. * @inheritdoc
  42. */
  43. public function attributeLabels()
  44. {
  45. return [
  46. 'ID' => 'ID',
  47. 'CANCEL_FLAG' => '记录有效性标记,CANCEL_FLAG=0记录有效;CANCEL_FLAG=1,记录已删除',
  48. 'CREATE_USER_ID' => '记录创建用户ID',
  49. 'CREATE_TIME' => '记录创建时间',
  50. 'UPDATE_USER_ID' => '记录最后更新用户ID',
  51. 'UPDATE_TIME' => '记录最后更新时间',
  52. 'RES_ID' => '资源ID',
  53. 'POS_X' => 'X座标',
  54. 'POS_Y' => 'Y座标',
  55. 'POS_TYPE' => '座位类别,DICT_TYPE.ID',
  56. 'POS_SEQ_ID' => '座位名称,自动选位时,以此作为是否连续座位的判断依据',
  57. 'POS_NAME' => '座位名称,在客人购买的票面上,显示此值作为客人购买的座位号',
  58. ];
  59. }
  60. /**
  61. * Function Description:获取车次座位图
  62. * Function Name: getMatrixArr
  63. * @param int $bus_type_res_id 车型资源id
  64. *
  65. * @return array|bool|ActiveRecord[]
  66. *
  67. * @author 张帅
  68. */
  69. public function getMatrixArr($bus_type_res_id)
  70. {
  71. $result = self::find()
  72. ->select([
  73. 'pos_x',
  74. 'pos_y',
  75. 'pos_type',
  76. 'pos_seq_id',
  77. 'pos_name',
  78. ])
  79. ->where([
  80. 'and',
  81. ['=', 'res_id', $bus_type_res_id],
  82. ['=', 'cancel_flag', 0],
  83. ])
  84. ->asArray()->all();
  85. if(count($result) == 0){
  86. return false;
  87. }
  88. return $result;
  89. }
  90. }