1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace App\Admin\Controllers\UserManagement\DocterManagement;
- use App\Models\Docter;
- use App\Models\Serviceapplys;
- use Encore\Admin\Controllers\AdminController;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Show;
- class PutdataController extends AdminController
- {
- public function putdata(){
- $id = \request('id');
- $in_chat = \request('in_chat');
- $chat_num = 0;
- $in_phone = \request('in_phone');
- $phone_num = 0;
- $in_appoint = \request('in_appoint');
- $appoint_num = 0;
- //判断图文
- if ($in_chat == 'on')
- {
- $chat_num = 2;
- }else{
- $chat_num = 3;
- }
- //判断电话
- if ($in_phone == 'on')
- {
- $phone_num = 2;
- }else{
- $phone_num = 3;
- }
- //判断预约
- if ($in_appoint == 'on')
- {
- $appoint_num = 2;
- }else{
- $appoint_num = 3;
- }
- $info = Serviceapplys::where('docter_id',$id)->get()->toArray();
- // dd($info);
- foreach ($info as $k)
- {
- //图文的更改
- if ($k['service_type'] == 1)
- {
- $a = Serviceapplys::where('docter_id',$id)->where('service_type',1)->update(['status'=> $chat_num]);
- if ($chat_num == 3)
- {
- Docter::where('id',$id)->update(['is_chat'=>0]);
- }
- }
- //电话的更改
- if ($k['service_type'] == 2)
- {
- Serviceapplys::where('docter_id',$id)->where('service_type',2)->update(['status'=> $phone_num]);
- if ($phone_num == 3)
- {
- Docter::where('id',$id)->update(['is_phone'=>0]);
- }
- }
- //预约的更改
- if ($k['service_type'] == 3)
- {
- Serviceapplys::where('docter_id',$id)->where('service_type',3)->update(['status'=> $appoint_num]);
- if ($appoint_num == 3)
- {
- Docter::where('id',$id)->update(['is_appoint'=>0]);
- }
- }
- }
- return redirect('/admin/docters_service?id='.$id.'');
- }
- }
|