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

64 行
1.3 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use yii\db\ActiveRecord;
  4. /**
  5. * This is the model class for table "to_from".
  6. *
  7. * @property string $ID
  8. * @property integer $to_orderid
  9. * @property integer $back_orderid
  10. * @property string $CREATE_TIME
  11. */
  12. class ToFrom extends ActiveRecord
  13. {
  14. /**
  15. * @inheritdoc
  16. */
  17. public static function tableName()
  18. {
  19. return 'to_from';
  20. }
  21. /**
  22. * @inheritdoc
  23. */
  24. public function rules()
  25. {
  26. return [
  27. [['to_orderid', 'back_orderid'], 'integer'],
  28. [['CREATE_TIME'], 'safe'],
  29. ];
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function attributeLabels()
  35. {
  36. return [
  37. 'ID' => 'ID',
  38. 'to_orderid' => '去的订单id',
  39. 'back_orderid' => '返程订单id',
  40. 'CREATE_TIME' => '记录创建时间',
  41. ];
  42. }
  43. public function getToFromOrder($order_id){
  44. $result = self::find()
  45. ->select([
  46. 'to_orderid',
  47. 'back_orderid',
  48. ])
  49. ->where([
  50. 'or',
  51. ['=','to_orderid',$order_id],
  52. ['=','back_orderid',$order_id],
  53. ])
  54. ->asArray()->one();
  55. return $result;
  56. }
  57. }