| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- /**
- *
- * @author: wuhaotian<442384644@qq.com>
- * @day: 2019/12/07
- */
- namespace app\admin\controller\user;
- use app\admin\controller\AuthController;
- use app\models\user\Cert;
- use crmeb\services\JsonService;
- use crmeb\services\UtilService;
- use crmeb\services\FormBuilder as Form;
- use think\facade\Route as Url;
- /**
- * Class UserGroup
- * @package app\admin\controller\user
- */
- class UserCert extends AuthController
- {
- /**
- * 会员分组页面
- * @return string
- */
- public function index()
- {
- return $this->fetch();
- }
- /**
- * 分组列表
- */
- public function groupList()
- {
- $where = UtilService::getMore([
- ['page', 1],
- ['limit', 20],
- ['status', ''],
- ]);
- return JsonService::successlayui(Cert::getList($where));
- }
- /**
- * 添加/修改分组页面
- * @param int $id
- * @return string
- */
- public function check($id = 0)
- {
- $f = array();
- $f[] = Form::radio('status', '状态', '1')->setOptions([['value' => '1', 'label' => '通过'], ['value' => '2', 'label' => '不通过']]);
- $f[] = Form::select('level', '级别', '1')->setOptions([['value' => '1', 'label' => '低级'], ['value' => '2', 'label' => '中级'], ['value' => '3', 'label' => '高级'], ['value' => '4', 'label' => '特级']]);
- $form = Form::make_post_form('确认证书', $f, Url::buildUrl('save_check', array('id' => $id)));
- $this->assign(compact('form'));
- return $this->fetch('public/form-builder');
- }
- /**
- * 添加/修改
- * @param int $id
- */
- public function save_check($id)
- {
- list($status, $level) = UtilService::postMore([
- ['status', 0],
- ['level', 1]
- ], $this->request, true);
- $res = Cert::check_cert($id, $status, $level);
- if ($res) {
- return JsonService::success('已确认');
- } else {
- return JsonService::fail(Cert::getErrorInfo());
- }
- }
- }
|