UserDelLog.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace common\models\user;
  3. use common\models\base\BaseActiveRecord;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_user_del_log".
  7. *
  8. * @property int $id
  9. * @property int $mall_id
  10. * @property int $user_id
  11. * @property string $new_mobile
  12. * @property string $old_mobile
  13. * @property int $status
  14. * @property int|null $created_at 添加时间戳
  15. * @property int|null $updated_at 更新时间戳
  16. */
  17. class UserDelLog extends BaseActiveRecord
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public static function tableName()
  23. {
  24. return '{{%user_del_log}}';
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['mall_id', 'user_id', 'new_mobile', 'old_mobile'], 'required'],
  33. [['mall_id', 'user_id', 'status', 'created_at', 'updated_at', 'is_recovered', 'recover_time'], 'integer'],
  34. [['new_mobile', 'old_mobile'], 'string', 'max' => 20],
  35. ];
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function attributeLabels()
  41. {
  42. return [
  43. 'id' => 'ID',
  44. 'mall_id' => 'Mall ID',
  45. 'user_id' => 'User ID',
  46. 'new_mobile' => 'New Mobile',
  47. 'old_mobile' => 'Old Mobile',
  48. 'status' => 'Status',
  49. 'created_at' => 'Created At',
  50. 'updated_at' => 'Updated At',
  51. ];
  52. }
  53. public static function setData(array $params)
  54. {
  55. try {
  56. $model = new self();
  57. $model->loadDefaultValues();
  58. if (!$model->load($params, '') || !$model->save()) throw new \Exception($model->getErrorMessage());
  59. return $model;
  60. } catch (\Exception $e) {
  61. self::$static_error = $e->getMessage();
  62. return false;
  63. }
  64. }
  65. }