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.
 
 
 
 
 
 

83 regels
2.6 KiB

  1. <?php
  2. namespace backend\modules\hotel\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "order_pay_detail".
  6. *
  7. * @property integer $ID
  8. * @property integer $CANCEL_FLAG
  9. * @property integer $CREATE_USER_ID
  10. * @property string $CREATE_TIME
  11. * @property integer $UPDATE_USER_ID
  12. * @property string $UPDATE_TIME
  13. * @property integer $PAY_MAIN_ID
  14. * @property integer $PAY_TYPE_ID_1
  15. * @property integer $PAY_TYPE_ID_2
  16. * @property string $PAY_MONEY
  17. * @property integer $PAY_MEMBER_ID
  18. * @property integer $PAY_MEMBER_SCORE
  19. * @property string $PAY_SERIAL_NUMBER
  20. */
  21. class OrderPayDetail extends \yii\db\ActiveRecord
  22. {
  23. /**
  24. * @inheritdoc
  25. */
  26. public static function tableName()
  27. {
  28. return 'order_pay_detail';
  29. }
  30. /**
  31. * @inheritdoc
  32. */
  33. public function rules()
  34. {
  35. return [
  36. [['ID'], 'required'],
  37. [['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'],
  38. [['PAY_MONEY'], 'number'],
  39. [['CREATE_TIME', 'UPDATE_TIME'], 'string', 'max' => 20],
  40. [['PAY_SERIAL_NUMBER'], 'string', 'max' => 50],
  41. [['PAY_MAIN_ID'], 'unique'],
  42. ];
  43. }
  44. /**
  45. * @inheritdoc
  46. */
  47. public function attributeLabels()
  48. {
  49. return [
  50. 'ID' => 'ID',
  51. 'CANCEL_FLAG' => '记录有效性标记,CANCEL_FLAG=0记录有效;CANCEL_FLAG=1,记录已删除',
  52. 'CREATE_USER_ID' => '记录创建用户ID',
  53. 'CREATE_TIME' => '记录创建时间',
  54. 'UPDATE_USER_ID' => '记录最后更新用户ID',
  55. 'UPDATE_TIME' => '记录最后更新时间',
  56. 'PAY_MAIN_ID' => '支付主ID,ORDER_PAY_MAIN.ID',
  57. 'PAY_TYPE_ID_1' => '主支付方式ID,DICT_TYPE.ID,如:现金支付、刷卡支付、支付宝、微信等',
  58. 'PAY_TYPE_ID_2' => '副支付方式ID,DICT_TYPE.ID,如主支付方式为刷卡支付后,副支付方式为磁卡、芯片卡等等',
  59. 'PAY_MONEY' => '支付金额',
  60. 'PAY_MEMBER_ID' => '支付相关会员卡ID,保留字段',
  61. 'PAY_MEMBER_SCORE' => '支付相关会员积分,保留字段',
  62. 'PAY_SERIAL_NUMBER' => '流水号',
  63. ];
  64. }
  65. public function beforeSave($insert)
  66. {
  67. if ($this->isNewRecord) {
  68. $this->CREATE_TIME = date('Y-m-d H:i:s', time());
  69. $this->UPDATE_TIME = date('Y-m-d H:i:s', time());
  70. $this->CANCEL_FLAG = 0;
  71. } else {
  72. $this->UPDATE_TIME = date('Y-m-d H:i:s', time());
  73. }
  74. return parent::beforeSave($insert);
  75. }
  76. }