|
- <?php
-
- namespace backend\modules\api\models;
-
- use yii\db\ActiveRecord;
-
- /**
- * This is the model class for table "to_from".
- *
- * @property string $ID
- * @property integer $to_orderid
- * @property integer $back_orderid
- * @property string $CREATE_TIME
- */
- class ToFrom extends ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'to_from';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['to_orderid', 'back_orderid'], 'integer'],
- [['CREATE_TIME'], 'safe'],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'ID' => 'ID',
- 'to_orderid' => '去的订单id',
- 'back_orderid' => '返程订单id',
- 'CREATE_TIME' => '记录创建时间',
- ];
- }
-
- public function getToFromOrder($order_id){
- $result = self::find()
- ->select([
- 'to_orderid',
- 'back_orderid',
- ])
- ->where([
- 'or',
- ['=','to_orderid',$order_id],
- ['=','back_orderid',$order_id],
- ])
- ->asArray()->one();
- return $result;
- }
- }
|