智慧教务系统 PHP-NiuCloud框架开发
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.
 
 
 
 
 
 

152 lines
4.3 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace addon\zhjw\app\adminapi\controller\sales;
use core\base\BaseAdminController;
use addon\zhjw\app\service\admin\sales\SalesService;
/**
* 销售管理控制器
* Class Sales
* @package addon\zhjw\app\adminapi\controller\sales
*/
class Sales extends BaseAdminController
{
/**
* 获取销售管理列表
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
["student_phone",""],
["student_name",""],
["sex",""],
["age",["",""]],
["school_name",""],
["grade",""],
["class_name",""],
["source_channel",""],
["customer_source",""],
["add_staff_id",""],
["get_staff_id",""],
["contact_name",""],
["province_id",""],
["city_id",""],
["district_id",""],
["community_name",""],
["customer_tags",""],
["create_time",""]
]);
return success((new SalesService())->getPage($data));
}
/**
* 销售管理详情
* @param int $id
* @return \think\Response
*/
public function info(int $id){
return success((new SalesService())->getInfo($id));
}
/**
* 添加销售管理
* @return \think\Response
*/
public function add(){
$data = $this->request->params([
["student_phone",""],
["student_name",""],
["sex",""],
["age",""],
["school_name",""],
["grade",""],
["class_name",""],
["source_channel",""],
["customer_source",""],
["add_staff_id",0],
["get_staff_id",0],
["contact_name",""],
["province_id",0],
["city_id",0],
["district_id",0],
["community_name",""],
["customer_tags",[]],
]);
if(!empty($data['customer_tags'])){
$data['customer_tags'] = implode(',',$data['customer_tags']);
}
$this->validate($data, 'addon\zhjw\app\validate\sales\Sales.add');
$id = (new SalesService())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* 销售管理编辑
* @param $id 销售管理id
* @return \think\Response
*/
public function edit(int $id){
$data = $this->request->params([
["student_phone",""],
["student_name",""],
["sex",""],
["age",""],
["school_name",""],
["grade",""],
["class_name",""],
["source_channel",""],
["customer_source",""],
["add_staff_id",0],
["get_staff_id",0],
["contact_name",""],
["province_id",0],
["city_id",0],
["district_id",0],
["community_name",""],
["customer_tags",[]],
]);
if(!empty($data['customer_tags'])){
$data['customer_tags'] = implode(',',$data['customer_tags']);
}
$this->validate($data, 'addon\zhjw\app\validate\sales\Sales.edit');
(new SalesService())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* 销售管理删除
* @param $id 销售管理id
* @return \think\Response
*/
public function del(int $id){
(new SalesService())->del($id);
return success('DELETE_SUCCESS');
}
public function getStaffAll(){
return success(( new SalesService())->getStaffAll());
}
public function getSysAreaAll(){
return success(( new SalesService())->getSysAreaAll());
}
}