239 lines
8.3 KiB
PHP
239 lines
8.3 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\api\logic\AdLogic;
|
|
|
|
use think\Db;
|
|
class Ad extends ApiBase
|
|
{
|
|
public $like_not_need_login = ['lists','channel','label','add_comost','add_comost','list_comost','follow_comost','comost_add','label_edit','comost_info','notice','position','position_list','vode_type','video_list','video_info','user_wages','user_wages_add','user_leave','fine','recruit','last_leave','last_fine','notice_list','leave','auth'];
|
|
public function lists()
|
|
{
|
|
$pid = $this->request->get('pid');
|
|
$client = $this->request->get('client', 1);
|
|
if ($pid) {
|
|
$list = AdLogic::lists($pid, $client);
|
|
} else {
|
|
$list = [];
|
|
}
|
|
$this->_success('获取成功', $list);
|
|
}
|
|
|
|
//获取客户的渠道
|
|
public function channel(){
|
|
$list=Db::name('staffchannel')->field('id,name')->select();
|
|
$this->_success('获取成功', $list);
|
|
|
|
}
|
|
|
|
//获取客户的标签
|
|
public function label(){
|
|
$list=Db::name('user_label')->field('id,name')->select();
|
|
$this->_success('获取成功', $list);
|
|
}
|
|
|
|
//增加客户的档案
|
|
public function add_comost(){
|
|
$get = $this->request->get();//获取到员工的ID
|
|
$phone=Db::name('user_address')->where('telephone',$get['mobile'])->find();
|
|
if($phone){
|
|
$this->_error('电话号码已存在');
|
|
}
|
|
$staff=Db::name('staff')->where('id',$get['staff_id'])->field('mobile')->find();
|
|
$admin=Db::name('admin')->where('phone',$staff['mobile'])->find();
|
|
if($admin){
|
|
$data=[
|
|
'contact' => $get['consignee'],
|
|
'telephone' => $get['mobile'],
|
|
'sex' => $get['sex'],
|
|
'address' => $get['adder'],
|
|
'pet' => $get['pet'],
|
|
'hbl' => $get['clas'],
|
|
'wx' => $get['wx'],
|
|
'brand_id' => $get['channels'],
|
|
'label_id' => $get['labels'],
|
|
'admin_id' => $admin['id'],
|
|
'createtime' => time(),
|
|
'updatetime' => time()
|
|
];
|
|
$inser=Db::name('user_address')->data($data)->insert();
|
|
$this->_success('增加客户数据成功');
|
|
}else{
|
|
$this->_error('增加数据失败');
|
|
}
|
|
|
|
}
|
|
|
|
//根据ID获取客户的归属
|
|
public function list_comost(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::list_comost($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
//根据订单id获取的跟进信息
|
|
public function follow_comost(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::follow_comost($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
//创建跟进的内容
|
|
public function comost_add(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::comost_add($get);
|
|
$this->_success('增加跟进内容成功');
|
|
}
|
|
|
|
//修改客户的标签
|
|
public function label_edit(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$update=Db::name('user_address')->where('id',$get['uid'])->update(['label_id'=>$get['value']]);
|
|
$this->_success('修改渠道成功');
|
|
}
|
|
|
|
public function comost_info(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$list=Db::name('user_address')->where('id',$get['id'])->find();
|
|
if($list['sex']==0){
|
|
$list['sex']="男";
|
|
}else{ $list['sex']="女";}
|
|
if($list['pet']=0){
|
|
$list['pet']="无";
|
|
}else{$list['pet']="有";}
|
|
if($list['hbl']==0){
|
|
$list['hbl']="无";
|
|
}else{ $list['hbl']="有";}
|
|
if($list['wx']==0){
|
|
$list['wx']="无";
|
|
}else{ $list['wx']="有";}
|
|
$label=Db::name('user_label')->where('id',$list['label_id'])->field('name')->find();
|
|
if($label){
|
|
$list['label_name']= $label['name'];
|
|
}else{
|
|
$list['label_name']= '-';
|
|
}
|
|
$brand=Db::name('staffchannel')->where('id',$list['brand_id'])->field('name')->find();
|
|
if($brand){
|
|
$list['brand_name']= $brand['name'];
|
|
}else{
|
|
$list['brand_name']= '-';
|
|
}
|
|
$this->_success('获取数据成功',$list);
|
|
}
|
|
|
|
//获取首页最新公告俩条
|
|
public function notice(){
|
|
$lists = AdLogic::notice();
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
//获取招聘类型列表
|
|
public function position(){
|
|
$lists = AdLogic::position();
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
public function position_list(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::position_list($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
//获取视频的类型
|
|
public function vode_type(){
|
|
$lists = AdLogic::vode_type();
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
public function video_list(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::video_list($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
//根据id获取视频培训
|
|
public function video_info(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::video_info($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
//员工工资获取获取
|
|
public function user_wages(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::user_wages($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
//员工增加员工的工资
|
|
public function user_wages_add(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::user_wages_add($get);
|
|
if($lists==-1){
|
|
$this->_error('工资已经提交请勿重复提交');
|
|
}
|
|
$this->_success('提交成功');
|
|
}
|
|
//获取请假的列表
|
|
public function user_leave(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::user_leave($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
|
|
//删除上一个月请假列表
|
|
public function last_leave(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::last_leave($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
//获取到员工的罚款记录
|
|
public function fine(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::fine($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
//获取员工上一个月罚款记录
|
|
public function last_fine(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::last_fine($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
//提交招聘的信息
|
|
public function recruit(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::addrecruit($get);
|
|
$this->_success('提交成功等待人事回电');
|
|
}
|
|
//获取公告的内容
|
|
public function notice_list(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$lists = AdLogic::notice_list($get);
|
|
$this->_success('获取数据成功',$lists);
|
|
}
|
|
//员工提交请假申请
|
|
public function leave(){
|
|
$get = $this->request->get();//获取的到传递过来的参数
|
|
$data=Db::name('leavesd')
|
|
->where('staff_id',$get['staff_id'])
|
|
->where('time',strtotime($get['time']))
|
|
->where('addtime',$get['after'])
|
|
->find();
|
|
if($data){
|
|
$this->_error('日期已经请假');
|
|
}
|
|
$lists = AdLogic::addleave($get);
|
|
$this->_success('提交成功');
|
|
}
|
|
//获取员工权限
|
|
public function auth(){
|
|
$get = $this->request->get();
|
|
|
|
$lists = AdLogic::auth($get);
|
|
|
|
$this->_success('获取权限成功',$lists);
|
|
}
|
|
|
|
} |