StoreAddons.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace addons\Store\common\models;
  3. use common\enums\StatusEnum;
  4. use Yii;
  5. /**
  6. * This is the model class for table "{{%addons_store_addons}}".
  7. *
  8. * @property int $id 主键
  9. * @property string $title 中文名
  10. * @property string $name 插件名或标识
  11. * @property string|null $cover 封面
  12. * @property string|null $brief_introduction 简单介绍
  13. * @property int|null $status 状态[-1:删除;0:禁用;1启用;]
  14. * @property int|null $created_at 创建时间
  15. * @property int|null $updated_at 修改时间
  16. */
  17. class StoreAddons extends \common\models\base\BaseActiveRecord
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public static function tableName()
  23. {
  24. return '{{%addons_store_addons}}';
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['status', 'created_at', 'updated_at'], 'integer'],
  33. [['title'], 'string', 'max' => 20],
  34. [['name'], 'string', 'max' => 100],
  35. [['cover'], 'string', 'max' => 200],
  36. [['brief_introduction'], 'string', 'max' => 140],
  37. ];
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function attributeLabels()
  43. {
  44. return [
  45. 'id' => '主键',
  46. 'title' => '中文名',
  47. 'name' => '插件名或标识',
  48. 'cover' => '封面',
  49. 'brief_introduction' => '简单介绍',
  50. 'status' => '状态[-1:删除;0:禁用;1启用;]',
  51. 'created_at' => '创建时间',
  52. 'updated_at' => '修改时间',
  53. ];
  54. }
  55. /**
  56. * 获取插件的默认跳转地址
  57. * @Author:lun
  58. * @Date:2023-12-19 17:14
  59. * @Copyright:copyright(c)2023 广东七件事集团
  60. * @param $addons
  61. * @return array|\yii\db\ActiveRecord[]
  62. */
  63. public static function getAddonsDefaultUrls($addons)
  64. {
  65. return StoreMenu::find()->select('addons_name,url')->where(['addons_name' => $addons, 'pid' => 0, 'status' => StatusEnum::ENABLED])->indexBy('addons_name')->asArray()->all();
  66. }
  67. }