AchievementGrantConfirmLog.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace addons\Achievement\common\models;
  3. use common\models\base\BaseActiveRecord;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_achievement_grant_log".
  7. *
  8. * @property int $id
  9. * @property int $mall_id 商城id
  10. * @property int $grant_id 规则id
  11. * @property int $admin_id 管理员id
  12. * @property int $created_at
  13. * @property int $updated_at
  14. * @property int $status 状态[-1:删除;0:禁用;1启用]
  15. */
  16. class AchievementGrantConfirmLog extends BaseActiveRecord
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public static function tableName()
  22. {
  23. return 'qimall_addons_achievement_grant_confirm_log';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function rules()
  29. {
  30. return [
  31. [['mall_id', 'grant_id', 'admin_id', 'created_at', 'updated_at', 'status'], 'integer'],
  32. [['grant_id'], 'required'],
  33. ];
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function attributeLabels()
  39. {
  40. return [
  41. 'id' => 'ID',
  42. 'mall_id' => '商城id',
  43. 'grant_id' => '规则id',
  44. 'admin_id' => '管理员id',
  45. 'created_at' => 'Created At',
  46. 'updated_at' => 'Updated At',
  47. 'status' => '状态[-1:删除;0:禁用;1启用]',
  48. ];
  49. }
  50. public static function setData(array $params) {
  51. try {
  52. $model = new self();
  53. $model->loadDefaultValues();
  54. if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage());
  55. if (!$model->save()) throw new \Exception($model->getErrorMessage());
  56. return $model;
  57. } catch (\Exception $e) {
  58. self::$static_error = $e->getMessage();
  59. return false;
  60. }
  61. }
  62. }