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

82 行
2.1 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "order_customer_info".
  6. *
  7. * @property integer $id
  8. * @property integer $order_main_id
  9. * @property integer $order_parent_id
  10. * @property string $cus_name
  11. * @property integer $cus_id_type
  12. * @property string $cus_id_no
  13. * @property integer $cancel_flag
  14. * @property string $create_time
  15. * @property string $update_time
  16. */
  17. class OrderCustomerInfo extends \yii\db\ActiveRecord
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. public static function tableName()
  23. {
  24. return 'order_customer_info';
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['order_main_id', 'order_parent_id', 'create_time'], 'required'],
  33. [['order_main_id', 'order_parent_id', 'cus_id_type', 'cancel_flag'], 'integer'],
  34. [['create_time', 'update_time'], 'safe'],
  35. [['cus_name', 'cus_id_no'], 'string', 'max' => 255],
  36. ];
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'order_main_id' => '乘车人子订单号',
  46. 'order_parent_id' => '主订单id',
  47. 'cus_name' => '乘客姓名',
  48. 'cus_id_type' => '证件类型,1:身份证,2:护照',
  49. 'cus_id_no' => '证件号码',
  50. 'cancel_flag' => '数据有效性标志,0:有效,1:无效',
  51. 'create_time' => 'Create Time',
  52. 'update_time' => 'Update Time',
  53. ];
  54. }
  55. /***
  56. * Des:获取出行人信息
  57. * Name: getCustomer
  58. * @param $order_id
  59. * @return array|\yii\db\ActiveRecord[]
  60. * @author 倪宗锋
  61. */
  62. public function getCustomer($order_id){
  63. $where = [
  64. 'and',
  65. ['=','order_parent_id', $order_id],
  66. ['=','cancel_flag',0]
  67. ];
  68. $result= self::find()->select(['cus_name','cus_id_no'])
  69. ->from(self::tableName())
  70. ->where($where)
  71. ->asArray()
  72. ->all();
  73. return $result;
  74. }
  75. }