|
- <?php
-
- namespace backend\modules\hotel\models;
-
- use Yii;
-
- /**
- * This is the model class for table "base_user".
- *
- * @property integer $ID
- * @property string $USER_NAME
- * @property string $USER_PASSWORD
- * @property integer $ORG_ID
- * @property integer $TOP_ORG_ID
- * @property string $OPERA_ORG_ID
- * @property string $USER_SIGN
- * @property integer $USER_TYPE
- * @property integer $USER_ROLE
- * @property string $TRUE_NAME
- * @property integer $STATUS
- * @property integer $CANCEL_FLAG
- * @property integer $CREATE_USER_ID
- * @property string $CREATE_TIME
- * @property integer $UPDATE_USER_ID
- * @property string $UPDATE_TIME
- * @property string $PHONE_no
- */
- class User extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'base_user';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['ORG_ID', 'TOP_ORG_ID', 'USER_TYPE', 'USER_ROLE', 'STATUS', 'CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID'], 'integer'],
- [['STATUS'], 'required'],
- [['USER_NAME', 'OPERA_ORG_ID', 'USER_SIGN', 'TRUE_NAME'], 'string', 'max' => 100],
- [['USER_PASSWORD'], 'string', 'max' => 200],
- [['CREATE_TIME', 'UPDATE_TIME'], 'string', 'max' => 20],
- [['PHONE_no'], 'string', 'max' => 11],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'ID' => 'ID',
- 'USER_NAME' => 'User Name',
- 'USER_PASSWORD' => 'User Password',
- 'ORG_ID' => 'Org ID',
- 'TOP_ORG_ID' => 'Top Org ID',
- 'OPERA_ORG_ID' => 'Opera Org ID',
- 'USER_SIGN' => 'User Sign',
- 'USER_TYPE' => 'User Type',
- 'USER_ROLE' => 'User Role',
- 'TRUE_NAME' => 'True Name',
- 'STATUS' => 'Status',
- 'CANCEL_FLAG' => 'Cancel Flag',
- 'CREATE_USER_ID' => 'Create User ID',
- 'CREATE_TIME' => 'Create Time',
- 'UPDATE_USER_ID' => 'Update User ID',
- 'UPDATE_TIME' => 'Update Time',
- 'PHONE_no' => 'Phone No',
- ];
- }
-
- public function getOrders()
- {
- return $this->hasMany(OrderMain::className(), ['CREATE_USER_ID' => 'ID']);
- }
-
- public static function getPrincipal($principal)
- {
- $sql = "select true_name from base_user where id in ($principal)";
- $data = Yii::$app->db->createCommand($sql)->queryAll();
- $tmp = [];
- foreach ($data as $k => $v) {
- $tmp[] = $v['true_name'];
- }
- $data = implode(',', $tmp);
- return $data;
- }
- }
|