SettingModel.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace addons\QiJuhe\common\models;
  3. use Yii;
  4. use yii\db\ActiveRecord;
  5. use yii\helpers\Json;
  6. /**
  7. * This is the model class for table "{{%addons_juhe_shop_setting}}".
  8. *
  9. * @property int $id
  10. * @property int $mall_id
  11. * @property string|null $setting
  12. * @property int|null $created_at
  13. * @property string $token
  14. * @property int|null $expire_time
  15. * @property int|null $updated_at
  16. * @property int|null $is_delete
  17. * @property int|null $deleted_at
  18. */
  19. class SettingModel extends ActiveRecord
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public static function tableName()
  25. {
  26. return '{{%addons_qijuhe_setting}}';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function rules()
  32. {
  33. return [
  34. [['mall_id'], 'required'],
  35. [['mall_id', 'created_at', 'updated_at', 'is_delete', 'deleted_at'], 'integer'],
  36. [['setting'], 'string'],
  37. ];
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function attributeLabels()
  43. {
  44. return [
  45. 'id' => 'ID',
  46. 'mall_id' => 'Mall ID',
  47. 'setting' => 'Setting',
  48. 'created_at' => 'Created At',
  49. 'updated_at' => 'Updated At',
  50. 'is_delete' => 'Is Delete',
  51. 'deleted_at' => 'Deleted At',
  52. 'token' => 'token',
  53. 'expire_time' => '过期时间',
  54. ];
  55. }
  56. public function getConfig($key){
  57. $setting = Json::decode($this->setting, true);
  58. return $setting[$key] ?? '';
  59. }
  60. }