Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

126 lignes
3.5 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "outside_submit_order".
  6. *
  7. * @property integer $id
  8. * @property integer $from_org_id
  9. * @property string $outside_order_no
  10. * @property string $prod_id
  11. * @property integer $ticket_num
  12. * @property string $per_price
  13. * @property string $all_price
  14. * @property string $customer_name
  15. * @property string $customer_mobile
  16. * @property string $customer_id_no
  17. * @property integer $submit_status
  18. * @property string $opera_time
  19. * @property string $passenger
  20. * @property string $supply_order_id
  21. */
  22. class OutsideSubmitOrder extends \yii\db\ActiveRecord
  23. {
  24. /**
  25. * @inheritdoc
  26. */
  27. public static function tableName()
  28. {
  29. return 'outside_submit_order';
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['from_org_id', 'ticket_num', 'submit_status'], 'integer'],
  38. [['per_price', 'all_price'], 'number'],
  39. [['passenger'], 'string'],
  40. [['outside_order_no', 'customer_name'], 'string', 'max' => 50],
  41. [['prod_id'], 'string', 'max' => 100],
  42. [['customer_mobile', 'customer_id_no', 'opera_time'], 'string', 'max' => 20],
  43. [['supply_order_id'], 'string', 'max' => 500],
  44. ];
  45. }
  46. /**
  47. * @inheritdoc
  48. */
  49. public function attributeLabels()
  50. {
  51. return [
  52. 'id' => 'ID',
  53. 'from_org_id' => 'From Org ID',
  54. 'outside_order_no' => 'Outside Order No',
  55. 'prod_id' => 'Prod ID',
  56. 'ticket_num' => 'Ticket Num',
  57. 'per_price' => 'Per Price',
  58. 'all_price' => 'All Price',
  59. 'customer_name' => 'Customer Name',
  60. 'customer_mobile' => 'Customer Mobile',
  61. 'customer_id_no' => 'Customer Id No',
  62. 'submit_status' => 'Submit Status',
  63. 'opera_time' => 'Opera Time',
  64. 'passenger' => 'Passenger',
  65. 'supply_order_id' => 'Supply Order ID',
  66. ];
  67. }
  68. /**
  69. * Des:添加记录
  70. * Name: addRow
  71. * @param $params
  72. * @return bool
  73. * @author 倪宗锋
  74. */
  75. public function addRow($params)
  76. {
  77. $values = [
  78. 'from_org_id' => $params['from_org_id'],
  79. 'outside_order_no' => $params['outside_order_no'],
  80. 'prod_id' => $params['ticket_id'],
  81. 'ticket_num' => $params['ticket_num'],
  82. 'per_price' => $params['price'],
  83. 'all_price' => $params['all_price'],
  84. 'customer_name' => $params['customer_name'],
  85. 'customer_mobile' => $params['customer_mobile'],
  86. 'customer_id_no' => $params['customer_id_no'],
  87. 'submit_status' => 0,
  88. 'opera_time' => date('Y-m-d H:i:s'),
  89. 'passenger' => $params['passenger'],
  90. 'supply_order_id' => '0'
  91. ];
  92. $this->attributes = $values;
  93. $res = $this->insert();
  94. $error = $this->getErrors();
  95. if ($res == false) {
  96. return 0;
  97. }
  98. return $this->id;
  99. }
  100. /**
  101. * Des:修改基本信息
  102. * Name: editInfo
  103. * @param $params
  104. * @return bool
  105. * @author 倪宗锋
  106. */
  107. public function editInfo($params)
  108. {
  109. $values = [
  110. 'submit_status' => $params['status'],
  111. ];
  112. $flag = self::updateAll($values, 'ID=:ID', array(':ID' => $params['ID']));
  113. if ($flag == false) {
  114. return false;
  115. }
  116. return true;
  117. }
  118. }