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.
 
 
 
 
 
 

76 lines
2.0 KiB

  1. <?php
  2. namespace backend\modules\hotel\models;
  3. use common\models\zModel;
  4. /**
  5. * This is the model class for table "order_ht_status_log".
  6. *
  7. * @property integer $ID
  8. * @property integer $ORDER_ID
  9. * @property integer $ORDER_STATUS
  10. * @property integer $BEFORE_STATUS
  11. * @property integer $CANCEL_FLAG
  12. * @property integer $CREATE_USER_ID
  13. * @property string $CREATE_TIME
  14. * @property integer $UPDATE_USER_ID
  15. * @property string $UPDATE_TIME
  16. */
  17. class OrderHtStatusLog extends zModel
  18. {
  19. /**
  20. * @inheritdoc
  21. */
  22. public static function tableName()
  23. {
  24. return 'order_ht_status_log';
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['ORDER_ID', 'ORDER_STATUS'], 'required'],
  33. [['ORDER_ID', 'ORDER_STATUS', 'BEFORE_STATUS', 'CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID'], 'integer'],
  34. [['CREATE_TIME', 'UPDATE_TIME'], 'string', 'max' => 20],
  35. ];
  36. }
  37. /**
  38. * @inheritdoc
  39. */
  40. public function attributeLabels()
  41. {
  42. return [
  43. 'ID' => 'ID',
  44. 'ORDER_ID' => '订单ID,ORDER_MAIN.ORDER_ID',
  45. 'ORDER_STATUS' => 'Order Status',
  46. 'BEFORE_STATUS' => 'Before Status',
  47. 'CANCEL_FLAG' => '记录有效性标记,CANCEL_FLAG=0记录有效;CANCEL_FLAG=1,记录已删除',
  48. 'CREATE_USER_ID' => '记录创建用户ID',
  49. 'CREATE_TIME' => '记录创建时间',
  50. 'UPDATE_USER_ID' => '记录最后更新用户ID',
  51. 'UPDATE_TIME' => '记录最后更新时间',
  52. ];
  53. }
  54. public function getUser()
  55. {
  56. return $this->hasOne(User::className(), ['ID' => 'CREATE_USER_ID']);
  57. }
  58. public function beforeSave($insert)
  59. {
  60. if ($this->isNewRecord) {
  61. $this->CANCEL_FLAG = 0;
  62. $this->CREATE_TIME = date('Y-m-d H:i:s', time());
  63. }else{
  64. $this->UPDATE_TIME=date('Y-m-d H:i:s', time());
  65. }
  66. return parent::beforeSave($insert);
  67. }
  68. }