教师排课添加日期获取
This commit is contained in:
parent
48c1e511ef
commit
6c7f894636
@ -33,7 +33,7 @@ class StudentController extends BaseController
|
||||
$appid = getenv('APP_ID');
|
||||
$redirect_uri = urlencode(getenv('SERVER_DOMAIN') . "/h5#/pages/login/login");//重定向地址
|
||||
// $redirect_uri = getenv('SERVER_DOMAIN') . "/h5#/pages/index/index";//重定向地址
|
||||
|
||||
|
||||
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$appid&redirect_uri=$redirect_uri&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
|
||||
// $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$appid&redirect_uri=$redirect_uri&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
|
||||
|
||||
|
@ -37,7 +37,7 @@ class TeacherScheduleTimeService
|
||||
foreach ($free_time as $free_date => $times) {
|
||||
if ($times) {
|
||||
foreach ($times as $time) {
|
||||
$time_period = explode( ' - ' , $time);
|
||||
$time_period = explode(' - ', $time);
|
||||
$firstDate = new DateTime($free_date . ' ' . $time_period[0]);
|
||||
$secondDate = new DateTime($free_date . ' ' . $time_period[1]);
|
||||
$diff = $secondDate->diff($firstDate);
|
||||
@ -55,7 +55,7 @@ class TeacherScheduleTimeService
|
||||
];
|
||||
//@todo:判断是否已经存在
|
||||
$res = TeacherScheduleTime::create($free_data);
|
||||
if(!$res){
|
||||
if (!$res) {
|
||||
throw new Exception('保存失败');
|
||||
}
|
||||
}
|
||||
@ -92,8 +92,15 @@ class TeacherScheduleTimeService
|
||||
}
|
||||
$data = $request->get();
|
||||
|
||||
$schedule = TeacherScheduleTime::where(['teacher_id'=>$teacher->id, 'month'=>$data['month']])
|
||||
->field('id,teacher_id,date,time,hour,month,subject_id,is_publish')
|
||||
$schedule = TeacherScheduleTime::order('id desc')->where(['teacher_id' => $teacher->id]);
|
||||
if (isset($data['month']) && !empty($data['month'])) {
|
||||
$schedule->where('month', $data['month']);
|
||||
}
|
||||
if (isset($data['date']) && !empty($data['date'])) {
|
||||
$schedule->where('date', $data['date']);
|
||||
}
|
||||
|
||||
$list = $schedule->field('id,teacher_id,date,time,hour,month,subject_id,is_publish')
|
||||
->with(['subject'])
|
||||
->select();
|
||||
|
||||
@ -106,10 +113,10 @@ class TeacherScheduleTimeService
|
||||
|
||||
return [
|
||||
'code' => ResponseCode::SUCCESS,
|
||||
'data'=>$schedule,
|
||||
'data' => $list,
|
||||
'msg' => 'success',
|
||||
];
|
||||
}catch (Exception $e){
|
||||
} catch (Exception $e) {
|
||||
return [
|
||||
'code' => ResponseCode::FAIL,
|
||||
'msg' => $e->getMessage()
|
||||
|
Loading…
x
Reference in New Issue
Block a user