杨总惠通宝
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
htb_backend/app/controller/admin/wechat/WechatGroup.php

113 lines
2.8 KiB

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 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('删除成功');
}
}