Formid.php 711 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\api\controller\wxapp;
  3. use app\api\controller\Controller;
  4. use app\api\model\wxapp\Formid as FormidModel;
  5. /**
  6. * form_id 管理
  7. * Class Formid
  8. * @package app\api\controller\wxapp
  9. */
  10. class Formid extends Controller
  11. {
  12. /**
  13. * 新增form_id
  14. * @param $formId
  15. * @return array
  16. * @throws \app\common\exception\BaseException
  17. * @throws \think\exception\DbException
  18. */
  19. public function save($formId)
  20. {
  21. if (!$user = $this->getUser(false)) {
  22. return $this->renderSuccess();
  23. }
  24. if (FormidModel::add($user['user_id'], $formId)) {
  25. return $this->renderSuccess();
  26. }
  27. return $this->renderError();
  28. }
  29. }