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