123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- namespace app\controller\admin\wechat;
- use crmeb\basic\BaseController;
- use crmeb\services\WechatUserGroupService;
- use crmeb\services\WechatUserTagService;
- use FormBuilder\Exception\FormBuilderException;
- use think\App;
- /**
- * Class WechatGroup
- * @package app\controller\admin\wechat
- * @author xaboy
- * @day 2020-04-27
- */
- class WechatGroup extends BaseController
- {
- /**
- * @var WechatUserGroupService
- */
- protected $service;
- /**
- * WechatTag constructor.
- * @param App $app
- * @param WechatUserGroupService $service
- */
- public function __construct(App $app, WechatUserGroupService $service)
- {
- parent::__construct($app);
- $this->service = $service;
- }
- public function lst()
- {
- return app('json')->success($this->service->lst());
- }
- /**
- * @return mixed
- * @throws FormBuilderException
- * @author xaboy
- * @day 2020-04-27
- */
- public function createForm()
- {
- return app('json')->success(formToData($this->service->form()));
- }
- /**
- * @return mixed
- * @author xaboy
- * @day 2020-04-27
- */
- public function create()
- {
- $name = $this->request->param('group_name');
- if (!$name) return app('json')->fail('请输入分组名称');
- $this->service->create($name);
- return app('json')->success('添加成功');
- }
- /**
- * @param $id
- * @return mixed
- * @author xaboy
- * @day 2020-04-27
- */
- public function update($id)
- {
- $name = $this->request->param('group_name');
- if (!$name) return app('json')->fail('请输入分组名称');
- $this->service->update($id, $name);
- return app('json')->success('编辑成功');
- }
- /**
- * @param $id
- * @return mixed
- * @throws FormBuilderException
- * @author xaboy
- * @day 2020-04-27
- */
- public function updateForm($id)
- {
- return app('json')->success(formToData($this->service->form($id, '')));
- }
- /**
- * @param $id
- * @return mixed
- * @author xaboy
- * @day 2020-04-27
- */
- public function delete($id)
- {
- $this->service->delete($id);
- return app('json')->success('删除成功');
- }
- }
|