|
- <?php
- /**
- * 数据库表类 order_hotel_extra
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 倪宗锋
- * PhpStorm LoginController.php
- * Create By 2018/01/05 16:45 $
- */
-
- namespace common\models;
-
- use common\util\Util;
- use yii\db\ActiveRecord;
-
- /**
- * 数据库表类 order_hotel_extra.
- * @property integer $id
- * @property integer $main_order_id
- * @property integer $hotel_id
- * @property integer $room_id
- * @property string $hotel_name
- * @property string $room_name
- * @property string $breakfast
- * @property string $total_details
- * @property string $remarks
- * @property integer $is_gift
- * @property string $gift_describe
- * @property integer $is_confirm
- */
- class OrderHotelExtra extends ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'order_hotel_extra';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['main_order_id', 'hotel_id', 'room_id', 'is_gift', 'is_confirm'], 'integer'],
- [['gift_describe'], 'required'],
- [['total_details','gift_describe'], 'string'],
- [['hotel_name', 'room_name', 'remarks', 'address'], 'string', 'max' => 255],
- [['breakfast'], 'string', 'max' => 20],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'main_order_id' => 'Main Order ID',
- 'hotel_id' => 'Hotel ID',
- 'room_id' => 'Room ID',
- 'hotel_name' => 'Hotel Name',
- 'room_name' => 'Room Name',
- 'breakfast' => 'Breakfast',
- 'total_details' => 'Total Details',
- 'remarks' => 'Remarks',
- 'is_gift' => 'Is Gift',
- 'gift_describe' => 'Gift Describe',
- 'is_confirm' => 'Is Confirm',
- 'address' => 'address'
- ];
- }
-
- /**
- * Des:添加记录
- * Name: addRow
- * @param $data
- * @return array
- * @author 倪宗锋
- */
- public function addRow($data)
- {
- $this->attributes = $data;
- $insertFlag = $this->insert();
- if (!$insertFlag) {
- return Util::returnArrEr('add hotel_extra fail!');
- }
- return Util::returnArrSu();
- }
-
- /**
- * Des:修改订单信息
- * Name: upOrder
- * @param $value
- * @param $orderId
- * @return int
- * @author 倪宗锋
- */
- public function upOrder($value, $orderId)
- {
- $count = self::updateAll($value, ['=', 'main_order_id', $orderId]);
- return $count;
- }
- }
|