hrjy 2 years ago
parent
commit
7f4a29f047

+ 7 - 0
app/api/controller/diagnosis/DiagnosisOrderController.php

@@ -51,6 +51,13 @@ class DiagnosisOrderController
             ['transfer_address'],
             ['remarks'],
         ]);
+
+        $address = get_address($data['hospital']);
+        if ($data['type'] == 1){
+            if (strstr($data['hospital'], $address['city'])){
+                return app('json')->fail('接送地址和医院不在同一个市');
+            }
+        }
         $price = 0;// 金额
         $ot_price = 0;
         $commission = 0; //佣金

+ 34 - 0
app/api/controller/user/UserBillController.php

@@ -358,4 +358,38 @@ class UserBillController
         return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'integral', ['pm' => $status]));
 
     }
+
+    /**
+     * 积分记录
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function now_money_list(Request $request)
+    {
+        list($page, $limit, $status) = UtilService::getMore([
+            ['page', 0], ['limit', 0], ['pm', 0]
+        ], $request, true);
+        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'now_money', ['pm' => $status]));
+
+    }
+
+    /**
+     * 积分记录
+     * @param Request $request
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function brokerage_list(Request $request)
+    {
+        list($page, $limit, $status) = UtilService::getMore([
+            ['page', 0], ['limit', 0], ['pm', 0]
+        ], $request, true);
+        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'brokerage', ['pm' => $status]));
+
+    }
 }

+ 19 - 0
app/common.php

@@ -605,4 +605,23 @@ if (!function_exists('do_request')) {
 
         }
     }
+
+    /**
+     * 地址
+     * @return mixed
+     */
+    function get_address($address)
+    {
+        $key = '4A5BZ-GV7K4-G2PUH-DIIQJ-CIG6T-CKFT2';
+        $url = 'https://apis.map.qq.com/ws/geocoder/v1/?address='.$address.'&key='.$key;
+        $curl = curl_init();
+        curl_setopt($curl,CURLOPT_TIMEOUT,5000);
+        curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);
+        curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,false);
+        curl_setopt($curl,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']);
+        curl_setopt($curl,CURLOPT_URL,$url);
+        curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
+        $output = json_decode(curl_exec($curl),true);
+        return $output['result']['address_components'];
+    }
 }

+ 59 - 23
app/models/user/UserBill.php

@@ -61,30 +61,66 @@ class UserBill extends BaseModel
      */
     public static function userBillList($uid, $page, $limit, $category = 'integral', $where = [])
     {
-        if ($page) {
-            $list = self::where('uid', $uid)
-                ->where('category', $category)
-                ->field('mark,pm,number,add_time')
-                ->where('status', 1)
-                ->where($where)
-                ->order('add_time DESC')
-                ->page((int)$page, (int)$limit)
-                ->select();
-        } else {
-            $list = self::where('uid', $uid)
-                ->where('category', $category)
-                ->field('mark,pm,number,add_time')
-                ->where('status', 1)
-                ->where($where)
-                ->order('add_time DESC')
-                ->select();
-        }
-        $list = count($list) ? $list->toArray() : [];
-        foreach ($list as &$v) {
-            $v['add_time'] = date('Y/m/d H:i', $v['add_time']);
-            $v['number'] = floatval($v['number']);
+        if ($category == 'brokerage'){
+            if ($page) {
+                $list = self::where('uid', $uid)
+                    ->where('category', 'now_money')
+                    ->where('type', 'in','brokerage,extract')
+                    ->field('mark,pm,number,add_time')
+                    ->where('status', 1)
+                    ->where($where)
+                    ->order('add_time DESC')
+                    ->page((int)$page, (int)$limit)
+                    ->select();
+            } else {
+                $list = self::where('uid', $uid)
+                    ->where('category', 'now_money')
+                    ->where('category', 'in','extract')
+                    ->field('mark,pm,number,add_time')
+                    ->where('status', 1)
+                    ->where($where)
+                    ->order('add_time DESC')
+                    ->select();
+            }
+            $data['zc'] = self::where('uid', $uid)->where('category', 'now_money')->where('type', 'extract')->where('pm', 0)->sum('number');
+            $data['sr'] = self::where('uid', $uid)->where('category', 'now_money')->where('type', 'brokerage')->where('pm', 1)->sum('number');
+            $data['list'] = count($list) ? $list->toArray() : [];
+            foreach ($data['list'] as &$v) {
+                $v['add_time'] = date('Y/m/d H:i', $v['add_time']);
+                $v['number'] = floatval($v['number']);
+            }
+
+        }else{
+            if ($page) {
+                $list = self::where('uid', $uid)
+                    ->where('category', $category)
+                    ->where('type', 'notIn', 'brokerage,extract')
+                    ->field('mark,pm,number,add_time')
+                    ->where('status', 1)
+                    ->where($where)
+                    ->order('add_time DESC')
+                    ->page((int)$page, (int)$limit)
+                    ->select();
+            } else {
+                $list = self::where('uid', $uid)
+                    ->where('category', $category)
+                    ->where('category', 'notIn','extract')
+                    ->field('mark,pm,number,add_time')
+                    ->where('status', 1)
+                    ->where($where)
+                    ->order('add_time DESC')
+                    ->select();
+            }
+            $data['zc'] = self::where('uid', $uid)->where('category', $category)->where('type', 'notIn', 'extract')->where('pm', 0)->sum('number');
+            $data['sr'] = self::where('uid', $uid)->where('category', $category)->where('type', 'notIn', 'brokerage,extract')->where('pm', 1)->sum('number');
+            $data['list'] = count($list) ? $list->toArray() : [];
+            foreach ($data['list'] as &$v) {
+                $v['add_time'] = date('Y/m/d H:i', $v['add_time']);
+                $v['number'] = floatval($v['number']);
+            }
         }
-        return $list;
+
+        return $data;
     }
 
     /**

+ 2 - 0
route/api/route.php

@@ -150,6 +150,8 @@ Route::group(function () {
     Route::get('spread/count/:type', 'user.UserBillController/spread_count')->name('spreadCount');//推广 佣金 3/提现 4 总和
     Route::get('spread/banner', 'user.UserBillController/spread_banner')->name('spreadBanner');//推广分销二维码海报生成
     Route::get('integral/list', 'user.UserBillController/integral_list')->name('integralList');//积分记录
+    Route::get('now_money/list', 'user.UserBillController/now_money_list')->name('now_money_list');//余额记录
+    Route::get('brokerage/list', 'user.UserBillController/brokerage_list')->name('brokerage_list');//佣金记录
     //提现类
     Route::get('extract/bank', 'user.UserExtractController/bank')->name('extractBank');//提现银行/提现最低金额
     Route::post('extract/cash', 'user.UserExtractController/cash')->name('extractCash');//提现申请