You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

113 lines
3.0 KiB

  1. <?php
  2. /**
  3. * 数据库表类 order_hotel_extra
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm LoginController.php
  13. * Create By 2018/01/05 16:45 $
  14. */
  15. namespace common\models;
  16. use common\util\Util;
  17. use yii\db\ActiveRecord;
  18. /**
  19. * 数据库表类 order_hotel_extra.
  20. * @property integer $id
  21. * @property integer $main_order_id
  22. * @property integer $hotel_id
  23. * @property integer $room_id
  24. * @property string $hotel_name
  25. * @property string $room_name
  26. * @property string $breakfast
  27. * @property string $total_details
  28. * @property string $remarks
  29. * @property integer $is_gift
  30. * @property string $gift_describe
  31. * @property integer $is_confirm
  32. */
  33. class OrderHotelExtra extends ActiveRecord
  34. {
  35. /**
  36. * @inheritdoc
  37. */
  38. public static function tableName()
  39. {
  40. return 'order_hotel_extra';
  41. }
  42. /**
  43. * @inheritdoc
  44. */
  45. public function rules()
  46. {
  47. return [
  48. [['main_order_id', 'hotel_id', 'room_id', 'is_gift', 'is_confirm'], 'integer'],
  49. [['gift_describe'], 'required'],
  50. [['total_details','gift_describe'], 'string'],
  51. [['hotel_name', 'room_name', 'remarks', 'address'], 'string', 'max' => 255],
  52. [['breakfast'], 'string', 'max' => 20],
  53. ];
  54. }
  55. /**
  56. * @inheritdoc
  57. */
  58. public function attributeLabels()
  59. {
  60. return [
  61. 'id' => 'ID',
  62. 'main_order_id' => 'Main Order ID',
  63. 'hotel_id' => 'Hotel ID',
  64. 'room_id' => 'Room ID',
  65. 'hotel_name' => 'Hotel Name',
  66. 'room_name' => 'Room Name',
  67. 'breakfast' => 'Breakfast',
  68. 'total_details' => 'Total Details',
  69. 'remarks' => 'Remarks',
  70. 'is_gift' => 'Is Gift',
  71. 'gift_describe' => 'Gift Describe',
  72. 'is_confirm' => 'Is Confirm',
  73. 'address' => 'address'
  74. ];
  75. }
  76. /**
  77. * Des:添加记录
  78. * Name: addRow
  79. * @param $data
  80. * @return array
  81. * @author 倪宗锋
  82. */
  83. public function addRow($data)
  84. {
  85. $this->attributes = $data;
  86. $insertFlag = $this->insert();
  87. if (!$insertFlag) {
  88. return Util::returnArrEr('add hotel_extra fail!');
  89. }
  90. return Util::returnArrSu();
  91. }
  92. /**
  93. * Des:修改订单信息
  94. * Name: upOrder
  95. * @param $value
  96. * @param $orderId
  97. * @return int
  98. * @author 倪宗锋
  99. */
  100. public function upOrder($value, $orderId)
  101. {
  102. $count = self::updateAll($value, ['=', 'main_order_id', $orderId]);
  103. return $count;
  104. }
  105. }