Browse Source

Merge branch 'alipay' of ssh://git.web.ximengnaikang.com:2222/yufengjiayun/bike-admin into alipay

zhanghao 4 years ago
parent
commit
dae2dd3617

+ 112 - 112
app/Handlers/ConvertHandler.php

@@ -65,118 +65,118 @@ class ConvertHandler
     }
 
 
-    /**
-     *  判断是否在圈内
-     * @param $point
-     * @param $circles
-     * @return bool|int|string
-     * Author: Mead
-     */
-    function is_point_in_circles($point, $circles)
-    {
-        $id = false;
-        foreach ($circles as $key => $circle) {
-            $distance = $this->distance($point['latitude'], $point['longitude'], $circle['parking_centre']['latitude'], $circle['parking_centre']['longitude']);
-            if ($distance <= $circle['parking_radius']) {
-                $id = $key;
-                break;
-            }
-        }
-        return $id;
-    }
-
-    /**
-     * 计算是否在区域内
-     * @param $point
-     * @param $pts
-     * @return bool|int|string
-     * Author: Mead
-     */
-    function is_point_in_polygons($point, $pts)
-    {
-        $id = false;
-        foreach ($pts as $key => $pt) {
-            $is_ok = $this->is_point_in_polygon_new($point, $pt);
-            if ($is_ok) {
-                $id = $key;
-                break;
-            }
-        }
-        return $id;
-    }
-
-    /**
-     * 判断一个坐标是否在一个多边形内(由多个坐标围成的)
-     * 基本思想是利用射线法,计算射线与多边形各边的交点,如果是偶数,则点在多边形外,否则
-     * 在多边形内。还会考虑一些特殊情况,如点在多边形顶点上,点在多边形边上等特殊情况。
-     *
-     */
-    function is_point_in_polygon_new($point, $pts)
-    {
-        $N = count($pts);
-        $boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
-        $intersectCount = 0;//cross points count of x
-        $precision = 2e-10; //浮点类型计算时候与0比较时候的容差
-        $p1 = 0;//neighbour bound vertices
-        $p2 = 0;
-        $p = $point; //测试点
-
-        $p1 = $pts[0];//left vertex
-
-        for ($i = 1; $i <= $N; ++$i) {//check all rays
-            // dump($p1);
-            if ($p['longitude'] == $p1['longitude'] && $p['latitude'] == $p1['latitude']) {
-                return $boundOrVertex;//p is an vertex
-            }
-
-            $p2 = $pts[$i % $N];//right vertex
-            if ($p['latitude'] < min($p1['latitude'], $p2['latitude']) || $p['latitude'] > max($p1['latitude'], $p2['latitude'])) {//ray is outside of our interests
-                $p1 = $p2;
-                continue;//next ray left point
-            }
-
-            if ($p['latitude'] > min($p1['latitude'], $p2['latitude']) && $p['latitude'] < max($p1['latitude'], $p2['latitude'])) {//ray is crossing over by the algorithm (common part of)
-                if ($p['longitude'] <= max($p1['longitude'], $p2['longitude'])) {//x is before of ray
-                    if ($p1['latitude'] == $p2['latitude'] && $p['longitude'] >= min($p1['longitude'], $p2['longitude'])) {//overlies on a horizontal ray
-                        return $boundOrVertex;
-                    }
-
-                    if ($p1['longitude'] == $p2['longitude']) {//ray is vertical
-                        if ($p1['longitude'] == $p['longitude']) {//overlies on a vertical ray
-                            return $boundOrVertex;
-                        } else {//before ray
-                            ++$intersectCount;
-                        }
-                    } else {//cross point on the left side
-                        $xinters = ($p['latitude'] - $p1['latitude']) * ($p2['longitude'] - $p1['longitude']) / ($p2['latitude'] - $p1['latitude']) + $p1['longitude'];//cross point of longitude
-                        if (abs($p['longitude'] - $xinters) < $precision) {//overlies on a ray
-                            return $boundOrVertex;
-                        }
-
-                        if ($p['longitude'] < $xinters) {//before ray
-                            ++$intersectCount;
-                        }
-                    }
-                }
-            } else {//special case when ray is crossing through the vertex
-                if ($p['latitude'] == $p2['latitude'] && $p['longitude'] <= $p2['longitude']) {//p crossing over p2
-                    $p3 = $pts[($i + 1) % $N]; //next vertex
-                    if ($p['latitude'] >= min($p1['latitude'], $p3['latitude']) && $p['latitude'] <= max($p1['latitude'], $p3['latitude'])) { //p.latitude lies between p1.latitude & p3.latitude
-                        ++$intersectCount;
-                    } else {
-                        $intersectCount += 2;
-                    }
-                }
-            }
-            $p1 = $p2;//next ray left point
-        }
-
-        if ($intersectCount % 2 == 0) {//偶数在多边形外
-            return false;
-        } else { //奇数在多边形内
-            return true;
-        }
-    }
+//    /**
+//     *  判断是否在圈内
+//     * @param $point
+//     * @param $circles
+//     * @return bool|int|string
+//     * Author: Mead
+//     */
+//    function is_point_in_circles($point, $circles)
+//    {
+//        $id = false;
+//        foreach ($circles as $key => $circle) {
+//            $distance = $this->distance($point['latitude'], $point['longitude'], $circle['parking_centre']['latitude'], $circle['parking_centre']['longitude']);
+//            if ($distance <= $circle['parking_radius']) {
+//                $id = $key;
+//                break;
+//            }
+//        }
+//        return $id;
+//    }
+
+//    /**
+//     * 计算是否在区域内
+//     * @param $point
+//     * @param $pts
+//     * @return bool|int|string
+//     * Author: Mead
+//     */
+//    function is_point_in_polygons($point, $pts)
+//    {
+//        $id = false;
+//        foreach ($pts as $key => $pt) {
+//            $is_ok = $this->is_point_in_polygon_new($point, $pt);
+//            if ($is_ok) {
+//                $id = $key;
+//                break;
+//            }
+//        }
+//        return $id;
+//    }
+
+//    /**
+//     * 判断一个坐标是否在一个多边形内(由多个坐标围成的)
+//     * 基本思想是利用射线法,计算射线与多边形各边的交点,如果是偶数,则点在多边形外,否则
+//     * 在多边形内。还会考虑一些特殊情况,如点在多边形顶点上,点在多边形边上等特殊情况。
+//     *
+//     */
+//    function is_point_in_polygon_new($point, $pts)
+//    {
+//        $N = count($pts);
+//        $boundOrVertex = true; //如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
+//        $intersectCount = 0;//cross points count of x
+//        $precision = 2e-10; //浮点类型计算时候与0比较时候的容差
+//        $p1 = 0;//neighbour bound vertices
+//        $p2 = 0;
+//        $p = $point; //测试点
+//
+//        $p1 = $pts[0];//left vertex
+//
+//        for ($i = 1; $i <= $N; ++$i) {//check all rays
+//            // dump($p1);
+//            if ($p['longitude'] == $p1['longitude'] && $p['latitude'] == $p1['latitude']) {
+//                return $boundOrVertex;//p is an vertex
+//            }
+//
+//            $p2 = $pts[$i % $N];//right vertex
+//            if ($p['latitude'] < min($p1['latitude'], $p2['latitude']) || $p['latitude'] > max($p1['latitude'], $p2['latitude'])) {//ray is outside of our interests
+//                $p1 = $p2;
+//                continue;//next ray left point
+//            }
+//
+//            if ($p['latitude'] > min($p1['latitude'], $p2['latitude']) && $p['latitude'] < max($p1['latitude'], $p2['latitude'])) {//ray is crossing over by the algorithm (common part of)
+//                if ($p['longitude'] <= max($p1['longitude'], $p2['longitude'])) {//x is before of ray
+//                    if ($p1['latitude'] == $p2['latitude'] && $p['longitude'] >= min($p1['longitude'], $p2['longitude'])) {//overlies on a horizontal ray
+//                        return $boundOrVertex;
+//                    }
+//
+//                    if ($p1['longitude'] == $p2['longitude']) {//ray is vertical
+//                        if ($p1['longitude'] == $p['longitude']) {//overlies on a vertical ray
+//                            return $boundOrVertex;
+//                        } else {//before ray
+//                            ++$intersectCount;
+//                        }
+//                    } else {//cross point on the left side
+//                        $xinters = ($p['latitude'] - $p1['latitude']) * ($p2['longitude'] - $p1['longitude']) / ($p2['latitude'] - $p1['latitude']) + $p1['longitude'];//cross point of longitude
+//                        if (abs($p['longitude'] - $xinters) < $precision) {//overlies on a ray
+//                            return $boundOrVertex;
+//                        }
+//
+//                        if ($p['longitude'] < $xinters) {//before ray
+//                            ++$intersectCount;
+//                        }
+//                    }
+//                }
+//            } else {//special case when ray is crossing through the vertex
+//                if ($p['latitude'] == $p2['latitude'] && $p['longitude'] <= $p2['longitude']) {//p crossing over p2
+//                    $p3 = $pts[($i + 1) % $N]; //next vertex
+//                    if ($p['latitude'] >= min($p1['latitude'], $p3['latitude']) && $p['latitude'] <= max($p1['latitude'], $p3['latitude'])) { //p.latitude lies between p1.latitude & p3.latitude
+//                        ++$intersectCount;
+//                    } else {
+//                        $intersectCount += 2;
+//                    }
+//                }
+//            }
+//            $p1 = $p2;//next ray left point
+//        }
+//
+//        if ($intersectCount % 2 == 0) {//偶数在多边形外
+//            return false;
+//        } else { //奇数在多边形内
+//            return true;
+//        }
+//    }
 
     /**
      * 判断一个坐标是否在一个多边形内(由多个坐标围成的)

+ 7 - 8
app/Http/Controllers/Admin/BoxBindingController.php

@@ -252,15 +252,14 @@ class BoxBindingController extends Controller
                 ];
 
                 // 限速
-                \App\Handlers\Weikemu\BikeControl::limitSpeed($boxBinding->box_no, \App\Handlers\Weikemu\BikeControl::maxecuspeedToMaxspeedpercent($inputs['maxecuspeed']));
-
+//                \App\Handlers\Weikemu\BikeControl::limitSpeed($boxBinding->box_no, \App\Handlers\Weikemu\BikeControl::maxecuspeedToMaxspeedpercent($inputs['maxecuspeed']));
 
 //                //配置域名
-                $server = explode(':', $inputs['server']);
-
-                if ($inputs['server'] !== $boxBinding->server) {
-                    \App\Handlers\Weikemu\BikeControl::setBoxServerUrl($boxBinding->box_no, $server[0], $server[1]);
-                }
+//                $server = explode(':', $inputs['server']);
+//
+//                if ($inputs['server'] !== $boxBinding->server) {
+//                    \App\Handlers\Weikemu\BikeControl::setBoxServerUrl($boxBinding->box_no, $server[0], $server[1]);
+//                }
 
                 \App\Handlers\Weikemu\BikeControl::setBoxSetting($boxBinding->box_no, $setting);
 
@@ -327,7 +326,7 @@ class BoxBindingController extends Controller
                         'static_position_reporting_interval' => ceil($inputs['pulse'] / 60)
                     ];
 
-                    \App\Handlers\Weikemu\BikeControl::limitSpeed($v->box_no, \App\Handlers\Weikemu\BikeControl::maxecuspeedToMaxspeedpercent($inputs['maxecuspeed']));
+//                    \App\Handlers\Weikemu\BikeControl::limitSpeed($v->box_no, \App\Handlers\Weikemu\BikeControl::maxecuspeedToMaxspeedpercent($inputs['maxecuspeed']));
 //                    sleep(1);
                     \App\Handlers\Weikemu\BikeControl::setBoxSetting($v->box_no, $setting);
 //                    \App\Handlers\Weikemu\BikeControl::setBoxServerUrl($v->box_no, $server[0], $server[1]);

+ 154 - 159
app/Http/Controllers/Admin/OrderController.php

@@ -277,7 +277,6 @@ class OrderController extends Controller
         $user_id = $order->user_id;
         $area_id = $order->area_id;
 
-
         if ($order->status == Order::STATUS_CLOSE_BIKE) {
             $pay_money = bcadd($dispatch_money, $ridding_money, 2) < 0 ? 0 : bcadd($dispatch_money, $ridding_money, 2);
             //1.判断用户钱包余额是否大于支付金额
@@ -287,7 +286,6 @@ class OrderController extends Controller
             $result = bcsub($wallet_money, $pay_money, 2);
             $order->pay_type = Order::PAY_TYPE_ACCOUNT;
 
-
             try {
                 DB::beginTransaction();
                 // 修改调度费  各种费用
@@ -317,12 +315,7 @@ class OrderController extends Controller
                 $orderBikeOperate->is_admin = OrderBikeOperate::IS_ADMIN_YES;
                 $orderBikeOperate->admin_id = Admin::user()->id;
                 $orderBikeOperate->save();
-                $user = User::find($order->user_id);
-                if (!empty($order)) {
-                    Notification::send($user, new OrderNoPayNotification($user, $order));
-                }
                 DB::commit();
-                return $this->ok('费用已调整');
 
             } catch (\Exception $e) {
                 DB::rollBack();
@@ -330,11 +323,17 @@ class OrderController extends Controller
                 return $this->error('操作失败请联系管理员');
             }
 
+            $user = User::find($order->user_id);
+            if (!empty($order)) {
+                Notification::send($user, new OrderNoPayNotification($user, $order));
+            }
+
+            return $this->ok('费用已调整');
+
         } else {
             return $this->error('车辆未关锁,请刷新后重试');
         }
 
-
     }
 
     /**
@@ -388,166 +387,162 @@ class OrderController extends Controller
         DB::beginTransaction();
         try {
 
-        $old_pay_money = $order->pay_money;
-        //1.更新订单
-        $order->dispatch_money = bcsub($dispatch_money, $return_dispatch_money, 2);
-        $order->time_money = bcsub($time_money, $return_ridding_money, 2);
-        $order->pay_money = bcsub($pay_money, $return_money, 2);
-        $order->total_money = bcadd($order->time_money, $order->dispatch_money, 2);
-        $order->is_refund_money = Order::REFUND_MONEY_OK;
-        $res1 = $order->save();
-        OrderBikeOperate::logs(
-            OrderBikeOperate::$typeMaps[OrderBikeOperate::TYPE_ADMIN_ORDER_REFUND] . '(' . Admin::user()->name . ')',
-            OrderBikeOperate::TYPE_ADMIN_ORDER_REFUND,
-            $order->bike_id,
-            $order->id,
-            $order->user_id,
-            OrderBikeOperate::IS_ADMIN_YES,
-            Admin::user()->id
-        );
-
-
-        if (!$res1) {
-            DB::rollBack();
-            Log::error('更新订单失败');
-            return $this->error('操作失败请联系管理员');
-        }
-        //2.判断返还类别 更新用户余额 或微信退款
-        if ($return_type === 'wallet') {
-            $return_type_name = '退平台钱包';
-            //3.插入钱包记录
-            $wallet_log = new WalletLog();
-            $wallet_log->name = WalletLog::$typeMaps[WalletLog::TYPE_ADMIN_ADD_TO_WALLET];
-            $wallet_log->type = WalletLog::TYPE_ADMIN_ADD_TO_WALLET;
-            $wallet_log->operate_type = WalletLog::OPERATE_TYPE_ADD;
-            $wallet_log->money = (float)$return_money;
-            $wallet_log->user_id = $user_id;
-            $wallet_log->area_id = $area_id;
-            $wallet_log->log_id = $order_id;
-            $wallet_log->log_type = Order::class;
-            $wallet_log->merchant_id = $order->merchant_id;
-            $res2 = $wallet_log->save();
-            if (!$res2) {
-                DB::rollBack();
-                Log::error('插入钱包记录失败');
-                return $this->error('操作失败请联系管理员');
-            }
-            // 4.退余额
-            $user = User::query()->find($user_id);
-            $wallet_money = $user->wallet_money;
-            $user->wallet_money = (float)$wallet_money + (float)$return_money;
-            $res3 = $user->save();
-            if (!$res3) {
+            $old_pay_money = $order->pay_money;
+            //1.更新订单
+            $order->dispatch_money = bcsub($dispatch_money, $return_dispatch_money, 2);
+            $order->time_money = bcsub($time_money, $return_ridding_money, 2);
+            $order->pay_money = bcsub($pay_money, $return_money, 2);
+            $order->total_money = bcadd($order->time_money, $order->dispatch_money, 2);
+            $order->is_refund_money = Order::REFUND_MONEY_OK;
+            $res1 = $order->save();
+            OrderBikeOperate::logs(
+                OrderBikeOperate::$typeMaps[OrderBikeOperate::TYPE_ADMIN_ORDER_REFUND] . '(' . Admin::user()->name . ')',
+                OrderBikeOperate::TYPE_ADMIN_ORDER_REFUND,
+                $order->bike_id,
+                $order->id,
+                $order->user_id,
+                OrderBikeOperate::IS_ADMIN_YES,
+                Admin::user()->id
+            );
+
+
+            if (!$res1) {
                 DB::rollBack();
-                Log::error('更新用户余额失败');
+                Log::error('更新订单失败');
                 return $this->error('操作失败请联系管理员');
             }
-        } else if ($return_type === 'wechatANDalipay') {
-            $return_type_name = '原路退回';
-            //退微信
-            if ($order->pay_type == Order::PAY_TYPE_ACCOUNT) {
-                DB::rollBack();
-                return $this->error('此订单为余额支付 ');
-            }
-            //插入钱包记录  增加
-            $wallet_log_add = new WalletLog();
-            $wallet_log_add->name = WalletLog::$typeMaps[WalletLog::TYPE_ADD_WECHAT_PAY_ORDER_MONEY];
-            $wallet_log_add->type = WalletLog::TYPE_ADD_WECHAT_PAY_ORDER_MONEY;
-            $wallet_log_add->operate_type = WalletLog::OPERATE_TYPE_ADD;
-            $wallet_log_add->money = (float)$return_money;
-            $wallet_log_add->user_id = $user_id;
-            $wallet_log_add->area_id = $area_id;
-            $wallet_log_add->log_id = $order_id;
-            $wallet_log_add->log_type = Order::class;
-            $wallet_log_add->merchant_id = $order->merchant_id;
-            $wallet_log_add->save();
-
-            //3.插入钱包记录 减少
-            $wallet_log = new WalletLog();
-            $wallet_log->name = WalletLog::$typeMaps[WalletLog::TYPE_SUB_ORDER_MONEY_PAY_WECHAT];
-            $wallet_log->type = WalletLog::TYPE_SUB_ORDER_MONEY_PAY_WECHAT;
-            $wallet_log->operate_type = WalletLog::OPERATE_TYPE_SUB;
-            $wallet_log->money = -(float)$return_money;
-            $wallet_log->user_id = $user_id;
-            $wallet_log->area_id = $area_id;
-            $wallet_log->log_id = $order_id;
-            $wallet_log->status = WalletLog::STATUS_PAUSE;
-            $wallet_log->log_type = Order::class;
-            $wallet_log->merchant_id = $order->merchant_id;
-            $res2 = $wallet_log->save();
-            if (!$res2) {
-                DB::rollBack();
-                Log::error('插入钱包记录失败');
-                return $this->error('操作失败请联系管理员');
-            }
-
-            switch ($order->pay_type) {
-                case Order::PAY_TYPE_WECHAT:
-
-                    //微信退部分钱
-                    $payment = Factory::payment(wechat_pay_config(AdminMerchant::byId($order->merchant_id)));
-                    $refund_no = $order->no;
-                    $result = $payment->refund->byOutTradeNumber($order->no, $refund_no, wechat_fee($old_pay_money), wechat_fee($return_money), [
-                        // 可在此处传入其他参数,详细参数见微信支付文档
-                        'refund_desc' => '退订单支付费用',
-                        'notify_url' => config('bike.app_api_url') . '/api/payments/wechat-refund-notify/' . $order->merchant_id,
-                    ]);
+            //2.判断返还类别 更新用户余额 或微信退款
+            if ($return_type === 'wallet') {
+                $return_type_name = '退平台钱包';
+                //3.插入钱包记录
+                $wallet_log = new WalletLog();
+                $wallet_log->name = WalletLog::$typeMaps[WalletLog::TYPE_ADMIN_ADD_TO_WALLET];
+                $wallet_log->type = WalletLog::TYPE_ADMIN_ADD_TO_WALLET;
+                $wallet_log->operate_type = WalletLog::OPERATE_TYPE_ADD;
+                $wallet_log->money = (float)$return_money;
+                $wallet_log->user_id = $user_id;
+                $wallet_log->area_id = $area_id;
+                $wallet_log->log_id = $order_id;
+                $wallet_log->log_type = Order::class;
+                $wallet_log->merchant_id = $order->merchant_id;
+                $res2 = $wallet_log->save();
+                if (!$res2) {
+                    DB::rollBack();
+                    Log::error('插入钱包记录失败');
+                    return $this->error('操作失败请联系管理员');
+                }
+                // 4.退余额
+                $user = User::query()->find($user_id);
+                $wallet_money = $user->wallet_money;
+                $user->wallet_money = (float)$wallet_money + (float)$return_money;
+                $res3 = $user->save();
+                if (!$res3) {
+                    DB::rollBack();
+                    Log::error('更新用户余额失败');
+                    return $this->error('操作失败请联系管理员');
+                }
+            } else if ($return_type === 'wechatANDalipay') {
+                $return_type_name = '原路退回';
+                //退微信
+                if ($order->pay_type == Order::PAY_TYPE_ACCOUNT) {
+                    DB::rollBack();
+                    return $this->error('此订单为余额支付 ');
+                }
+                //插入钱包记录  增加
+                $wallet_log_add = new WalletLog();
+                $wallet_log_add->name = WalletLog::$typeMaps[WalletLog::TYPE_ADD_WECHAT_PAY_ORDER_MONEY];
+                $wallet_log_add->type = WalletLog::TYPE_ADD_WECHAT_PAY_ORDER_MONEY;
+                $wallet_log_add->operate_type = WalletLog::OPERATE_TYPE_ADD;
+                $wallet_log_add->money = (float)$return_money;
+                $wallet_log_add->user_id = $user_id;
+                $wallet_log_add->area_id = $area_id;
+                $wallet_log_add->log_id = $order_id;
+                $wallet_log_add->log_type = Order::class;
+                $wallet_log_add->merchant_id = $order->merchant_id;
+                $wallet_log_add->save();
+
+                //3.插入钱包记录 减少
+                $wallet_log = new WalletLog();
+                $wallet_log->name = WalletLog::$typeMaps[WalletLog::TYPE_SUB_ORDER_MONEY_PAY_WECHAT];
+                $wallet_log->type = WalletLog::TYPE_SUB_ORDER_MONEY_PAY_WECHAT;
+                $wallet_log->operate_type = WalletLog::OPERATE_TYPE_SUB;
+                $wallet_log->money = -(float)$return_money;
+                $wallet_log->user_id = $user_id;
+                $wallet_log->area_id = $area_id;
+                $wallet_log->log_id = $order_id;
+                $wallet_log->status = WalletLog::STATUS_PAUSE;
+                $wallet_log->log_type = Order::class;
+                $wallet_log->merchant_id = $order->merchant_id;
+                $res2 = $wallet_log->save();
+                if (!$res2) {
+                    DB::rollBack();
+                    Log::error('插入钱包记录失败');
+                    return $this->error('操作失败请联系管理员');
+                }
 
-                    if ($result['return_code'] === 'SUCCESS') {
+                switch ($order->pay_type) {
+                    case Order::PAY_TYPE_WECHAT:
+
+                        //微信退部分钱
+                        $payment = Factory::payment(wechat_pay_config(AdminMerchant::byId($order->merchant_id)));
+                        $refund_no = $order->no;
+                        $result = $payment->refund->byOutTradeNumber($order->no, $refund_no, wechat_fee($old_pay_money), wechat_fee($return_money), [
+                            // 可在此处传入其他参数,详细参数见微信支付文档
+                            'refund_desc' => '退订单支付费用',
+                            'notify_url' => config('bike.app_api_url') . '/api/payments/wechat-refund-notify/' . $order->merchant_id,
+                        ]);
+
+                        if ($result['return_code'] === 'SUCCESS') {
+                            DB::commit();
+                            return $this->ok('退还成功');
+                        } else {
+                            Log::error($result);
+                            Log::error('微信退款接口失败');
+                            DB::commit();
+                            return $this->error('退还失败,请联系管理员');
+                        }
+                        break;
+                    case Order::PAY_TYPE_ALIPAYMINI:
+                        //支付宝退部分钱
                         $user = User::find($order->user_id);
-                        // 返还通知
-                        Notification::send($user, new OrderRefundNotification($user, $order, $return_money, $return_type_name));
-                        DB::commit();
-                        return $this->ok('退还成功');
-                    } else {
-                        Log::error('微信退款接口失败');
-                        DB::commit();
-                        return $this->error('退还失败,请联系管理员');
-                    }
-                    break;
-                case Order::PAY_TYPE_ALIPAYMINI:
-                    //支付宝退部分钱
-                    $user = User::find($order->user_id);
-                    $refund_no = $order->no;
-                    $url = config('systemConfig.api_url') . '/api/common/alipay-refund-little?merchant_id=' . $user->merchant_id . '&no=' . $order->no . '&money=' . $return_money . '&out_request_no=' . $refund_no;
-                    $data = [
-                        'merchant_id' => $user->merchant_id,
-                        'no' => $order->no,
-                        'money' => $return_money,
-                        'out_request_no' => $refund_no
-                    ];
-
-                    $res = curl_request($url, 'get', $data);
-
-                    $res = json_decode($res, true);
-
-                    if ($res['is_refund_status']) {
-                        //返还成功
-                        // 返还通知
-                        Notification::send($user, new OrderRefundNotification($user, $order, $return_money, $return_type_name));
-                        DB::commit();
-                        $order->refund_order_callback();
-                        return $this->ok('退还成功');
-                    } else {
-                        Log::error('支付宝退款接口失败');
-                        DB::commit();
-                        return $this->error('退还失败,请联系管理员');
-                    }
+                        $refund_no = $order->no;
+                        $url = config('systemConfig.api_url') . '/api/common/alipay-refund-little?merchant_id=' . $user->merchant_id . '&no=' . $order->no . '&money=' . $return_money . '&out_request_no=' . $refund_no;
+                        $data = [
+                            'merchant_id' => $user->merchant_id,
+                            'no' => $order->no,
+                            'money' => $return_money,
+                            'out_request_no' => $refund_no
+                        ];
+
+                        $res = curl_request($url, 'get', $data);
+
+                        $res = json_decode($res, true);
+
+                        if ($res['is_refund_status']) {
+                            //返还成功
+                            DB::commit();
+                            $order->refund_order_callback();
+                            return $this->ok('退还成功');
+                        } else {
+                            Log::error('支付宝退款接口失败');
+                            DB::commit();
+                            return $this->error('退还失败,请联系管理员');
+                        }
+
+
+                        break;
+                    default:
+                        DB::rollBack();
+                        return $this->error('返还类型不存在');
+                }
 
 
-                    break;
-                default:
-                    DB::rollBack();
-                    return $this->error('返还类型不存在');
+            } else {
+                DB::rollBack();
+                return $this->error('返还类型错误');
             }
 
-
-        } else {
-            DB::rollBack();
-            return $this->error('返还类型错误');
-        }
-
-        DB::commit();
+            DB::commit();
 
         } catch (\Exception $e) {
             DB::rollBack();

+ 1 - 1
app/Http/Resources/OrderResource.php

@@ -62,7 +62,7 @@ class OrderResource extends JsonResource
         }
 
         $data = [
-            'nickname' => $model->users->nickname ? ($model->users->nickname . "(" . $model->users->truename . ")") : '',
+            'nickname' => $model->users->nickname ? ($model->users->nickname . ($model->users->truename ? "(" . $model->users->truename . ")" : '')) : '',
             'mobile' => $model->users->mobile ?? '',
             'order_id' => $model->id,
             'orders_status' => Order::$statusMaps[$model->status],

+ 3 - 1
app/Models/CardRidingOrder.php

@@ -35,12 +35,14 @@ class CardRidingOrder extends Model
     const PAY_TYPE_ADMIN_GIVE = 3;
     const PAY_TYPE_INVITE_NEW_USER_GIVE = 4;
     const PAY_TYPE_NEW_USER_OVER_AUTH_SERVER_GIVE = 5;
+    const PAY_TYPE_ALIPAYMINI = 6;
     public static $payTypeMaps = [
         self::PAY_TYPE_WECHAT => '微信支付',
         self::PAY_TYPE_ACCOUNT => '余额支付',
         self::PAY_TYPE_ADMIN_GIVE => '后台赠送',
         self::PAY_TYPE_INVITE_NEW_USER_GIVE => '邀请新用户赠送',
-        self::PAY_TYPE_NEW_USER_OVER_AUTH_SERVER_GIVE => '新用户完成实名系统赠送'
+        self::PAY_TYPE_NEW_USER_OVER_AUTH_SERVER_GIVE => '新用户完成实名系统赠送',
+        self::PAY_TYPE_ALIPAYMINI => '支付宝支付'
     ];
 
     const PAY_STATUS_OK = 1;

+ 3 - 1
app/Models/DepositCardOrder.php

@@ -44,11 +44,13 @@ class DepositCardOrder extends Model
     const PAY_TYPE_ACCOUNT = 2;
     const PAY_TYPE_ADMIN_GIVE = 3;
     const PAY_TYPE_INVITE_NEW_USER_GIVE = 4;
+    const PAY_TYPE_ALIPAYMINI = 5;
     public static $payTypeMaps = [
         self::PAY_TYPE_WECHAT => '微信支付',
         self::PAY_TYPE_ACCOUNT => '余额支付',
         self::PAY_TYPE_ADMIN_GIVE => '后台赠送',
-        self::PAY_TYPE_INVITE_NEW_USER_GIVE => '邀请新用户赠送'
+        self::PAY_TYPE_INVITE_NEW_USER_GIVE => '邀请新用户赠送',
+        self::PAY_TYPE_ALIPAYMINI => '支付宝支付',
     ];
 
     const PAY_STATUS_OK = 1;

+ 4 - 1
app/Models/PunishmentOrder.php

@@ -18,10 +18,13 @@ class PunishmentOrder extends Model
     const PAY_TYPE_NO = 0;
     const PAY_TYPE_WECHAT = 1;
     const PAY_TYPE_ACCOUNT = 2;
+    const PAY_TYPE_ALIPAYMINI = 3;
     public static $payTypeMaps = [
         self::PAY_TYPE_NO => '待支付',
         self::PAY_TYPE_WECHAT => '微信支付',
-        self::PAY_TYPE_ACCOUNT => '余额支付'
+        self::PAY_TYPE_ALIPAYMINI => '支付宝支付',
+        self::PAY_TYPE_ACCOUNT => '余额支付',
+
     ];
 
     const PAY_STATUS_OK = 1;

+ 2 - 0
app/Models/RechargeOrder.php

@@ -31,10 +31,12 @@ class RechargeOrder extends Model
     const PAY_TYPE_NO = 0;
     const PAY_TYPE_WECHAT = 1;
     const PAY_TYPE_SYSTERM = 2;
+    const PAY_TYPE_ALIPAYMINI = 3;
     public static $payTypeMaps = [
         self::PAY_TYPE_NO => '待支付',
         self::PAY_TYPE_WECHAT => '微信支付',
         self::PAY_TYPE_SYSTERM => '系统赠送',
+        self::PAY_TYPE_ALIPAYMINI => '支付宝支付',
     ];
 
     /**

+ 11 - 3
app/Models/RefundLog.php

@@ -24,15 +24,23 @@ class RefundLog extends Model
     const PAY_STATUS_OK = 1;
     const PAY_STATUS_NO = 0;
     const PAY_STATUS_ERROR = 2;
+    const PAY_STATUS_WAIT = 3;
+    const PAY_STATUS_ALIPAYMINI_PAY = 4;
     public static $payStatusMaps = [
         self::PAY_STATUS_NO => '已支付',
         self::PAY_STATUS_OK => '未支付',
-        self::PAY_STATUS_ERROR => '退款异常'
+        self::PAY_STATUS_ERROR => '退款异常',
+        self::PAY_STATUS_WAIT => '退款排队中',
+        self::PAY_STATUS_ALIPAYMINI_PAY => '退款方式错误',
     ];
 
-    const PAY_TYPE_WECHAT = 0;
+    const PAY_TYPE_WECHAT = 1;
+    const PAY_TYPE_ALIPAYMINI = 2;
+    const PAY_TYPE_ALIPAYMINI_CREDIT = 3;
     public static $payTypeMaps = [
-        self::PAY_TYPE_WECHAT => '微信支付'
+        self::PAY_TYPE_WECHAT => '微信支付',
+        self::PAY_TYPE_ALIPAYMINI => '支付宝小程序支付',
+        self::PAY_TYPE_ALIPAYMINI_CREDIT => '支付宝免押金支付',
     ];
 
     const REFUND_OK = 1;

+ 3 - 1
app/Models/RentOrder.php

@@ -54,10 +54,12 @@ class RentOrder extends Model
     const PAY_TYPE_NO = 0;
     const PAY_TYPE_WECHAT = 1;
     const PAY_TYPE_ACCOUNT = 2;
+    const PAY_TYPE_ALIPAYMINI = 3;
     public static $payTypeMaps = [
         self::PAY_TYPE_NO => '待支付',
         self::PAY_TYPE_WECHAT => '微信支付',
-        self::PAY_TYPE_ACCOUNT => '余额支付'
+        self::PAY_TYPE_ACCOUNT => '余额支付',
+        self::PAY_TYPE_ALIPAYMINI => '支付宝支付'
     ];
 
     const REFUND_MONEY_OK = 1;

+ 26 - 15
resources/src/views/admin-merchant/Config.vue

@@ -138,24 +138,25 @@
                         ref="form2"
                         :get-data="getData"
                         :form.sync="form"
+                      style="width:50%"
                     >
                     <!--<el-alert
                             title="小程序参数配置"
                             type="success"
                         ></el-alert>-->
-                        <el-form-item label="小程序名称">
+                        <el-form-item label="小程序名称" label-width="25%" >
                             <el-input v-model="form.wxapp_name"></el-input>
                         </el-form-item>
-                        <el-form-item label="平台名称">
+                        <el-form-item label="平台名称" label-width="25%" >
                             <el-input v-model="form.brand"></el-input>
                         </el-form-item>
-                        <el-form-item label="描述">
+                        <el-form-item label="描述" label-width="25%" >
                             <el-input v-model="form.wxapp_desc"></el-input>
                         </el-form-item>
-                        <el-form-item label="微信-appID">
+                        <el-form-item label="微信-appID" label-width="25%" >
                             <el-input v-model="form.wxapp_app_id"></el-input>
                         </el-form-item>
-                        <el-form-item label="微信-小程序AppSecret(密钥)">
+                        <el-form-item label="微信-小程序AppSecret(密钥)" label-width="25%" class="el-form-item__label1">
                             <el-input v-model="form.wxapp_app_secret"></el-input>
                         </el-form-item>
                         <el-form-item
@@ -183,7 +184,9 @@
                                 />
                             </el-upload>
                         </el-form-item>
-                        <el-form-item>
+                        <el-form-item
+                        style="margin-left: 6%;"
+                        >
                             <el-button
                                 type="primary"
                                 size="small"
@@ -299,16 +302,12 @@
                         <el-form-item label="支付宝小程序APPID">
                             <el-input v-model="form.alipaymini_appId"></el-input>
                         </el-form-item>
-                        <el-form-item label="支付宝应用钥">
-                            <el-input v-model="form.alipaymini_merchantPrivateKey"></el-input>
+                        <el-form-item label="支付宝应用钥">
+                            <el-input type="textarea" :rows="12" v-model="form.alipaymini_merchantPrivateKey"></el-input>
                         </el-form-item>
-                        <el-form-item label="支付宝接口内容加密解密AES-">
-                            <el-input v-model="form.alipaymini_aesKey"></el-input>
+                        <el-form-item label="支付宝接口内容加密解密AES" label-width="300">
+                            <el-input v-model="form.alipaymini_aesKey" style="width:30%"></el-input>
                         </el-form-item>
-                        <el-form-item label="支付宝alipay.com控制台账户ID ">
-                            <el-input v-model="form.alipaymini_pid"></el-input>
-                        </el-form-item>
-
 
                         <!--                        <el-form-item label="支付宝公钥证书">-->
                         <!--                            <el-input v-model="form.alipaymini_merchantCertPath"></el-input>-->
@@ -324,6 +323,7 @@
                             label="支付宝支付证书alipayCertPublicKey_RSA2.crt"
                             required
                             prop="pay_cert_path"
+                             label-width="300"
                         >
                             <!--                            支付宝支付证书-->
                             <el-upload
@@ -352,6 +352,8 @@
                             label="支付宝根证书alipayRootCert.crt"
                             required
                             prop="pay_key_path"
+                            label-width="300"
+
                         >
                             <!--                            支付宝根证书-->
                             <el-upload
@@ -378,6 +380,7 @@
                             label="支付宝公钥证书appCertPublicKey_2021002113630150.crt"
                             required
                             prop="pay_key_path"
+                            label-width="auto"
                         >
                             <!--                            支付宝公钥证书-->
                             <el-upload
@@ -400,7 +403,7 @@
                                 >上传文件</el-button>
                             </el-upload>
                         </el-form-item>
-                        <el-form-item>
+                        <el-form-item style="margin-left:40%">
                             <el-button
                                 type="primary"
                                 size="small"
@@ -597,4 +600,12 @@ export default {
     vertical-align: middle;
     width: 40%;
 }
+.lable-left{
+    display: inline-block;
+    vertical-align: middle;
+    widows: 300!important;
+}
+.el-form-item__label1{
+    text-align: left!important;
+}
 </style>

+ 1 - 1
resources/src/views/bikes/BikeContro.vue

@@ -135,7 +135,7 @@
         alt="二维码"
       >
       <div class="bigC">
-        <div class="titleDiv">车辆控制:</div>
+        <div class="titleDiv">车辆控制:</div> 
         <div class="detailDiv">
           <p>
             <el-button type="success" class="btnL" @click="controBike('bell')">寻车</el-button>

File diff suppressed because it is too large
+ 552 - 347
resources/src/views/bikes/Index.vue


+ 1 - 1
resources/src/views/orders/Index.vue

@@ -426,7 +426,7 @@
             选择返还方式:
           </span>
           <el-radio v-model="returnMoneyForm.return_type" label="wallet">平台余额</el-radio>
-          <el-radio v-model="returnMoneyForm.return_type" label="wechatANDalipay">微信</el-radio>
+          <el-radio v-model="returnMoneyForm.return_type" label="wechatANDalipay">微信/支付宝</el-radio>
         </p>
         <p>
           <span>实际支付:</span> <span class="font-span"> {{ pay_money }}</span>

Some files were not shown because too many files changed in this diff