|
- <?php
-
- namespace backend\modules\hotel\models;
-
- use Yii;
-
- /**
- * This is the model class for table "order_pay_detail".
- *
- * @property integer $ID
- * @property integer $CANCEL_FLAG
- * @property integer $CREATE_USER_ID
- * @property string $CREATE_TIME
- * @property integer $UPDATE_USER_ID
- * @property string $UPDATE_TIME
- * @property integer $PAY_MAIN_ID
- * @property integer $PAY_TYPE_ID_1
- * @property integer $PAY_TYPE_ID_2
- * @property string $PAY_MONEY
- * @property integer $PAY_MEMBER_ID
- * @property integer $PAY_MEMBER_SCORE
- * @property string $PAY_SERIAL_NUMBER
- */
- class OrderPayDetail extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'order_pay_detail';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['ID'], 'required'],
- [['ID', 'CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID', 'PAY_MAIN_ID', 'PAY_TYPE_ID_1', 'PAY_TYPE_ID_2', 'PAY_MEMBER_ID', 'PAY_MEMBER_SCORE'], 'integer'],
- [['PAY_MONEY'], 'number'],
- [['CREATE_TIME', 'UPDATE_TIME'], 'string', 'max' => 20],
- [['PAY_SERIAL_NUMBER'], 'string', 'max' => 50],
- [['PAY_MAIN_ID'], 'unique'],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'ID' => 'ID',
- 'CANCEL_FLAG' => '记录有效性标记,CANCEL_FLAG=0记录有效;CANCEL_FLAG=1,记录已删除',
- 'CREATE_USER_ID' => '记录创建用户ID',
- 'CREATE_TIME' => '记录创建时间',
- 'UPDATE_USER_ID' => '记录最后更新用户ID',
- 'UPDATE_TIME' => '记录最后更新时间',
- 'PAY_MAIN_ID' => '支付主ID,ORDER_PAY_MAIN.ID',
- 'PAY_TYPE_ID_1' => '主支付方式ID,DICT_TYPE.ID,如:现金支付、刷卡支付、支付宝、微信等',
- 'PAY_TYPE_ID_2' => '副支付方式ID,DICT_TYPE.ID,如主支付方式为刷卡支付后,副支付方式为磁卡、芯片卡等等',
- 'PAY_MONEY' => '支付金额',
- 'PAY_MEMBER_ID' => '支付相关会员卡ID,保留字段',
- 'PAY_MEMBER_SCORE' => '支付相关会员积分,保留字段',
- 'PAY_SERIAL_NUMBER' => '流水号',
- ];
- }
-
- public function beforeSave($insert)
- {
- if ($this->isNewRecord) {
- $this->CREATE_TIME = date('Y-m-d H:i:s', time());
- $this->UPDATE_TIME = date('Y-m-d H:i:s', time());
- $this->CANCEL_FLAG = 0;
- } else {
- $this->UPDATE_TIME = date('Y-m-d H:i:s', time());
- }
- return parent::beforeSave($insert);
- }
- }
|