添加网站文件
This commit is contained in:
265
application/admin/controller/User.php
Normal file
265
application/admin/controller/User.php
Normal file
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
namespace app\admin\controller;
|
||||
|
||||
use think\Db;
|
||||
use app\admin\logic\UserLogic;
|
||||
use app\admin\logic\StaffLogic;
|
||||
use app\admin\logic\CustomLogic;
|
||||
use app\common\server\ConfigServer;
|
||||
use app\admin\logic\OrderchanelLogic;
|
||||
|
||||
class User extends AdminBase
|
||||
{
|
||||
/**
|
||||
* 会员列表
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function lists(){
|
||||
if ($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$this->_success('', UserLogic::lists($get));
|
||||
}
|
||||
$this->assign('level_list',UserLogic::getLevelList());
|
||||
$this->assign('group_list',UserLogic::getGroupList());
|
||||
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
public function exportFile()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$this->_success('', UserLogic::exportFile($get));
|
||||
}
|
||||
/*
|
||||
*
|
||||
*/
|
||||
public function exportFiles()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
$this->_success('', UserLogic::exportFiles($get));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 客户档案导出功能
|
||||
*/
|
||||
|
||||
public function userexportfiles(){
|
||||
$get = $this->request->get();
|
||||
$this->_success('', UserLogic::userexportfiles($get));
|
||||
}
|
||||
|
||||
/*
|
||||
* 设置分组
|
||||
*/
|
||||
public function setGroup(){
|
||||
if($this->request->isAjax()){
|
||||
$post = $this->request->post();
|
||||
UserLogic::setGroup($post);
|
||||
$this->_success('设置成功','');
|
||||
}
|
||||
$this->assign('group_list',UserLogic::getGroupList());
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 账户调整
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function adjustAccount($id){
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
$result = $this->validate($post,'app\admin\validate\AdjustAccount');
|
||||
if($result === true){
|
||||
$result = UserLogic::adjustAccount($post); //逻辑层处理信息
|
||||
if($result){
|
||||
$this->_success('操作成功',$result);
|
||||
}
|
||||
$result = '操作失败';
|
||||
}
|
||||
$this->_error($result);
|
||||
|
||||
}
|
||||
$this->assign('info',UserLogic::getUser($id));
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/*
|
||||
* 等级调整
|
||||
*/
|
||||
public function adjustLevel($id){
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
$result = UserLogic::adjustLevel($post); //逻辑层处理信息
|
||||
return $this->_success('操作成功',$result);
|
||||
}
|
||||
$this->assign('info', json_encode(UserLogic::adder($id), JSON_UNESCAPED_UNICODE));
|
||||
$this->assign('category_lists', json_encode(StaffLogic::getAllTree(), JSON_UNESCAPED_UNICODE));
|
||||
return $this->fetch();
|
||||
}
|
||||
/*
|
||||
* 会员编辑
|
||||
*/
|
||||
public function edit($id){
|
||||
|
||||
if($this->request->isAjax()){
|
||||
$post = $this->request->post();
|
||||
$list= UserLogic::edit($post);
|
||||
if($list){
|
||||
$this->_success('保存成功');
|
||||
}
|
||||
}
|
||||
$detail = UserLogic::getuserlist($id);
|
||||
$this->assign('info',$detail);
|
||||
return $this->fetch();
|
||||
}
|
||||
/*
|
||||
* 增加客户的档案
|
||||
*/
|
||||
public function add(){
|
||||
if($this->request->isAjax()){
|
||||
$post = $this->request->post();
|
||||
$useradder=Db::name('user_address')->where('telephone',$post['phone'])->find();
|
||||
if($useradder){
|
||||
$this->_error('客户档案已经存在');
|
||||
}else{
|
||||
$list= UserLogic::add($post);
|
||||
if($list){
|
||||
$this->_success('增加用户数据成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assign('chane',OrderchanelLogic::infolist());
|
||||
$this->assign('category_lists', json_encode(StaffLogic::getAllTree(), JSON_UNESCAPED_UNICODE));
|
||||
$brand_lists=Db::name('staffchannel')->where('deletetime','NULL')->select();
|
||||
$this->assign('brand_lists', json_encode($brand_lists, JSON_UNESCAPED_UNICODE));
|
||||
$label_id=Db::name('user_label')->where('del','<>',1)->select();
|
||||
$this->assign('label_id', json_encode($label_id, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/*
|
||||
* 购买单卡的用户数据
|
||||
*/
|
||||
public function yearuserlist(){
|
||||
if($this->request->isAjax()){
|
||||
$get = $this->request->get();
|
||||
$this->_success('', UserLogic::yearlists($get));
|
||||
}
|
||||
|
||||
$this->assign('level_list',UserLogic::getLevelList());
|
||||
$this->assign('group_list',UserLogic::getGroupList());
|
||||
return $this->fetch();
|
||||
|
||||
}
|
||||
public function onelist(){
|
||||
if($this->request->isAjax()){
|
||||
$get = $this->request->get();
|
||||
$this->_success('', UserLogic::onelist($get));
|
||||
}
|
||||
|
||||
|
||||
$admin=Db::name('admin')->where('del',0)->select();
|
||||
$chann=Db::name('staffchannel')->select();
|
||||
$label_id=Db::name('user_label')->where('del','<>',1)->select();
|
||||
|
||||
$this->assign('label_id', $label_id);
|
||||
$this->assign('chann',$chann);
|
||||
$this->assign('admin',$admin);
|
||||
$this->assign('level_list',UserLogic::getLevelList());
|
||||
$this->assign('group_list',UserLogic::getGroupList());
|
||||
return $this->fetch();
|
||||
}
|
||||
/*
|
||||
* 会员详情
|
||||
*/
|
||||
public function info($id){
|
||||
$detail = UserLogic::getUser($id,false,true);
|
||||
$this->assign('detail',$detail);
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function getList(){
|
||||
$post = $this->request->get('');
|
||||
$list = UserLogic::getList($post);
|
||||
$this->_success('',$list);
|
||||
}
|
||||
public function sendCouponList(){
|
||||
if($this->request->isAjax()){
|
||||
$list = UserLogic::sendCouponList();
|
||||
$this->_success('',$list);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 转账记录
|
||||
*/
|
||||
public function transferRecord()
|
||||
{
|
||||
if($this->request->isAjax()) {
|
||||
$get = $this->request->get();
|
||||
$get['page'] = $get['page'] ?? $this->page_no;
|
||||
$get['limit'] = $get['limit'] ?? $this->page_size;
|
||||
$data = UserLogic::transferRecord($get);
|
||||
$this->_success('', $data);
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function staff(){
|
||||
$get = $this->request->get('id');
|
||||
$create_time=time();
|
||||
$staff=Db::name('staff')->where('user_id',$get)->find();
|
||||
|
||||
if($staff){
|
||||
$this->_success('已经是员工');
|
||||
}else{
|
||||
$install=Db::name('staff')->data(['user_id'=>$get,'createtime'=>$create_time])->insert();
|
||||
$this->_success('增加成功', $install);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 等级调整
|
||||
*/
|
||||
public function onedit($id){
|
||||
if ($this->request->isAjax()) {
|
||||
$post = $this->request->post();
|
||||
$result = UserLogic::onedit($post); //逻辑层处理信息
|
||||
return $this->_success('操作成功',$result);
|
||||
}
|
||||
$this->assign('info', json_encode(UserLogic::adders($id), JSON_UNESCAPED_UNICODE));
|
||||
$this->assign('category_lists', json_encode(StaffLogic::getAllTree(), JSON_UNESCAPED_UNICODE));
|
||||
$brand_lists=Db::name('staffchannel')->where('deletetime','NULL')->select();
|
||||
$this->assign('brand_lists', json_encode($brand_lists, JSON_UNESCAPED_UNICODE));
|
||||
$label_id=Db::name('user_label')->where('del','<>',1)->select();
|
||||
$this->assign('label_id', json_encode($label_id, JSON_UNESCAPED_UNICODE));
|
||||
|
||||
return $this->fetch();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 客户档案信息
|
||||
*/
|
||||
public function oneinfo($id){
|
||||
$detail = CustomLogic::getCustom($id,false,true);
|
||||
$this->assign('detail',$detail);
|
||||
return $this->fetch();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user