Files
duolamaojiazhen/application/api/controller/Recruit.php
2025-12-22 13:59:40 +08:00

124 lines
4.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace app\api\controller;
use app\api\logic\CartLogic;
use app\api\logic\RegionLogic;
use think\Db;
class Recruit extends ApiBase{
public $like_not_need_login = ['recruit_type','recruit_order','recruit_orderinfo','staff_list','recruit_index','recruit_listorder','add_order'];
public function recruit_type(){
$recruit_type=Db::name('staff_group')->select(); //获取部门信息
$recruitype=Db::name('recruitype')->select(); //获取招聘的类型
$recrui_monney=Db::name('recrui_monney')->select();
$data=[
'filterProject'=>$recruit_type,
'filterSubject'=>$recruitype,
'filterYear'=>$recrui_monney
];
return $this->_success('获取招聘类型成功',$data);
}
//站长端派单查询
public function recruit_order(){
$get = $this->request->get();//获取的电话查询
$data=RegionLogic::recruit_order($get);
return $this->_success('获取订单的数据成功',$data);
}
//根据id获取订单的基本
public function recruit_orderinfo(){
$get = $this->request->get();//获取订单的id
$info=Db::name('order')->where('id',$get['order_id'])->find();
return $this->_success('获取订单数据成功',$info);
}
//获取保洁师的基本
public function staff_list(){
$get = $this->request->get();//获取传递过来的时间
$get['datatime']=date('Y-m-d',$get['time']/1000); //获取提交过来日期
$timestamp = strtotime("today 14:00 am"); //上午的时间搓
$timestampxw = strtotime("today 18:00 am"); //上午的时间搓
//判断日期类型
if(time()>strtotime($get['datatime'])){
$this->_error('日期时间选择错误');
}
$data=RegionLogic::staff_list($get);
return $this->_success('获取保洁师',$data);
}
//首页获取站长端口数据统计
public function recruit_index(){
$get = $this->request->get();//传递过来的数据
$data=RegionLogic::recruit_index($get);
return $this->_success('获取订单的数据成功',$data);
}
//首页获取统计内容
public function recruit_listorder(){
$get = $this->request->get();//接受传递过来的参数
$data=RegionLogic::recruit_listorder($get);
return $this->_success('获取订单的数据成功',$data);
}
//站长创建子订单
public function add_order(){
$get = $this->request->get();//接受传递过来的参数
$orderinfo=Db::name('order')->where('id',$get['order_id'])->find();
$useradder=Db::name('user_address')->where('', $orderinfo['mobile'])->find();
//传递过来的时间转换
$selectime=date("Y-m-d",$get['time']/1000);
// 使用date()函数获取星期几的数字表示0-60 是星期天)
$weekdayNum = date('N', strtotime($selectime));
// 使用数组映射星期几的名称
$weekdays = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六','星期天'];
// 获取对应的星期名称
$weekdayName = $weekdays[$weekdayNum - 1];
if($orderinfo && $useradder){
$data=[
'order_sn' => $orderinfo['order_sn'],
'name' => $orderinfo['consignee'],
'phone' => $orderinfo['mobile'],
'admin' => $useradder['admin_id'],
'goods_id' => $orderinfo['goods_id'],
'channel_id' => $useradder['brand_id'],
'type' => $orderinfo['type_id'],
'autotime' => strtotime($selectime),
'xq' => $weekdayName,
'date' => $selectime,
'addtime' => $get['addtime'],
'staff_id' => $get['staff_id'],
'create_time' => time(),
'remark' => $get['remark'],
];
$inser=Db::name('order_exe')->data($data)->insert();
if($inser){
$update=Db::name('order')->where('order_sn',$orderinfo['order_sn'])->update(['code'=>$orderinfo['code']-1]);
return $this->_success('创建子订单成功');
}
}else{
$this->_error('创建子订单失败');
}
}
}