Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

121 Zeilen
3.2 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use yii\db\ActiveRecord;
  4. /**
  5. * This is the model class for table "order_check_tickets".
  6. *
  7. * @property integer $id
  8. * @property integer $order_id
  9. * @property integer $run_id
  10. * @property integer $bus_no
  11. * @property integer $check_status
  12. * @property string $check_time
  13. * @property integer $check_station
  14. * @property integer $check_seq_id
  15. * @property integer $check_user_id
  16. */
  17. class OrderCheckTickets extends ActiveRecord
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. public static function tableName()
  23. {
  24. return 'order_check_tickets';
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['order_id', 'run_id', 'bus_no', 'check_status', 'check_station', 'check_seq_id', 'check_user_id'], 'integer'],
  33. [['bus_no', 'check_user_id'], 'required'],
  34. [['check_time'], 'string', 'max' => 20],
  35. ];
  36. }
  37. /**
  38. * @inheritdoc
  39. */
  40. public function attributeLabels()
  41. {
  42. return [
  43. 'id' => 'ID',
  44. 'order_id' => 'Order ID',
  45. 'run_id' => 'Run ID',
  46. 'bus_no' => 'Bus No',
  47. 'check_status' => 'Check Status',
  48. 'check_time' => 'Check Time',
  49. 'check_station' => 'Check Station',
  50. 'check_seq_id' => 'Check Seq ID',
  51. 'check_user_id' => 'Check User ID',
  52. ];
  53. }
  54. /**
  55. * Function Description:更改乘客上车状态
  56. * Function Name: updateCheckStatus
  57. * @param int $driver_id 司机id
  58. * @param int $run_id 班次id
  59. * @param int $order_id 订单id
  60. * @param int $bus_no 车号
  61. * @param int $check_status 检票状态
  62. *
  63. * @return bool
  64. *
  65. * @author 张帅
  66. */
  67. public function updateCheckStatus($driver_id, $run_id, $order_id, $bus_no, $check_status)
  68. {
  69. $result = self::find()->select('id')
  70. ->where([
  71. 'and',
  72. ['=', 'order_id', $order_id],
  73. ['=', 'run_id', $run_id],
  74. ['=', 'bus_no', $bus_no],
  75. ])
  76. ->asArray()->one();
  77. if (count($result) > 0) {
  78. return true;
  79. }
  80. $value = [
  81. 'order_id' => $order_id,
  82. 'run_id' => $run_id,
  83. 'bus_no' => $bus_no,
  84. 'check_status' => $check_status,
  85. 'check_time' => date('Y-m-d H:i:s', time()),
  86. 'check_station' => 0,
  87. 'check_user_id' => $driver_id,
  88. ];
  89. $this->attributes = $value;
  90. $res = $this->insert();
  91. if ($res) {
  92. return true;
  93. } else {
  94. return false;
  95. }
  96. }
  97. public function getCustomerMobile($run_id,$bus_order_id){
  98. //根据run_id查询到已经检票的乘客电话号码
  99. $customer_phone_list = OrderCheckTickets::find()
  100. ->select("om.customer_mobile,om.order_id")
  101. ->from("order_check_tickets as oct")
  102. ->innerJoin("order_main as om",'oct.run_id=om.run_id and oct.order_id=om.parent_order_id')
  103. ->where(["and",["=","om.cancel_flag","0"],["=","om.run_id",$run_id],["=","oct.bus_no",$bus_order_id]])
  104. ->groupBy("om.parent_order_id")
  105. ->asArray()->all();
  106. return $customer_phone_list;
  107. }
  108. }