소스 검색

fix: 我的预约,添加预约日期

zzb 1 년 전
부모
커밋
9b741e7ae4

+ 2 - 1
app/admin/controller/AppointmentApplication.php

@@ -61,6 +61,7 @@ class AppointmentApplication extends Permissions
                 $value['problem_type_text'] = $value->problem_type_text;
                 $value['marriage_text'] = $value->marriage_text;
                 $value['education_level_text'] = $value->education_level_text;
+                $value['appointment_date'] = $value->appointment_date;
                 $data[$key] = $value;
             }
             return array('code' => 0, 'count' => $count, 'data' => $data);
@@ -111,7 +112,7 @@ class AppointmentApplication extends Permissions
     {
         if ($this->request->isPost()) {
             $post = $this->request->post();
-            if (false == Db::name('appointment_application')->where('id', $post['id'])->update(['status' => $post['status'],'finish_time'=>time()])) {
+            if (false == Db::name('appointment_application')->where('id', $post['id'])->update(['status' => $post['status'], 'finish_time' => time()])) {
                 $this->error('设置失败');
             } else {
                 $this->success('设置成功', 'index');

+ 1 - 0
app/admin/view/appointment_application/index.html

@@ -140,6 +140,7 @@
                     {field: "phone", title: '电话', width: 120},
                     {field: "problem_desc", title: '问题描述'},
                     {field: "requirement_desc", title: '需求描述'},
+                    {field: "appointment_date", title: '预约日期'},
                     {field: "appointment_time", title: '预约时间段'},
                     {field: "remark", title: '备注'},
                     {field: "create_time", title: '下单时间'},

+ 4 - 16
app/api/controller/User.php

@@ -9,6 +9,7 @@
 namespace app\api\controller;
 
 
+use app\api\controller\base\Base;
 use app\api\controller\base\Permissions;
 use app\common\model\AppointmentApplication;
 use app\common\model\AppointmentTicket;
@@ -16,7 +17,7 @@ use app\common\model\Feedback;
 use app\common\model\Webconfig;
 use time\DateHelper;
 
-class User extends Permissions
+class User extends Base
 {
     //个人资料
     public function info()
@@ -56,13 +57,6 @@ class User extends Permissions
             ['marriage|婚姻情况', 'number|in:0,1,2'],
             ['problem_type|咨询问题类别', 'number|in:0,1,2,3,4,5'],
             ['childs_num_str|子女数量', 'max:255'],
-//            ['childs_num|子女数量', 'number|in:1,2,3'],
-//            ['childs_age1|一孩年龄', 'number'],
-//            ['childs_age2|二孩年龄', 'number'],
-//            ['childs_age3|三孩年龄', 'number'],
-//            ['childs_sex1|一孩性别', 'number'],
-//            ['childs_sex2|二孩性别', 'number'],
-//            ['childs_sex3|三孩性别', 'number'],
         ]);
         if (!$validate->check($post)) {
             $this->json_error('提交失败:' . $validate->getError());
@@ -154,13 +148,6 @@ class User extends Permissions
             'marriage' => $post['marriage']??0,
             'problem_type' => $post['problem_type']??0,
             'childs_num_str' => $this->request->param('childs_num_str', '', 'htmlspecialchars'),
-//            'childs_num' => $post['childs_num']??0,
-//            'childs_age1' => $post['childs_age1']??0,
-//            'childs_age2' => $post['childs_age2']??0,
-//            'childs_age3' => $post['childs_age3']??0,
-//            'childs_sex1' => $post['childs_sex1']??0,
-//            'childs_sex2' => $post['childs_sex2']??0,
-//            'childs_sex3' => $post['childs_sex3']??0,
         ];
         if (false === $model->allowField(true)->save($data)) {
             $this->json_error("预约入库失败");
@@ -217,7 +204,7 @@ class User extends Permissions
             $this->json_error('提交失败:' . $validate->getError());
         }
 
-        $where = ['user_id' => $this->getUserId()];
+        $where = ['user_id' => 1];
         $status = $this->request->param('status', 0, 'intval');
         if ($status == 1) {
             $where['finish_time'] = 0;
@@ -231,6 +218,7 @@ class User extends Permissions
             $item->address;
             $item->specialist;
             $item->specialist->head_pic = geturl($item->specialist->head_pic, '', true);
+            $item->appointment_date = $item->appointment_date;
             $datalist[$key] = $item;
         }
         if (empty($datalist)) {

+ 1 - 0
app/api/controller/接口文档.md

@@ -587,6 +587,7 @@
                 "address_id": "1",
                 "provider_id": 1,
                 "appointment_ticket_id": 1,
+                "appointment_date": "2023-01-02",
                 "appointment_time": "08:00:00 - 12:00:00",
                 "status": 0,
                 "remark": "",

+ 12 - 0
app/common/model/AppointmentApplication.php

@@ -64,6 +64,12 @@ class AppointmentApplication extends Model
         return self::EDUCATION_LEVELS[$data['education_level']]??'';
     }
 
+    //appointment_date
+    public function getAppointmentDateAttr($value, $data)
+    {
+        return $this->appointmentTicket->appointment_daytime;
+    }
+
     //childs_text
     public function getChildsTextAttr($value, $data)
     {
@@ -118,4 +124,10 @@ class AppointmentApplication extends Model
     {
         return $this->belongsTo('Specialist', 'provider_id');
     }
+
+    //关联号源
+    public function appointmentTicket()
+    {
+        return $this->belongsTo('AppointmentTicket');
+    }
 }