SpecValueController.php 964 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace addons\TinyShop\merchant\modules\common\controllers;
  3. use Yii;
  4. use common\enums\StatusEnum;
  5. use common\helpers\ResultHelper;
  6. use addons\TinyShop\common\models\common\SpecValue;
  7. use addons\TinyShop\merchant\controllers\BaseController;
  8. /**
  9. * Class SpecValueController
  10. * @package addons\TinyShop\merchant\modules\common\controllers
  11. * @author jianyan74 <751393839@qq.com>
  12. */
  13. class SpecValueController extends BaseController
  14. {
  15. /**
  16. * 创建
  17. *
  18. * @param $title
  19. * @param $type
  20. * @return array|mixed
  21. */
  22. public function actionCreate($title, $spec_id)
  23. {
  24. $model = new SpecValue();
  25. $model = $model->loadDefaultValues();
  26. $model->merchant_id = Yii::$app->services->merchant->getNotNullId();
  27. $model->title = $title;
  28. $model->spec_id = $spec_id;
  29. $model->is_tmp = StatusEnum::ENABLED;
  30. $model->save();
  31. return ResultHelper::json(200, 'ok', $model);
  32. }
  33. }
粤ICP备19079148号