|
- <?php
-
- namespace backend\modules\api\models;
-
- use Yii;
-
- /**
- * This is the model class for table "order_customer_info".
- *
- * @property integer $id
- * @property integer $order_main_id
- * @property integer $order_parent_id
- * @property string $cus_name
- * @property integer $cus_id_type
- * @property string $cus_id_no
- * @property integer $cancel_flag
- * @property string $create_time
- * @property string $update_time
- */
- class OrderCustomerInfo extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'order_customer_info';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['order_main_id', 'order_parent_id', 'create_time'], 'required'],
- [['order_main_id', 'order_parent_id', 'cus_id_type', 'cancel_flag'], 'integer'],
- [['create_time', 'update_time'], 'safe'],
- [['cus_name', 'cus_id_no'], 'string', 'max' => 255],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'order_main_id' => '乘车人子订单号',
- 'order_parent_id' => '主订单id',
- 'cus_name' => '乘客姓名',
- 'cus_id_type' => '证件类型,1:身份证,2:护照',
- 'cus_id_no' => '证件号码',
- 'cancel_flag' => '数据有效性标志,0:有效,1:无效',
- 'create_time' => 'Create Time',
- 'update_time' => 'Update Time',
- ];
- }
-
- /***
- * Des:获取出行人信息
- * Name: getCustomer
- * @param $order_id
- * @return array|\yii\db\ActiveRecord[]
- * @author 倪宗锋
- */
- public function getCustomer($order_id){
- $where = [
- 'and',
- ['=','order_parent_id', $order_id],
- ['=','cancel_flag',0]
- ];
- $result= self::find()->select(['cus_name','cus_id_no'])
- ->from(self::tableName())
- ->where($where)
- ->asArray()
- ->all();
- return $result;
- }
- }
|