|
- <?php
-
- namespace backend\modules\api\models;
-
- use Yii;
-
- /**
- * This is the model class for table "opera_tourist_ctrip".
- *
- * @property integer $id
- * @property integer $cancel_flag
- * @property integer $create_user
- * @property integer $update_user
- * @property string $create_time
- * @property string $update_time
- * @property integer $sp_tourist_id
- * @property integer $ctrip_prod_id
- * @property string $refund_limit_day
- * @property string $refund_limit_time
- */
- class OperaTouristCtrip extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'opera_tourist_ctrip';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['cancel_flag', 'create_user', 'update_user', 'create_time', 'sp_tourist_id', 'ctrip_prod_id', 'refund_limit_day', 'refund_limit_time'], 'required'],
- [['cancel_flag', 'create_user', 'update_user', 'sp_tourist_id', 'ctrip_prod_id'], 'integer'],
- [['update_time'], 'safe'],
- [['create_time'], 'string', 'max' => 255],
- [['refund_limit_day', 'refund_limit_time'], 'string', 'max' => 20],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'cancel_flag' => 'Cancel Flag',
- 'create_user' => 'Create User',
- 'update_user' => 'Update User',
- 'create_time' => 'Create Time',
- 'update_time' => 'Update Time',
- 'sp_tourist_id' => 'Sp Tourist ID',
- 'ctrip_prod_id' => 'Ctrip Prod ID',
- 'refund_limit_day' => 'Refund Limit Day',
- 'refund_limit_time' => 'Refund Limit Time',
- ];
- }
-
- public function load($post, $formName = null)
- {
- $this->cancel_flag=isset($post['cancel_flag']) ? $post['cancel_flag'] : 0;
- $this->ctrip_prod_id=isset($post['ctrip_prod_id']) ? $post['ctrip_prod_id'] : 0;
- return parent::load($post);
- }
-
- /**
- * Function Description:查询携程对接自由行产品的产品编号
- * Function Name: getTouristId
- * @param $ctrip_prod_id
- *
- * @return array|null|\yii\db\ActiveRecord
- *
- * @author 娄梦宁
- */
- public function getTouristId($ctrip_prod_id){
- $sp_tourist_id=self::find()->select('sp_tourist_id')->from(self::tableName())
- ->where(['and',['=','cancel_flag','0'],['=','ctrip_prod_id',$ctrip_prod_id]])
- ->asArray()
- ->one();
- return $sp_tourist_id;
- }
-
- }
|