Prechádzať zdrojové kódy

Merge branch 'master' of ssh://git.9026.com:2212/swdz-WangHaijun/BaoMa

# Conflicts:
#	.gitignore
whj 4 rokov pred
rodič
commit
f673f4d236

+ 2 - 1
.gitignore

xqd
@@ -10,5 +10,6 @@ Homestead.json
 Homestead.yaml
 npm-debug.log
 yarn-error.log
-.idea/*
+.idea/
+.DS_Store
 

+ 2 - 2
app/Helpers/functions.php

xqd
@@ -165,8 +165,8 @@ if (!function_exists('get_user_coordinate')) {
     {
         $req = request()->post();
         if (empty($req['latitude']) || empty($req['longitude'])) {
-            $latitude = $user['latitude'];
-            $longitude = $user['longitude'];
+            $latitude = $user['latitude'] ?? 0;
+            $longitude = $user['longitude'] ?? 0;
         }
         else {
             $latitude = $req['latitude'];

+ 10 - 1
app/Http/Controllers/Api/V1/AuthController.php

xqd
@@ -17,6 +17,15 @@ class AuthController extends Controller
 
     public function __construct()
     {
-        $this->user = User::getUserByToken();
+        $path = request()->getPathInfo();
+        $arr = explode('/', $path);
+        $path = $arr[count($arr)-2].'/'.$arr[count($arr)-1];
+        $map = config('config.no_auth_function_map');
+        $is_exit = true;
+        if (in_array($path, $map)) {
+            $is_exit = false;
+        }
+
+        $this->user = User::getUserByToken($is_exit);
     }
 }

+ 22 - 0
app/Http/Controllers/Api/V1/CommonController.php

xqd xqd xqd
@@ -10,6 +10,7 @@ namespace App\Http\Controllers\Api\V1;
 
 use App\Http\Controllers\Controller;
 use App\Models\Area;
+use App\Models\HelpInfo;
 use App\Models\User;
 use EasyWeChat\Factory;
 use Cache;
@@ -82,6 +83,7 @@ class CommonController extends Controller
 
         $req['token'] = $token;
         $req['id'] = $user['id'];
+        $req['flag'] = 'member_'.$user['id'];
         return out($req);
     }
 
@@ -262,4 +264,24 @@ class CommonController extends Controller
 
         return view('doc', ['data1' => $data1, 'data2' => $data2]);
     }
+
+    public function getHelpList()
+    {
+        $data = HelpInfo::where('status', 1)->orderBy('id', 'desc')->paginate();
+        return out($data);
+    }
+
+    public function configList()
+    {
+        $data = [
+            'banners' => [
+                'https://t5.9026.com/img/banner1.jpg',
+            ],
+            'notices' => [
+                '宝妈小程序正式公测上线啦!',
+            ],
+        ];
+
+        return out($data);
+    }
 }

+ 1 - 3
app/Http/Controllers/Api/V1/DocterController.php

xqd
@@ -93,9 +93,7 @@ class DocterController extends AuthController
         ]);
         $user = $this->user;
 
-        $latitude = !empty($req['latitude']) ? $req['latitude'] : $user['latitude'];
-        $longitude = !empty($req['longitude']) ? $req['longitude'] : $user['longitude'];
-        $distance_field = get_distance_field($latitude, $longitude);
+        $distance_field = get_user_distance_field($user);
 
         $data = Docter::with('office', 'qualification', 'evaluate.user')->select(['id', 'type', 'name', 'phone', 'sex', 'birthday', 'avatar', 'status', 'label', 'sign', 'intro', 'office_id', 'qualification_id', 'score', 'service_persons', 'eva_num', 'service_days', 'phone_minutes', 'chat_price', 'phone_price', 'appoint_price', 'is_chat', 'is_phone', 'is_appoint', 'latitude', 'longitude', DB::raw($distance_field)])->where('id', $req['docter_id'])->where('status', 1)->first()->toArray();
 

+ 30 - 0
app/Http/Controllers/Api/V1/FeedbackController.php

xqd
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: zilongs
+ * Date: 20-11-4
+ * Time: 下午4:29
+ */
+
+namespace App\Http\Controllers\Api\V1;
+
+use App\Models\Feedback;
+
+class FeedbackController extends AuthController
+{
+    public function sumitFeedback()
+    {
+        $req = request()->post();
+        $this->validate(request(), [
+            'content|反馈内容' => 'required|max:500'
+        ]);
+        $user = $this->user;
+
+        Feedback::create([
+            'user_id' => $user['id'],
+            'content' => $req['content'],
+        ]);
+
+        return out();
+    }
+}

+ 53 - 12
app/Http/Controllers/Api/V1/OrderController.php

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -44,8 +44,13 @@ class OrderController extends AuthController
         ]);
         $user = $this->user;
 
-        if (sha1(md5($req['pay_password'])) !== $user['pay_password']) {
-            return out(null, 10001, '密码错误');
+        if (!empty($req['pay_password'])) {
+            if (empty($user['pay_password'])) {
+                return out(null, 60010, '未设置支付密码');
+            }
+            if (sha1(md5($req['pay_password'])) !== $user['pay_password']) {
+                return out(null, 10001, '密码错误');
+            }
         }
 
         $discount_amount = 0;
@@ -89,7 +94,7 @@ class OrderController extends AuthController
             $order_sn = build_sn($order['id']);
             Order::where('id', $order['id'])->update(['order_sn' => $order_sn]);
             //保存订单患者信息
-            $addPatient = Patient::select(['name', 'sex', 'avatar', 'birthday', 'relationship_type', 'info', 'card_type', 'card_number'])->where('id', $req['patient_id'])->first()->getOriginal();
+            $addPatient = Patient::select(['name', 'sex', 'avatar', 'birthday', 'relationship_type', 'info', 'card_type', 'card_number', 'card_img_url', 'card_back_img_url'])->where('id', $req['patient_id'])->first()->getOriginal();
             $addPatient['order_id'] = $order['id'];
             $addPatient['patient_id'] = $req['patient_id'];
             if ($req['product_type'] == 1) {
@@ -139,6 +144,8 @@ class OrderController extends AuthController
                     //改变用户余额
                     $change_amount = 0 - $payment_amount;
                     User::changeBalance($user['id'], $change_amount, 1, $order['id'], '咨询订单消费');
+
+                    Order::payCompletedHandle($order['id']);
                 }
             }
 
@@ -170,8 +177,13 @@ class OrderController extends AuthController
         ]);
         $user = $this->user;
 
-        if (sha1(md5($req['pay_password'])) !== $user['pay_password']) {
-            return out(null, 10001, '密码错误');
+        if (!empty($req['pay_password'])) {
+            if (empty($user['pay_password'])) {
+                return out(null, 60010, '未设置支付密码');
+            }
+            if (sha1(md5($req['pay_password'])) !== $user['pay_password']) {
+                return out(null, 10001, '密码错误');
+            }
         }
 
         $product_type = $req['product_type'];
@@ -228,7 +240,7 @@ class OrderController extends AuthController
             $order_sn = build_sn($order['id']);
             Order::where('id', $order['id'])->update(['order_sn' => $order_sn]);
             //保存订单患者信息
-            $addPatient = Patient::select(['name', 'sex', 'avatar', 'birthday', 'relationship_type', 'info', 'card_type', 'card_number'])->where('id', $req['patient_id'])->first()->getOriginal();
+            $addPatient = Patient::select(['name', 'sex', 'avatar', 'birthday', 'relationship_type', 'info', 'card_type', 'card_number', 'card_img_url', 'card_back_img_url'])->where('id', $req['patient_id'])->first()->getOriginal();
             $addPatient['order_id'] = $order['id'];
             $addPatient['patient_id'] = $req['patient_id'];
             $addPatient['organization_id'] = $req['organization_id'];
@@ -292,6 +304,8 @@ class OrderController extends AuthController
                     //改变用户余额
                     $change_amount = 0 - $payment_amount;
                     User::changeBalance($user['id'], $change_amount, 1, $order['id'], '预约订单消费');
+
+                    Order::payCompletedHandle($order['id']);
                 }
             }
 
@@ -320,8 +334,13 @@ class OrderController extends AuthController
         ]);
         $user = $this->user;
 
-        if (sha1(md5($req['pay_password'])) !== $user['pay_password']) {
-            return out(null, 10001, '密码错误');
+        if (!empty($req['pay_password'])) {
+            if (empty($user['pay_password'])) {
+                return out(null, 60010, '未设置支付密码');
+            }
+            if (sha1(md5($req['pay_password'])) !== $user['pay_password']) {
+                return out(null, 10001, '密码错误');
+            }
         }
 
         $discount_amount = 0;
@@ -329,6 +348,12 @@ class OrderController extends AuthController
             //计算优惠金额
             $discount_amount = UserCoupon::getDiscountAmount($req['user_coupon_id'], $user['id'], $req['total_amount'], 6);
         }
+
+        $addPatient = Patient::select(['name', 'sex', 'avatar', 'birthday', 'relationship_type', 'info', 'card_type', 'card_number', 'card_img_url', 'card_back_img_url'])->where('id', $req['patient_id'])->first()->getOriginal();
+        if (empty($addPatient['card_img_url'])) {
+            return out(null, 70011, '该患者未上传身份证');
+        }
+
         $payment_amount = $req['total_amount'] - $discount_amount;
         $payment_amount = $payment_amount < 0 ? 0 : $payment_amount;
 
@@ -365,12 +390,11 @@ class OrderController extends AuthController
             $order_sn = build_sn($order['id']);
             Order::where('id', $order['id'])->update(['order_sn' => $order_sn]);
             //保存订单患者信息
-            $addPatient = Patient::select(['name', 'sex', 'avatar', 'birthday', 'relationship_type', 'info', 'card_type', 'card_number'])->where('id', $req['patient_id'])->first()->getOriginal();
             $addPatient['order_id'] = $order['id'];
             $addPatient['patient_id'] = $req['patient_id'];
             OrderPatient::create($addPatient);
             //保存订单服务包表
-            $addPack = ServicePack::select(['id as service_pack_id', 'name as pack_name', 'intro as pack_intro', 'price as pack_price', 'insurance_policy', 'team_id', 'phone_minutes', 'chat_num', 'appoint_num', 'vaccine_limit_amount', 'nurses_limit_amount', 'effective_days'])->where('id', $req['service_pack_id'])->first()->getOriginal();
+            $addPack = ServicePack::select(['id as service_pack_id', 'name as pack_name', 'intro as pack_intro', 'price as pack_price', 'insurance_policy', 'insurance_img_url', 'team_id', 'phone_minutes', 'chat_num', 'appoint_num', 'vaccine_limit_amount', 'nurses_limit_amount', 'effective_days'])->where('id', $req['service_pack_id'])->first()->getOriginal();
             $addPack['order_id'] = $order['id'];
             $addPack['is_security'] = $req['is_security'];
             $addPack['guardian_name'] = $req['guardian_name'];
@@ -416,6 +440,8 @@ class OrderController extends AuthController
                     //改变用户余额
                     $change_amount = 0 - $payment_amount;
                     User::changeBalance($user['id'], $change_amount, 1, $order['id'], '购买服务包');
+
+                    Order::payCompletedHandle($order['id']);
                 }
             }
 
@@ -435,7 +461,8 @@ class OrderController extends AuthController
             'list_type' => 'required|in:0,1,2',
             'product_type' => 'integer',
             'order_status' => 'integer',
-            'time_sort' => 'in:0,1'
+            'time_sort' => 'in:0,1',
+            'is_pack_expire' => 'in:0,1,2',
         ]);
         $user = $this->user;
 
@@ -452,10 +479,24 @@ class OrderController extends AuthController
                     $builder->whereIn('product_type', [3,4,5]);
                 }
             }
+            else {
+                $builder->where('product_type', '<', 7);
+            }
         }
         if (!empty($req['order_status'])) {
             $builder->where('order_status', $req['order_status']);
         }
+        if (!empty($req['is_pack_expire'])) {
+            $tmpBuilder  = OrderPack::join('orders as o', 'o.id', '=', 'order_packs.order_id')->where('o.user_id', $user['id']);
+            if ($req['is_pack_expire'] == 1) {
+                $tmpBuilder->where('order_packs.end_time', '<', time());
+            }
+            else {
+                $tmpBuilder->where('order_packs.end_time', '>=', time());
+            }
+            $order_ids = $tmpBuilder->pluck('o.id')->toArray();
+            $builder->whereIn('id', $order_ids);
+        }
         if (!empty($req['time_sort'])) {
             $builder->orderBy('id', 'desc');
         }
@@ -476,7 +517,7 @@ class OrderController extends AuthController
         ]);
         $user = $this->user;
 
-        $data = Order::with(['docter.office', 'docter.qualification', 'orderPatient', 'orderPack', 'orderNurse', 'orderVaccine', 'organization.docter'])->where('id', $req['order_id'])->where('user_id', $user['id'])->first();
+        $data = Order::with(['docter.office', 'docter.qualification', 'orderPatient', 'orderPack.team.docter', 'orderNurse', 'orderVaccine', 'organization.docter'])->where('id', $req['order_id'])->where('user_id', $user['id'])->first();
 
         return out($data);
     }

+ 7 - 1
app/Http/Controllers/Api/V1/OrganizationController.php

xqd
@@ -16,15 +16,21 @@ class OrganizationController extends AuthController
 {
     public function organizationList()
     {
+        $req = request()->post();
         $this->validate(request(), [
             'latitude' => 'numeric',
             'longitude' => 'numeric',
+            'city_id' => 'integer',
         ]);
         $user = $this->user;
 
         $distance_field = get_user_distance_field($user);
 
-        $data = Organization::with('docter')->select(['id', 'type', 'name', 'province_id', 'city_id', 'area_id', 'address', 'latitude', 'longitude', DB::raw($distance_field)])->orderBy('distance', 'asc')->paginate();
+        $builder = Organization::with('docter')->select(['id', 'type', 'name', 'province_id', 'city_id', 'area_id', 'address', 'latitude', 'longitude', DB::raw($distance_field)]);
+        if (!empty($req['city_id'])) {
+            $builder->where('city_id', $req['city_id']);
+        }
+        $data = $builder->orderBy('distance', 'asc')->paginate();
 
         return out($data);
     }

+ 42 - 3
app/Http/Controllers/Api/V1/PatientController.php

xqd xqd xqd
@@ -23,8 +23,8 @@ class PatientController extends AuthController
             'birthday' => 'required|date',
             'relationship_type' => 'required|integer',
             'info' => 'max:1000',
-            'card_type' => 'required|in:1,2',
-            'card_number' => 'required|max:50',
+            'card_type' => 'in:0,1,2',
+            'card_number' => 'max:50',
         ]);
         $user = $this->user;
 
@@ -34,10 +34,49 @@ class PatientController extends AuthController
         return out();
     }
 
+    public function updatePatient()
+    {
+        $req = request()->post();
+        $this->validate(request(), [
+            'id' => 'required|integer',
+            'name' => 'required|max:50',
+            'sex' => 'required|in:1,2',
+            'avatar' => 'required|url',
+            'birthday' => 'required|date',
+            'relationship_type' => 'required|integer',
+            'info' => 'max:1000',
+            'card_type' => 'in:0,1,2',
+            'card_number' => 'max:50',
+        ]);
+        $user = $this->user;
+
+        Patient::where('id', $req['id'])->where('user_id', $user['id'])->update($req);
+
+        return out();
+    }
+
+    public function submitCardImg()
+    {
+        $req = request()->post();
+        $this->validate(request(), [
+            'id' => 'required|integer',
+            'card_img_url' => 'required|url',
+            'card_back_img_url' => 'required|url',
+        ]);
+        $user = $this->user;
+
+        Patient::where('id', $req['id'])->where('user_id', $user['id'])->update($req);
+
+        return out();
+    }
+
     public function patientList()
     {
         $user = $this->user;
         $data = Patient::where('user_id', $user['id'])->orderBy('id', 'desc')->paginate();
+        foreach ($data as $k => $v) {
+            $v->append(['order_num', 'pack_docter_num', 'perfectd_degree']);
+        }
         return out($data);
     }
 
@@ -50,7 +89,7 @@ class PatientController extends AuthController
         $user = $this->user;
 
         $data = [];
-        $data['patient'] = Patient::where('id', $req['patient_id'])->where('user_id', $user['id'])->first();
+        $data['patient'] = Patient::where('id', $req['patient_id'])->where('user_id', $user['id'])->first()->append(['order_num', 'pack_docter_num', 'perfectd_degree']);
 
         $data['orders']['cases'] = Order::with(['docter.office', 'docter.qualification', 'organization.docter'])->where('user_id', $user['id'])->where('patient_id', $req['patient_id'])->whereIn('order_status', [2,3])->where('product_type', '<', 6)->orderBy('id', 'desc')->get();
         $data['orders']['service_packs'] = Order::with('orderPack')->where('user_id', $user['id'])->where('patient_id', $req['patient_id'])->whereIn('order_status', [2,3])->where('product_type', 6)->orderBy('id', 'desc')->get();

+ 4 - 2
app/Http/Controllers/Api/V1/PayCallbackController.php

xqd xqd xqd
@@ -44,7 +44,7 @@ class PayCallbackController extends Controller
                     try {
                         //更新payment
                         Payment::where('id', $payment['id'])->update(['online_sn' => $message['transaction_id'], 'status' => 2, 'payment_time' => time()]);
-                        $order = Order::select(['id', 'user_id', 'docter_id', 'product_type', 'payment_amount'])->where('id', $payment['order_id'])->first();
+                        $order = Order::select(['id', 'user_id', 'docter_id', 'product_type', 'payment_amount', 'total_amount'])->where('id', $payment['order_id'])->first();
                         $order_status = 2;
                         if (in_array($order['product_type'], [3,4,5,6])) {
                             $order_status = 3;
@@ -52,7 +52,7 @@ class PayCallbackController extends Controller
                         elseif ($order['product_type'] == 7) {
                             $order_status = 4;
                             //改变用户余额
-                            User::changeBalance($order['user_id'], $order['payment_amount'], 2, $order['id'], '充值');
+                            User::changeBalance($order['user_id'], $order['total_amount'], 2, $order['id'], '充值');
                         }
                         //更新订单
                         Order::where('id', $payment['order_id'])->update([
@@ -66,6 +66,8 @@ class PayCallbackController extends Controller
                             Docter::where('id', $order['docter_id'])->increment('service_persons');
                         }
 
+                        Order::payCompletedHandle($order['id']);
+
                         // 提交事务
                         DB::commit();
                     } catch (\Exception $e) {

+ 5 - 0
app/Http/Controllers/Api/V1/UserController.php

xqd xqd xqd
@@ -104,6 +104,8 @@ class UserController extends AuthController
 
         User::where('id', $user['id'])->update(['pay_password' => sha1(md5($req['pay_password']))]);
 
+        UserMessage::saveMessage($user['id'], 11);
+
         return out();
     }
 
@@ -111,6 +113,7 @@ class UserController extends AuthController
     {
         $user = $this->user;
         $data = UserMessage::where('user_id', $user['id'])->orderBy('id', 'desc')->paginate();
+        UserMessage::where('user_id', $user['id'])->where('status', 1)->update(['status' => 2]);
         return out($data);
     }
 
@@ -146,6 +149,8 @@ class UserController extends AuthController
 
         User::where('id', $user['id'])->update(['phone' => $req['new_phone']]);
 
+        UserMessage::saveMessage($user['id'], 10);
+
         return out();
     }
 }

+ 17 - 0
app/Models/Feedback.php

xqd
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: zilongs
+ * Date: 20-11-4
+ * Time: 下午4:28
+ */
+
+namespace App\Models;
+
+class Feedback extends BaseModel
+{
+    public function getTable()
+    {
+        return 'feedbacks';
+    }
+}

+ 14 - 0
app/Models/HelpInfo.php

xqd
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: zilongs
+ * Date: 20-11-4
+ * Time: 下午5:04
+ */
+
+namespace App\Models;
+
+class HelpInfo extends BaseModel
+{
+
+}

+ 26 - 0
app/Models/Order.php

xqd
@@ -58,4 +58,30 @@ class Order extends BaseModel
     {
         return $this->belongsTo(Organization::class);
     }
+
+    //支付完成的处理方法
+    public static function payCompletedHandle($order_id)
+    {
+        $order = Order::select(['user_id', 'product_type', 'total_amount', 'payment_type', 'payment_amount'])->where('id', $order_id)->first();
+        //发送下单消息
+        if ($order['product_type'] < 6) {
+            $product_type_text = config('config.product_type_map')[$order['product_type']];
+            UserMessage::saveMessage($order['user_id'], 4, $order_id, [$product_type_text]);
+        }
+        elseif ($order['product_type'] == 6) {
+            $orderPack = OrderPack::select(['pack_name', 'end_time'])->where('order_id', $order_id)->first();
+            UserMessage::saveMessage($order['user_id'], 5, $order_id, [$orderPack['pack_name'], date('Y-m-d', $orderPack['end_time'])]);
+        }
+        elseif ($order['product_type'] == 7) {
+            $user = User::select(['balance'])->where('id', $order['user_id'])->first();
+            UserMessage::saveMessage($order['user_id'], 7, $order_id, [round($order['total_amount']/100, 2), round($user['balance']/100, 2)]);
+        }
+        //发送余额付款成功消息
+        if ($order['payment_type'] == 2) {
+            $user = User::select(['balance'])->where('id', $order['user_id'])->first();
+            UserMessage::saveMessage($order['user_id'], 8, $order_id, [round($order['payment_amount']/100, 2), round($user['balance']/100, 2)]);
+        }
+
+        return true;
+    }
 }

+ 4 - 1
app/Models/OrderPack.php

xqd
@@ -10,5 +10,8 @@ namespace App\Models;
 
 class OrderPack extends BaseModel
 {
-
+    public function team()
+    {
+        return $this->belongsTo(Team::class);
+    }
 }

+ 16 - 1
app/Models/Patient.php

xqd
@@ -24,7 +24,22 @@ class Patient extends BaseModel
 
     public function getPackDocterNumAttribute()
     {
-        $team_ids = OrderPack::join('order', 'order.id', '=', 'order_pack.order_id')->where('order.patient_id', $this->id)->where('order.payment_status', 2)->where('order.product_type', 7)->pluck('order_pack.team_id')->toArray();
+        $team_ids = OrderPack::join('orders', 'orders.id', '=', 'order_packs.order_id')->where('orders.patient_id', $this->id)->where('orders.payment_status', 2)->where('orders.product_type', 7)->pluck('order_packs.team_id')->toArray();
         return TeamDocter::whereIn('team_id', $team_ids)->count();
     }
+
+    public function getPerfectdDegreeAttribute()
+    {
+        $field = ['name', 'sex', 'avatar', 'birthday', 'relationship_type', 'card_number'];
+        $total = count($field);
+        $fill = 0;
+        foreach ($field as $k => $v) {
+            if (!empty($this->$v)) {
+                $fill++;
+            }
+        }
+
+        $text = round($fill/$total*100) . '%';
+        return $text;
+    }
 }

+ 2 - 5
app/Models/User.php

xqd xqd
@@ -23,7 +23,7 @@ class User extends BaseModel
         $auth = request()->header('token');
         if (empty($auth)) {
             if (!$is_exit) {
-                return '';
+                return [];
             }
             exit_out(null, 401, '认证失效,请重新登录');
         }
@@ -31,16 +31,13 @@ class User extends BaseModel
         $arr = aes_decrypt($auth);
         if (empty($arr['id'])) {
             if (!$is_exit) {
-                return '';
+                return [];
             }
             exit_out(null, 401, '认证失效,请重新登录');
         }
 
         $user = User::where('id', $arr['id'])->first();
         if (empty($user)){
-            if (!$is_exit) {
-                return '';
-            }
             exit_out(null, 601, '该账号已被删除');
         }
         $user = $user->toArray();

+ 25 - 0
app/Models/UserMessage.php

xqd
@@ -10,5 +10,30 @@ namespace App\Models;
 
 class UserMessage extends BaseModel
 {
+    protected $appends = ['product_type'];
 
+    public static function saveMessage($user_id, $type, $relation_id = 0, $param = [], $content = '')
+    {
+        if (empty($content)) {
+            $content = config('config.user_message_map')[$type] ?? '';
+            $content = vsprintf($content, $param);
+        }
+        UserMessage::create([
+            'user_id' => $user_id,
+            'type' => $type,
+            'relation_id' => $relation_id,
+            'content' => $content,
+        ]);
+
+        return true;
+    }
+
+    public function getProductTypeAttribute()
+    {
+        if (in_array($this->type, [1,2,4,5,6,7,8]) && !empty($this->relation_id)) {
+            return Order::where('id', $this->relation_id)->value('product_type');
+        }
+
+        return 0;
+    }
 }

+ 13 - 0
config/config.php

xqd
@@ -32,4 +32,17 @@ return [
         'verify_template_code' => 'SMS_185242509',
         'sms_verify_code_expire' => 360,
     ],
+
+    'user_message_map' => [
+        4 => '您的%s订单下单成功,已经通知医生(社区医院)(点击查看订单详情)',
+        5 => '您的%s服务包,已经购买成功,有效期为%s(点击查看服务包详情)',
+        6 => '您的%s服务包,已经于%s过期(点击查看服务包详情)',
+        7 => '您已成功充值%s元,账户余额为%s元',
+        8 => '您已成功付款%s元,账户余额为%s元',
+        9 => '您已成功修改密码,重新登录生效',
+        10 => '您已成功修改绑定电话,重新登录生效',
+        11 => '您已成功修改支付密码',
+    ],
+
+    'no_auth_function_map' => ['docter/docterList', 'docter/docterDetail'],
 ];

BIN
public/img/banner1.jpg


+ 150 - 0
resources/lang/zh-CN/validation.php

xqd
@@ -0,0 +1,150 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Validation Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines contain the default error messages used by
+    | the validator class. Some of these rules have multiple versions such
+    | as the size rules. Feel free to tweak each of these messages here.
+    |
+    */
+
+    'accepted'             => ':attribute必须接受',
+    'active_url'           => ':attribute必须是一个合法的 URL',
+    'after'                => ':attribute 必须是 :date 之后的一个日期',
+    'after_or_equal'       => ':attribute 必须是 :date 之后或相同的一个日期',
+    'alpha'                => ':attribute只能包含字母',
+    'alpha_dash'           => ':attribute只能包含字母、数字、中划线或下划线',
+    'alpha_num'            => ':attribute只能包含字母和数字',
+    'array'                => ':attribute必须是一个数组',
+    'before'               => ':attribute 必须是 :date 之前的一个日期',
+    'before_or_equal'      => ':attribute 必须是 :date 之前或相同的一个日期',
+    'between'              => [
+        'numeric' => ':attribute 必须在 :min 到 :max 之间',
+        'file'    => ':attribute 必须在 :min 到 :max KB 之间',
+        'string'  => ':attribute 必须在 :min 到 :max 个字符之间',
+        'array'   => ':attribute 必须在 :min 到 :max 项之间',
+    ],
+    'boolean'              => ':attribute 字符必须是 true 或 false',
+    'confirmed'            => ':attribute 二次确认不匹配',
+    'date'                 => ':attribute 必须是一个合法的日期',
+    'date_format'          => ':attribute 与给定的格式 :format 不符合',
+    'different'            => ':attribute 必须不同于 :other',
+    'digits'               => ':attribute必须是 :digits 位.',
+    'digits_between'       => ':attribute 必须在 :min 和 :max 位之间',
+    'dimensions'           => ':attribute具有无效的图片尺寸',
+    'distinct'             => ':attribute字段具有重复值',
+    'email'                => ':attribute必须是一个合法的电子邮件地址',
+    'exists'               => '选定的 :attribute 是无效的.',
+    'file'                 => ':attribute必须是一个文件',
+    'filled'               => ':attribute是必填的',
+    'image'                => ':attribute必须是 jpeg, png, bmp 或者 gif 格式的图片',
+    'in'                   => '选定的 :attribute 是无效的',
+    'in_array'             => ':attribute 字段不存在于 :other',
+    'integer'              => ':attribute 必须是个整数',
+    'ip'                   => ':attribute必须是一个合法的 IP 地址。',
+    'ipv4'                 => 'The :attribute must be a valid IPv4 address.',
+    'ipv6'                 => 'The :attribute must be a valid IPv6 address.',
+    'json'                 => ':attribute必须是一个合法的 JSON 字符串',
+    'max'                  => [
+        'numeric' => ':attribute 的最大长度为 :max 位',
+        'file'    => ':attribute 的最大为 :max',
+        'string'  => ':attribute 的最大长度为 :max 字符',
+        'array'   => ':attribute 的最大个数为 :max 个.',
+    ],
+    'mimes'                => ':attribute 的文件类型必须是 :values',
+    'mimetypes'            => 'The :attribute must be a file of type: :values.',
+    'min'                  => [
+        'numeric' => ':attribute 的最小长度为 :min 位',
+        'file'    => ':attribute 大小至少为 :min KB',
+        'string'  => ':attribute 的最小长度为 :min 字符',
+        'array'   => ':attribute 至少有 :min 项',
+    ],
+    'not_in'               => '选定的 :attribute 是无效的',
+    'numeric'              => ':attribute 必须是数字',
+    'present'              => ':attribute 必须存在',
+    'regex'                => ':attribute 格式是无效的',
+    'required'             => ':attribute 是必须的',
+    'required_if'          => ':attribute 字段是必须的当 :other 是 :value',
+    'required_unless'      => ':attribute 字段是必须的,除非 :other 是在 :values 中',
+    'required_with'        => ':attribute 字段是必须的当 :values 是存在的',
+    'required_with_all'    => ':attribute 字段是必须的当 :values 是存在的',
+    'required_without'     => ':attribute 字段是必须的当 :values 是不存在的',
+    'required_without_all' => ':attribute 字段是必须的当 没有一个 :values 是存在的',
+    'same'                 => ':attribute和:other必须匹配',
+    'size'                 => [
+        'numeric' => ':attribute 必须是 :size 位',
+        'file'    => ':attribute 必须是 :size KB',
+        'string'  => ':attribute 必须是 :size 个字符',
+        'array'   => ':attribute 必须包括 :size 项',
+    ],
+    'string'               => ':attribute 必须是一个字符串',
+    'timezone'             => ':attribute 必须是个有效的时区.',
+    'unique'               => ':attribute 已存在',
+    'uploaded'             => 'The :attribute failed to upload.',
+    'url'                  => ':attribute 无效的格式',
+    'date_equals' => 'The :attribute must be a date equal to :date.',
+    'ends_with' => 'The :attribute must end with one of the following: :values',
+    'gt' => [
+        'numeric' => 'The :attribute must be greater than :value.',
+        'file' => 'The :attribute must be greater than :value kilobytes.',
+        'string' => 'The :attribute must be greater than :value characters.',
+        'array' => 'The :attribute must have more than :value items.',
+    ],
+    'gte' => [
+        'numeric' => 'The :attribute must be greater than or equal :value.',
+        'file' => 'The :attribute must be greater than or equal :value kilobytes.',
+        'string' => 'The :attribute must be greater than or equal :value characters.',
+        'array' => 'The :attribute must have :value items or more.',
+    ],
+    'lt' => [
+        'numeric' => 'The :attribute must be less than :value.',
+        'file' => 'The :attribute must be less than :value kilobytes.',
+        'string' => 'The :attribute must be less than :value characters.',
+        'array' => 'The :attribute must have less than :value items.',
+    ],
+    'lte' => [
+        'numeric' => 'The :attribute must be less than or equal :value.',
+        'file' => 'The :attribute must be less than or equal :value kilobytes.',
+        'string' => 'The :attribute must be less than or equal :value characters.',
+        'array' => 'The :attribute must not have more than :value items.',
+    ],
+    'not_regex' => 'The :attribute format is invalid.',
+    'starts_with' => 'The :attribute must start with one of the following: :values',
+    'uuid' => 'The :attribute must be a valid UUID.',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Custom Validation Language Lines
+    |--------------------------------------------------------------------------
+    |
+    | Here you may specify custom validation messages for attributes using the
+    | convention "attribute.rule" to name the lines. This makes it quick to
+    | specify a specific custom language line for a given attribute rule.
+    |
+    */
+
+    'custom' => [
+        'attribute-name' => [
+            'rule-name' => 'custom-message',
+        ],
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | Custom Validation Attributes
+    |--------------------------------------------------------------------------
+    |
+    | The following language lines are used to swap our attribute placeholder
+    | with something more reader friendly such as "E-Mail Address" instead
+    | of "email". This simply helps us make our message more expressive.
+    |
+    */
+
+    'attributes' => [],
+
+];