|
- <?php
-
- namespace backend\modules\api\models;
-
- use Yii;
-
- /**
- * This is the model class for table "outside_submit_order".
- *
- * @property integer $id
- * @property integer $from_org_id
- * @property string $outside_order_no
- * @property string $prod_id
- * @property integer $ticket_num
- * @property string $per_price
- * @property string $all_price
- * @property string $customer_name
- * @property string $customer_mobile
- * @property string $customer_id_no
- * @property integer $submit_status
- * @property string $opera_time
- * @property string $passenger
- * @property string $supply_order_id
- */
- class OutsideSubmitOrder extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'outside_submit_order';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['from_org_id', 'ticket_num', 'submit_status'], 'integer'],
- [['per_price', 'all_price'], 'number'],
- [['passenger'], 'string'],
- [['outside_order_no', 'customer_name'], 'string', 'max' => 50],
- [['prod_id'], 'string', 'max' => 100],
- [['customer_mobile', 'customer_id_no', 'opera_time'], 'string', 'max' => 20],
- [['supply_order_id'], 'string', 'max' => 500],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'from_org_id' => 'From Org ID',
- 'outside_order_no' => 'Outside Order No',
- 'prod_id' => 'Prod ID',
- 'ticket_num' => 'Ticket Num',
- 'per_price' => 'Per Price',
- 'all_price' => 'All Price',
- 'customer_name' => 'Customer Name',
- 'customer_mobile' => 'Customer Mobile',
- 'customer_id_no' => 'Customer Id No',
- 'submit_status' => 'Submit Status',
- 'opera_time' => 'Opera Time',
- 'passenger' => 'Passenger',
- 'supply_order_id' => 'Supply Order ID',
- ];
- }
-
- /**
- * Des:添加记录
- * Name: addRow
- * @param $params
- * @return bool
- * @author 倪宗锋
- */
- public function addRow($params)
- {
- $values = [
- 'from_org_id' => $params['from_org_id'],
- 'outside_order_no' => $params['outside_order_no'],
- 'prod_id' => $params['ticket_id'],
- 'ticket_num' => $params['ticket_num'],
- 'per_price' => $params['price'],
- 'all_price' => $params['all_price'],
- 'customer_name' => $params['customer_name'],
- 'customer_mobile' => $params['customer_mobile'],
- 'customer_id_no' => $params['customer_id_no'],
- 'submit_status' => 0,
- 'opera_time' => date('Y-m-d H:i:s'),
- 'passenger' => $params['passenger'],
- 'supply_order_id' => '0'
- ];
- $this->attributes = $values;
- $res = $this->insert();
- $error = $this->getErrors();
- if ($res == false) {
- return 0;
- }
- return $this->id;
- }
-
- /**
- * Des:修改基本信息
- * Name: editInfo
- * @param $params
- * @return bool
- * @author 倪宗锋
- */
- public function editInfo($params)
- {
- $values = [
- 'submit_status' => $params['status'],
- ];
- $flag = self::updateAll($values, 'ID=:ID', array(':ID' => $params['ID']));
- if ($flag == false) {
- return false;
- }
- return true;
- }
- }
|