浏览代码

Code merge

Mike 4 年之前
父节点
当前提交
40fd84d692

+ 20 - 15
app/Admin/Actions/Community/Notice/sendNotice.php

xqd xqd
@@ -19,7 +19,7 @@ class sendNotice extends BatchAction
             $remark= request('remark');
 //            $openid = 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s'; 自己
             if(empty($openid)) continue;
-//            $this->send($openid,$content,$remark);
+            $this->send($openid,$content,$remark);
         }
 
         return $this->response()->success('发送成功')->refresh();
@@ -43,21 +43,26 @@ class sendNotice extends BatchAction
                 'response_type' => 'array'
             ];
         $app = Factory::officialAccount($config);
-        $user = $app->user->get('oVxTzvgYlGktIDZXwfLMLQ01Tr5sss');
         if(!isset($user['openid'])) return true;
-        $app->template_message->send([
-                'touser' => 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s',
-                'template_id' => '3LUhWGlyiljxrT3Jh8orwQZ2LSHjfRs9SIHaB40O6q0',
-            //            'url' => 'https://t5.9026.com',
-                'data' => [
-                    'first'=>'社区通知',
-                    'keyword1' => '王海军',
-                    'keyword2' => 18719141830,
-                    'keyword3' => '开发工程师',
-                    'keyword4' => '思维定制',
-                    'keyword5' => '2020-12-12',
-                ],
-            ]);
+        $res = $app->template_message->send([
+            'touser' => $open_id,
+            'template_id' => 'GWIu1FBBA8SOdOwEbXRAmBL9LlYJP_H6EJUC7rv-YiQ',
+            'url' => 'https://t5.9026.com',
+//            'miniprogram' => [
+//                'appid' => 'wx6131f74e623bf6bf',
+//                'pagepath' => '/pages/index/index',
+//            ],
+            'data' => [
+                'first'=>'社区通知',
+                'cardNumber' => '测试服务服务包',
+                'type' => '门诊',
+                'address' => '华西医院',
+                'VIPPhone' => 18719141830,
+                'VIPName' => '测试服务包',
+                'expDate' => '2021年12月31号',
+                'remark' => '请咨询13912345678。',
+            ],
+        ]);
         return true;
     }
 

+ 2 - 1
app/Admin/Actions/Service/PassAction.php

xqd
@@ -12,7 +12,8 @@ class PassAction extends RowAction
 
     public function handle(Model $model)
     {
-        Serviceapplys::where('id',$model->id)->update(['status'=>2]);
+        // $model ...
+        Serviceapplys::where('id',$this->row->id)->update(['status'=>2]);
         return $this->response()->success('开通成功')->refresh();
     }
 

+ 19 - 0
app/Admin/Actions/backstage/Docters/AppointAction.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Docters;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class AppointAction extends RowAction
+{
+    public $name = '门诊预约配置';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转门诊预约配置成功')->redirect('/admin/docter_appoint?docter_id='.$this->row->id.'');
+    }
+
+}

+ 19 - 0
app/Admin/Actions/backstage/Docters/ChatAction.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Docters;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class ChatAction extends RowAction
+{
+    public $name = '图文服务配置';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转图文服务配置成功')->redirect('/admin/docter_chat?docter_id='.$this->row->id.'');
+    }
+
+}

+ 19 - 0
app/Admin/Actions/backstage/Docters/PhoneAction.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Docters;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class PhoneAction extends RowAction
+{
+    public $name = '电话服务配置';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转电话服务配置成功')->redirect('/admin/docter_phone?docter_id='.$this->row->id.'');
+    }
+
+}

+ 1 - 0
app/Admin/Controllers/ServiceManagement/ServiceController.php

xqd
@@ -2,6 +2,7 @@
 
 namespace App\Admin\Controllers\ServiceManagement;
 
+use App\Admin\Actions\backstage\Pass;
 use App\Admin\Actions\Service\ApplysAction;
 use App\Admin\Actions\Service\PassAction;
 use App\Admin\Actions\Service\RefuseAction;

+ 1 - 1
app/Admin/Controllers/ServicePacksManagment/OpenPackController.php

xqd xqd
@@ -24,6 +24,7 @@ class OpenPackController extends AdminController
     protected function grid()
     {
         $grid = new Grid(new Order());
+        $grid->disableActions();
         $grid->model()->where('product_type','6')->orderBy('id','desc');
         $grid->column('id', __('订单ID'));
         $grid->column('user_id', __('用户ID'));
@@ -37,7 +38,6 @@ class OpenPackController extends AdminController
             return $name;
         });
         $grid->column('created_at', __('创建时间'));
-        $grid->column('updated_at', __('更新时间'));
 
         return $grid;
     }

+ 1 - 7
app/Admin/Controllers/ServicePacksManagment/ServicePacksController.php

xqd xqd
@@ -98,7 +98,7 @@ class ServicePacksController extends AdminController
             ])->when('has',1,function (Form $form){
                 $form->number('chat_num', __('图文次数'))->default(0);
             })->when('has',2,function (Form $form){
-                $form->number('phone_minutes', __('电话次数(分钟)'))->default(0);
+                $form->number('phone_minutes', __('电话分钟数'))->default(0);
             })->when('has',3,function (Form $form){
                 $form->number('appoint_num', __('门诊次数'))->default(0);
             })->when('has',4,function (Form $form){
@@ -107,13 +107,7 @@ class ServicePacksController extends AdminController
                 $form->number('nurses_limit_amount', __('儿保次数'))->default(0);
             })->rules('required',['required'=>'请选择服务类型']);
 
-//        $form->number('phone_minutes', __('电话次数(分钟)'))->default(0);
-//        $form->number('chat_num', __('图文次数'))->default(0);
-//        $form->number('appoint_num', __('门诊次数'))->default(0);
-//        $form->number('vaccine_limit_amount', __('计免次数'))->default(0);
-//        $form->number('nurses_limit_amount', __('儿保次数'))->default(0);
         $form->text('effective_days', __('服务时长(秒)'))->default(0);
-//        $form->image('insurance_img_url', __('保单图片'))->rules('required' ,['required'=>'请选择图片!'])->help('请上传PTf格式!!');
         return $form;
     }
 }

+ 135 - 0
app/Admin/Controllers/UserManagement/DocterManagement/AppointController.php

xqd
@@ -0,0 +1,135 @@
+<?php
+
+namespace App\Admin\Controllers\UserManagement\DocterManagement;
+
+use App\Models\DocterSetting;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class AppointController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '门诊预约配置列表';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new DocterSetting());
+        $grid->disableCreateButton();
+        $grid->disableActions();
+        $grid->disableBatchActions();
+        $docter_id = request('docter_id');
+        $grid->model()->where('docter_id',$docter_id)->where('type',1);
+        $grid->column('id', __('Id'));
+        $grid->column('docter_id', __('医生id'));
+        $grid->column('docter.name', __('医生姓名'));
+        $grid->column('docter.avatar', __('医生头像'))->lightbox(['width' =>'', 'height' => 30]);
+        $grid->column('organization.name', __('机构名'));
+        $grid->column('type', __('类型'))->using([1=>'门诊预约']);
+        $grid->column('show_days', __('可预约天数'));
+        $grid->column('service_times', __('就诊时长'));
+        $grid->column('service_num', __('同时服务订单数'));
+        $grid->column('appoint_price', __('预约单价'));
+
+        $grid->column('am', __('上午服务时间'))->display(function (){
+            $service_time = DocterSetting::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[1]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[1]['amStartTime'].'-'.$obj_arr[1]['amEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('pm', __('下午服务时间'))->display(function (){
+            $service_time = DocterSetting::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[2]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[2]['pmStartTime'].'-'.$obj_arr[2]['pmEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('night', __('晚上服务时间'))->display(function (){
+            $service_time = DocterSetting::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[3]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[3]['nightStartTime'].'-'.$obj_arr[3]['nightEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('updated_at', __('更新时间'));
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(DocterSetting::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('type', __('Type'));
+        $show->field('status', __('Status'));
+        $show->field('show_days', __('Show days'));
+        $show->field('service_times', __('Service times'));
+        $show->field('service_num', __('Service num'));
+        $show->field('org_id', __('Org id'));
+        $show->field('appoint_price', __('Appoint price'));
+        $show->field('service_time', __('Service time'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new DocterSetting());
+
+        $form->number('docter_id', __('Docter id'));
+        $form->number('type', __('Type'));
+        $form->number('status', __('Status'));
+        $form->number('show_days', __('Show days'));
+        $form->number('service_times', __('Service times'));
+        $form->number('service_num', __('Service num'));
+        $form->number('org_id', __('Org id'));
+        $form->decimal('appoint_price', __('Appoint price'))->default(0.00);
+        $form->text('service_time', __('Service time'));
+
+        return $form;
+    }
+}

+ 128 - 0
app/Admin/Controllers/UserManagement/DocterManagement/ChatController.php

xqd
@@ -0,0 +1,128 @@
+<?php
+
+namespace App\Admin\Controllers\UserManagement\DocterManagement;
+
+use App\Models\Docter;
+use App\Models\Doctertimes;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class ChatController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '图文服务配置列表';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Doctertimes());
+        $grid->disableCreateButton();
+        $grid->disableActions();
+        $grid->disableBatchActions();
+        $docter_id = request('docter_id');
+        $grid->model()->where('docter_id',$docter_id)->where('type',2);
+        $grid->column('id', __('Id'));
+        $grid->column('docter_id', __('医生id'));
+        $grid->column('docter.avatar', __('医生头像'))->lightbox(['width' =>'', 'height' => 30]);
+        $grid->column('docter.name', __('医生姓名'));
+        $grid->column('type', __('类型'))->using([1=>'电话咨询',2=>'图文咨询',3=>'门诊咨询',4=>'疫苗预约接种',5=>'儿保预约',6=>'服务包',7=>'充值']);
+        $grid->column('base_price', __('基础价格'));
+        $grid->column('am', __('上午服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[1]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[1]['amStartTime'].'-'.$obj_arr[1]['amEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('pm', __('下午服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[2]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[2]['pmStartTime'].'-'.$obj_arr[2]['pmEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('night', __('晚上服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[3]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[3]['nightStartTime'].'-'.$obj_arr[3]['nightEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('person', __('服务人数'));
+        $grid->column('updated_at', __('更新时间'));
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Doctertimes::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('base_price', __('Base price'));
+        $show->field('step_price', __('Step price'));
+        $show->field('service_time', __('Service time'));
+        $show->field('person', __('Person'));
+        $show->field('type', __('Type'));
+        $show->field('relation_id', __('Relation id'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Doctertimes());
+
+        $form->number('docter_id', __('Docter id'));
+        $form->decimal('base_price', __('Base price'));
+        $form->decimal('step_price', __('Step price'));
+        $form->text('service_time', __('Service time'));
+        $form->number('person', __('Person'));
+        $form->number('type', __('Type'));
+        $form->number('relation_id', __('Relation id'));
+
+        return $form;
+    }
+}

+ 129 - 0
app/Admin/Controllers/UserManagement/DocterManagement/PhoneController.php

xqd
@@ -0,0 +1,129 @@
+<?php
+
+namespace App\Admin\Controllers\UserManagement\DocterManagement;
+
+use App\Models\Doctertimes;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class PhoneController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '电话服务配置列表';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Doctertimes());
+        $grid->disableCreateButton();
+        $grid->disableActions();
+        $grid->disableBatchActions();
+        $docter_id = request('docter_id');
+        $grid->model()->where('docter_id',$docter_id)->where('type',1);
+        $grid->column('id', __('Id'));
+        $grid->column('docter_id', __('医生id'));
+        $grid->column('docter.avatar', __('医生头像'))->lightbox(['width' =>'', 'height' => 30]);
+        $grid->column('docter.name', __('医生姓名'));
+        $grid->column('type', __('类型'))->using([1=>'电话咨询',2=>'图文咨询',3=>'门诊咨询',4=>'疫苗预约接种',5=>'儿保预约',6=>'服务包',7=>'充值']);
+
+        $grid->column('base_price', __('基础价格'));
+        $grid->column('base_price', __('步进价格'));
+        $grid->column('am', __('上午服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[1]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[1]['amStartTime'].'-'.$obj_arr[1]['amEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('pm', __('下午服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[2]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[2]['pmStartTime'].'-'.$obj_arr[2]['pmEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('night', __('晚上服务时间'))->display(function (){
+            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $arr = json_decode($service_time);
+            $obj_arr = object_array($arr);
+            if (empty($obj_arr[3]))
+            {
+                return '无';
+            }else
+            {
+                $str = $obj_arr[3]['nightStartTime'].'-'.$obj_arr[3]['nightEndTime'];
+                return $str;
+            }
+        });
+        $grid->column('person', __('服务人数'));
+        $grid->column('updated_at', __('更新时间'));
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Doctertimes::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('docter_id', __('Docter id'));
+        $show->field('base_price', __('Base price'));
+        $show->field('step_price', __('Step price'));
+        $show->field('service_time', __('Service time'));
+        $show->field('person', __('Person'));
+        $show->field('type', __('Type'));
+        $show->field('relation_id', __('Relation id'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Doctertimes());
+
+        $form->number('docter_id', __('Docter id'));
+        $form->decimal('base_price', __('Base price'));
+        $form->decimal('step_price', __('Step price'));
+        $form->text('service_time', __('Service time'));
+        $form->number('person', __('Person'));
+        $form->number('type', __('Type'));
+        $form->number('relation_id', __('Relation id'));
+
+        return $form;
+    }
+}

+ 7 - 0
app/Admin/Controllers/UserManagement/DocterManagement/ServiceManagementController.php

xqd xqd
@@ -2,6 +2,10 @@
 
 namespace App\Admin\Controllers\UserManagement\DocterManagement;
 
+use App\Admin\Actions\backstage\Docters\AppointAction;
+use App\Admin\Actions\backstage\Docters\ChatAction;
+use App\Admin\Actions\backstage\Docters\PhoneAction;
+use App\Admin\Actions\Community\Docter\Chat;
 use App\Models\Docter;
 use App\Models\ServiceApply;
 use App\Models\Serviceapplys;
@@ -37,6 +41,9 @@ class ServiceManagementController extends AdminController
         $grid->actions(function ($actions){
            $actions->disableView();
            $actions->disableDelete();
+           $actions->add (new ChatAction());
+           $actions->add (new PhoneAction());
+           $actions->add (new AppointAction());
         });
         $grid->model()->where('id',$id);
         $grid->column('id', __('id'));

+ 6 - 0
app/Admin/routes.php

xqd
@@ -92,6 +92,12 @@ Route::group([
         //处理数据
 //        $router->put('put', '');
     $router->any('putdata', 'UserManagement\DocterManagement\PutdataController@putdata');
+    //服务管理->图文服务配置
+    $router->resource('docter_chat', UserManagement\DocterManagement\ChatController::class);
+    //服务管理->电话服务配置
+    $router->resource('docter_phone', UserManagement\DocterManagement\PhoneController::class);
+    //服务管理->门诊预约配置
+    $router->resource('docter_appoint', UserManagement\DocterManagement\AppointController::class);
     /*
      * 用户管理->宝妈用户
      * */

+ 5 - 3
app/Models/DocterSetting.php

xqd
@@ -13,8 +13,10 @@ class DocterSetting extends BaseModel
     protected $table="docter_settings";
     public $timestamps = false;
 
-    public function organization()
-    {
-        return $this->belongsTo(Organization::class,'org_id','id');
+    public function docter(){
+        return $this->hasOne(Docter::class,'id','docter_id');
+    }
+    public function organization(){
+        return $this->hasOne(Organization::class,'id','org_id');
     }
 }

+ 4 - 0
app/Models/Doctertimes.php

xqd
@@ -11,4 +11,8 @@ namespace App\Models;
 class DocterTimes extends BaseModel
 {
 
+
+    public function docter(){
+        return $this->hasOne(Docter::class,'id','docter_id');
+    }
 }

+ 5 - 5
config/config.php

xqd xqd
@@ -19,8 +19,8 @@ return [
 
     // 测试服务
     'wechat_small_program' => [
-        'app_id' => 'wx6131f74e623bf6bf',
-        'secret' => 'b703596ab6cbcad5b74eb51fec2aeb0b',
+        'app_id' => env('WECHAT_APPID','wx6131f74e623bf6bf'),
+        'secret' => env('WECHAT_APPSECRET','b703596ab6cbcad5b74eb51fec2aeb0b'),
     ],
     // 测试服务医生
     'docter_wechat_small_program' => [
@@ -29,9 +29,9 @@ return [
     ],
 
     'wechat_pay' => [
-        'app_id' => 'wx6131f74e623bf6bf',
-        'mch_id' => '1398823402',
-        'key' => 'c1891122765718911227657189112276',
+        'app_id' => env('WECHAT_APPID','wx6131f74e623bf6bf'),
+        'mch_id' => env('WECHAT_MCHID','1398823402'),
+        'key' =>  env('WECHAT_KEY','c1891122765718911227657189112276'),
         'notify_url' => env('API_HOST', '').'/api/v1/payCallback/wechatPayNotify'
     ],
     'aly_sms' => [