您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

89 行
2.5 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "opera_tourist_ctrip".
  6. *
  7. * @property integer $id
  8. * @property integer $cancel_flag
  9. * @property integer $create_user
  10. * @property integer $update_user
  11. * @property string $create_time
  12. * @property string $update_time
  13. * @property integer $sp_tourist_id
  14. * @property integer $ctrip_prod_id
  15. * @property string $refund_limit_day
  16. * @property string $refund_limit_time
  17. */
  18. class OperaTouristCtrip extends \yii\db\ActiveRecord
  19. {
  20. /**
  21. * @inheritdoc
  22. */
  23. public static function tableName()
  24. {
  25. return 'opera_tourist_ctrip';
  26. }
  27. /**
  28. * @inheritdoc
  29. */
  30. public function rules()
  31. {
  32. return [
  33. [['cancel_flag', 'create_user', 'update_user', 'create_time', 'sp_tourist_id', 'ctrip_prod_id', 'refund_limit_day', 'refund_limit_time'], 'required'],
  34. [['cancel_flag', 'create_user', 'update_user', 'sp_tourist_id', 'ctrip_prod_id'], 'integer'],
  35. [['update_time'], 'safe'],
  36. [['create_time'], 'string', 'max' => 255],
  37. [['refund_limit_day', 'refund_limit_time'], 'string', 'max' => 20],
  38. ];
  39. }
  40. /**
  41. * @inheritdoc
  42. */
  43. public function attributeLabels()
  44. {
  45. return [
  46. 'id' => 'ID',
  47. 'cancel_flag' => 'Cancel Flag',
  48. 'create_user' => 'Create User',
  49. 'update_user' => 'Update User',
  50. 'create_time' => 'Create Time',
  51. 'update_time' => 'Update Time',
  52. 'sp_tourist_id' => 'Sp Tourist ID',
  53. 'ctrip_prod_id' => 'Ctrip Prod ID',
  54. 'refund_limit_day' => 'Refund Limit Day',
  55. 'refund_limit_time' => 'Refund Limit Time',
  56. ];
  57. }
  58. public function load($post, $formName = null)
  59. {
  60. $this->cancel_flag=isset($post['cancel_flag']) ? $post['cancel_flag'] : 0;
  61. $this->ctrip_prod_id=isset($post['ctrip_prod_id']) ? $post['ctrip_prod_id'] : 0;
  62. return parent::load($post);
  63. }
  64. /**
  65. * Function Description:查询携程对接自由行产品的产品编号
  66. * Function Name: getTouristId
  67. * @param $ctrip_prod_id
  68. *
  69. * @return array|null|\yii\db\ActiveRecord
  70. *
  71. * @author 娄梦宁
  72. */
  73. public function getTouristId($ctrip_prod_id){
  74. $sp_tourist_id=self::find()->select('sp_tourist_id')->from(self::tableName())
  75. ->where(['and',['=','cancel_flag','0'],['=','ctrip_prod_id',$ctrip_prod_id]])
  76. ->asArray()
  77. ->one();
  78. return $sp_tourist_id;
  79. }
  80. }