wesmiler 1 year ago
parent
commit
1bbfbedef1

+ 20 - 0
app/Http/Controllers/Api/v1/MerchantController.php

@@ -224,4 +224,24 @@ class MerchantController extends webApp
             return message(MerchantService::make()->getError(),true, $result);
         }
     }
+
+    /**
+     * 退还保证金
+     * @param MemberValidator $validator
+     * @return array
+     */
+    public function rebackDeposit(MemberValidator $validator)
+    {
+        $params = request()->all();
+        $params = $validator->check($params, 'reback_deposit');
+        if (!is_array($params)) {
+            return message($params, false);
+        }
+
+        if(!$result = MerchantService::make()->rebackDeposit($this->userId, $params)){
+            return message(MerchantService::make()->getError(),false);
+        }else{
+            return message(MerchantService::make()->getError(),true);
+        }
+    }
 }

+ 2 - 0
app/Http/Validator/MemberValidator.php

@@ -65,6 +65,7 @@ class MemberValidator extends BaseValidator
         'idcard' => '身份证号码',
         'idcard_front_img' => '身份证正面',
         'idcard_back_img' => '身份证反面',
+        'merch_id' => '商家参数',
     ];
 
     // 当前模型所有验证场景
@@ -85,6 +86,7 @@ class MemberValidator extends BaseValidator
         'withdraw'=> ['money','pay_type'],
         'recharge'=> ['money','pay_type'],
         'deposit'=> ['money','pay_type'],
+        'reback_deposit'=> ['merch_id'],
     ];
 
     /**

+ 95 - 0
app/Services/Api/MerchantService.php

@@ -429,6 +429,9 @@ class MerchantService extends BaseService
                 $meals = $meals? explode('|', $meals) : [];
                 $meals = $meals? $meals : [1000];
                 $info['deposit_meals'] = $meals;
+                $depositTime = ConfigService::make()->getConfigByCode('shop_deposit_time');
+                $depositTime = $depositTime>=0? $depositTime : 0;
+                $info['deposit_time'] = $depositTime;
             }
 
             // 二维码
@@ -1114,4 +1117,96 @@ class MerchantService extends BaseService
         ];
     }
 
+    /**
+     * 退还保证金处理
+     * @param $userId 用户
+     * @param $params
+     * @return bool
+     */
+    public function rebackDeposit($userId, $params)
+    {
+        $merchId = isset($params['id'])? $params['id'] : 0;
+        if($merchId<=0){
+            $this->error = 2039;
+            return false;
+        }
+
+        $info = $this->model->where(['id'=> $merchId,'mark'=>1])
+            ->select(['id','name','mobile','balance','deposit','status'])
+            ->first();
+        $deposit = isset($info['deposit'])? floatval($info['deposit']) : 0;
+        $balance = isset($info['balance'])? floatval($info['balance']) : 0;
+        $status = isset($info['status'])? $info['status'] : 0;
+        if($merchId<=0 || empty($info) || $status != 2){
+            $this->error = 2015;
+            return false;
+        }
+
+        if($deposit<=0){
+            $this->error = 2041;
+            return false;
+        }
+
+        // 时间限制
+        $depositTime = ConfigService::make()->getConfigByCode('shop_deposit_time');
+        $depositTime = $depositTime>=0? $depositTime : 0;
+        $paymentTime = AccountLogModel::where(['merch_id'=> $merchId,'type'=>14,'coin_type'=>1,'status'=>1,'mark'=>1])->orderBy('create_time','desc')->value('create_time');
+        if($depositTime>0 && $paymentTime>0 && $paymentTime + ($depositTime*86400)> time()){
+            $this->error = lang(2040,['time'=> $depositTime]);
+            return false;
+        }
+
+        DB::beginTransaction();
+        // 余额
+        $updateData = ['balance' => DB::raw("balance + {$deposit}"),'deposit'=>0.00, 'update_time' => time()];
+        if(!$this->model->where(['id'=> $merchId])->update($updateData)){
+            DB::rollBack();
+            $this->error = 2042;
+            return false;
+        }
+
+        // 退还记录
+        $data = [
+            'source_order_no'=> '',
+            'user_id'=> $userId,
+            'merch_id'=> $merchId,
+            'type'=> 14,
+            'coin_type'=> 4,
+            'user_type'=> 2,
+            'money'=> -$deposit,
+            'balance'=> $balance,
+            'date'=> date('Y-m-d'),
+            'create_time'=> time(),
+            'update_time'=> time(),
+            'remark'=> '商家保证金退还',
+            'status'=> 1,
+            'mark'=> 1,
+        ];
+
+        if(!$id = AccountLogModel::insertGetId($data)){
+            DB::rollBack();
+            $this->error = 2042;
+            return false;
+        }
+
+        DB::commit();
+
+        $params = [
+            'title' => '商家保证金退还到账通知',
+            'body' => "您的商家保证金申请退还已成功,请点击查看详情",
+            'type' => 3, // 1-公告通知,2-订单通知,3-交易通知,4-其他
+            'content' => [
+                'pay_time' => ['name' => '退还时间', 'text' => date('Y-m-d H:i:s')],
+                'money' => ['name' => '金额', 'text' => $deposit],
+                'balance' => ['name' => '当前余额', 'text' => moneyFormat($balance + $deposit,2)],
+                'status' => ['name' => '状态', 'text' => '已到账'],
+            ],
+            'click_type' => 'payload',
+            'url' => '/pages/account/index?type=3',
+        ];
+
+        PushService::make()->pushMessageByUser($userId, $params, 0);
+        $this->error = 2043;
+        return true;
+    }
 }

+ 4 - 4
app/Services/Api/PaymentService.php

@@ -526,7 +526,7 @@ class PaymentService extends BaseService
             'content' => [
                 'order_no' => ['name' => '订单号', 'text' => $orderInfo['order_no']],
                 'pay_time' => ['name' => '付款时间', 'text' => $orderInfo['pay_time']],
-                'money' => ['name' => '订单金额', 'text' => $orderInfo['pay_money']],
+                'money' => ['name' => '订单金额', 'text' => abs($orderInfo['pay_money'])],
                 'status' => ['name' => '状态', 'text' => '已付款'],
             ],
             'click_type' => 'payload',
@@ -691,8 +691,8 @@ class PaymentService extends BaseService
                                 'name' => ['name' => '商家', 'text' => $name],
                                 'order_no' => ['name' => '订单号', 'text' => $orderInfo['order_no']],
                                 'pay_time' => ['name' => '缴纳时间', 'text' => date('Y-m-d H:i:s')],
-                                'money' => ['name' => '缴纳金额', 'text' => $orderInfo['pay_money']],
-                                'balance' => ['name' => '当前额', 'text' => moneyFormat($balance + $awardMoney,2)],
+                                'money' => ['name' => '缴纳金额', 'text' => abs($orderInfo['pay_money'])],
+                                'balance' => ['name' => '当前额', 'text' => moneyFormat($balance + $awardMoney,2)],
                                 'award' => ['name' => '收益金额', 'text' => $awardMoney],
                                 'status' => ['name' => '状态', 'text' => '已到账'],
                             ],
@@ -714,7 +714,7 @@ class PaymentService extends BaseService
                         'order_no' => ['name' => '订单号', 'text' => $orderInfo['order_no']],
                         'pay_time' => ['name' => '缴纳时间', 'text' => date('Y-m-d H:i:s')],
                         'pay_type' => ['name' => '支付方式', 'text' => $payType==10?'微信支付':'支付宝支付'],
-                        'money' => ['name' => '缴纳金额', 'text' => $orderInfo['pay_money']],
+                        'money' => ['name' => '缴纳金额', 'text' => abs($orderInfo['pay_money'])],
                         'status' => ['name' => '状态', 'text' => '已缴纳'],
                     ],
                     'click_type' => 'payload',

+ 1 - 1
app/Services/Common/MerchantCategoryService.php

@@ -42,7 +42,7 @@ class MerchantCategoryService extends BaseService
         if (isset($data['merch_id'])) {
             $where['merch_id'] = $data['merch_id'];
         }
-        $list = $this->model->where($where)->select("name", "id")->orderBy('id','desc')->get();
+        $list = $this->model->where($where)->whereNotIn('type',[3])->select("name", "id")->orderBy('id','desc')->get();
         return message("操作成功", true, $list);
     }
 

BIN
public/app/dysapp_v1.3.58.apk


File diff suppressed because it is too large
+ 2 - 2
public/dysadm/static/js/13.js


File diff suppressed because it is too large
+ 1 - 1
public/dysadm/static/js/14.js


File diff suppressed because it is too large
+ 2 - 2
public/dysadm/static/js/24.js


File diff suppressed because it is too large
+ 1 - 1
public/dysadm/static/js/51.js


+ 200 - 24
resources/lang/en/api.php

@@ -1,28 +1,204 @@
 <?php
 
 return [
-    '1002'=> 'success',
-    '1003'=> 'failed',
-    '1004'=> 'not login',
-    '1005'=> 'Illegal access',
-    '1006'=> 'Illegal operation',
-    '1007'=> 'Save failed',
-    '1008'=> 'Saved successfully',
-    '1009'=> 'not data',
-    '1010'=> 'Data obtained',
-
-    // 登录注册
-    '2001'=> 'Illegal or nonexistent account',
-    '2002'=> 'Login password error',
-    '2003'=> 'Login failed',
-    '2004'=> 'Login successful',
-    '2005'=> 'Registered account has been used',
-    '2006'=> 'Incorrect verification code',
-    '2007'=> 'Account registration failed',
-    '2008'=> 'Account registration succeeded',
-
-    // 语言设置
-    '2101'=> 'Language parameter error',
-    '2102'=> 'Switch language succeeded',
-    '2103'=> 'Failed to switch languages',
+    '1002' => 'success',
+    '1003' => 'failed',
+    '1004' => 'not login',
+    '1005' => 'Illegal access',
+    '1006' => 'Illegal operation',
+    '1007' => 'Save failed',
+    '1008' => 'Saved successfully',
+    '1009' => 'not data',
+    '1010' => 'Data obtained',
+    '1011' => 'Verification code sent successfully',
+    '1012' => 'Request timeout',
+    '1013' => 'Modified successfully',
+    '1014' => 'Modification failed',
+    '1015' => 'has been updated',
+    '1016' => 'Update failed',
+    '1017' => 'Update successful',
+    '1018' => 'Request failed, server error',
+    '1019' => 'Set successfully',
+    '1020' => 'Setting failed',
+    '1021' => 'Parameter type error',
+    '1022' => 'Parameter value error',
+    '1023' => 'Successfully published',
+    '1024' => 'Publishing failed',
+    '1025' => 'Delete successful',
+    '1026' => 'Delete failed',
+    '1027' => 'Successfully added',
+    '1028' => 'Add failed',
+    '1029' => 'Insufficient balance, please recharge first',
+    '1030' => 'Payment method not supported',
+    '1031' => 'Type error',
+    '1032' => 'Single page article ID not configured',
+    '1033' => 'Please select operational data',
+    '1034' => 'Please do not operate frequently, try again later',
+    '1035' => 'Submitted successfully',
+    '1036' => 'Submission failed',
+    '1037' => 'Operation data does not exist',
+    '1038' => 'Payment password error',
+    '1039' => 'Please set the payment password first',
+    '1040' => 'Audit successful',
+    '1041' => 'Audit failed',
+    '1042' => "Please set the merchant's transaction password first",
+    '1043' => 'Merchant transaction password error',
+    '1044' => 'Old phone verification code error',
+
+    //Login registration
+    '2001' => 'Illegal or non-existent account',
+    '2002' => 'Login password error',
+    '2003' => 'Login failed',
+    '2004' => 'Login successful',
+    '2005' => 'Account has been used',
+    '2006' => 'Incorrect verification code',
+    '2007' => 'Registration failed',
+    '2008' => 'Registration successful',
+    '2009' => 'The phone number has been used',
+    '2010' => 'SMS verification code sending failed',
+    '2011' => 'The SMS verification code is sent frequently, please try again in 60 seconds',
+    '2012' => 'The SMS verification code has expired',
+    '2013' => 'SMS verification code error',
+    '2014' => 'Missing parameter',
+    '2015' => 'The account has been frozen, please contact customer service',
+    '2016' => 'WeChat authorization failed',
+    '2017' => 'The account may have been frozen, please try again later or contact customer service',
+    '2018' => 'Merchant account not available, please contact customer service',
+    '2019' => 'SMS interface parameters not configured',
+    '2020' => 'SMS verification code sent successfully',
+    '2021' => 'SMS verification code sending failed',
+    '2022' => 'Registration successful, please download and install the app before logging in and using it',
+    "2023" => "You have registered, please download and install the app before logging in and using it.",
+    '2024' => 'Your account may have been frozen, please contact customer service',
+    '2025' => 'The receiving account does not exist or has been frozen. Please contact customer service',
+    '2026' => 'Your account balance is insufficient. Please recharge or refresh first and then try again',
+    '2027' => "Your balance at the merchant is insufficient. Please recharge or refresh first and then try again.",
+    '2028' => 'Account processing failed, please refresh and try again',
+    '2029' => 'Account details processing failed, please refresh and try again',
+    '2030' => 'Transfer successful',
+    '2031' => 'Please select or fill in the recharge amount first',
+    '2032' => 'Please select the recharge payment method first',
+    '2033' => 'Recharge order submission failed',
+    '2034' => 'Recharge order submitted successfully, initiate payment',
+    '2035' => 'Sorry, your account has not been verified by real name authentication. Please verify your account first before proceeding',
+    '2036' => 'Identity authentication has been submitted, please be patient and wait for review',
+    '2037' => 'Deposit payment order submission failed',
+    '2038' => 'Deposit payment order submitted successfully',
+    '2039' => 'Merchant parameter error',
+    '2040' => 'Sorry, the deposit you paid can only be refunded after :time',
+    '2041' => 'Sorry, you currently do not have a refundable deposit',
+    '2042' => 'Deposit refund application failed',
+    '2043' => 'Deposit refund application successful',
+
+    //Language settings
+    '2101' => 'Language parameter error',
+    '2102' => 'Language switch successful',
+    '2103' => 'Language switching failed',
+
+    //Merchants
+    '2201' => 'You have already joined a merchant',
+    '2202' => 'You have already joined a merchant, but it has been frozen for use',
+    '2203' => 'Sorry, the currently selected entry category is not yet open',
+    '2204' => 'Please upload the merchant logo',
+    '2205' => "Please upload the merchant's WeChat or Alipay collection QR code",
+    '2206' => 'Please upload the enterprise business license and special industry license',
+    '2207' => 'Please upload various health and service related certificates',
+    '2208' => "The front and back of the legal person's ID card",
+    '2209' => 'Front and back of personal ID card',
+    '2210' => 'Please select your merchant address location information',
+    '2211' => 'Please upload your professional certificate and qualification certificate',
+    '2213' => "The merchant's application for entry has been successful, please be patient and wait for the review",
+    '2214' => "The merchant's entry application has failed, please return and try again",
+    "2215" => "The merchant has successfully registered and continued to submit. Please be patient and wait for the review. ",
+    '2216' => 'The merchant has not been registered or does not exist. Please return and try again',
+    '2217' => 'Please upload various service related documents',
+    '2218' => 'Please fill in the job number',
+    '2219' => 'Job number already exists',
+    '2220' => 'The merchant who has settled in does not exist or cannot be operated',
+    '2221' => 'Please upload the front of your ID card',
+    '2222' => 'Please upload the back of your ID card',
+    '2223' => 'Technicians have successfully applied for residency, please be patient and wait for the review',
+    '2224' => 'Technicians have successfully joined and continued to submit. Please be patient and wait for the review',
+    '2225' => "Technician's application for entry has failed, please return and try again",
+    '2226' => 'You have already joined a company',
+    '2227' => 'Please select the merchant to join, or return and try again',
+    '2228' => 'Successfully modified merchant information, please wait for re review',
+    '2229' => 'Failed to modify merchant information',
+    '2230' => 'The merchant information does not exist or has been deleted',
+    '2231' => "The merchant's information has been reviewed",
+    '2232' => 'Please select the approval status',
+    '2233' => 'Audit successful',
+    '2234' => 'The merchant has not been approved and cannot be operated',
+    '2235' => 'Order processed',
+    '2236' => 'Successfully deleted order',
+    '2237' => 'Delete order failed',
+    //Agent
+    '2301' => 'You are already an agent',
+    '2302' => 'You have joined the agent but have been frozen for use',
+    '2303' => 'Sorry, the agent in :city area has already been settled',
+    '2304' => 'The application :city regional agent registration has been successful. Please be patient and wait for the review.',
+    '2305' => 'The application :city regional agent enrollment has failed, please return and try again',
+
+    //Technician
+    '2351' => 'Please select the service items provided by the technician',
+    '2352' => 'Audit status parameter error',
+    '2353' => 'The technician has unsettled commissions, please wait for the settlement to be completed before proceeding',
+    '2354' => 'You have unsettled commissions, please wait for the settlement to be completed before proceeding',
+    '2355' => 'The commission ratio for this technician is set incorrectly and should not be between 0-100',
+    '2356' => "The technician's work status cannot be changed due to unfinished orders",
+
+//Chat
+    '2401' => 'The user does not exist or has been frozen. Please contact customer service',
+    '2402' => 'Payment parameter error',
+    '2403' => 'Account balance is insufficient, please recharge first',
+    '2404' => 'Balance payment failed',
+    '2405' => 'Balance payment processing failed',
+    '2406' => 'Recharge purchase failed, please return and try again',
+    '2407' => 'Recharged and purchased successfully',
+    '2420' => 'Please bind my payment method with a WeChat payment code first',
+    '2421' => 'Please bind Alipay collection code to my collection method',
+    '2422' => 'Please bind my payment method to a bank card first',
+    '2423' => 'Withdrawal account processing failed',
+    '2424' => 'Withdrawal successful, please be patient and wait for the review and payment to be made',
+    '2425' => 'Please choose the withdrawal and payment method',
+
+    //Dynamic
+    '2501' => 'Parameter error',
+    '2502' => 'Posting content is illegal, please speak in a civilized manner',
+
+    //Product
+    '2541' => 'There are products under this category, please delete the products first',
+    '2542' => 'The product has been taken down',
+
+    //Order
+    '2601' => 'Please select your home/shipping address',
+    '2602' => 'The current technician is unable to provide services',
+    '2603' => 'Technicians do not provide this service',
+    '2604' => 'The current technician is taking the order, please try again later',
+    '2605' => 'Failed to create order',
+    '2606' => 'Order item processing failed',
+    '2607' => 'Order balance payment successful',
+    '2608' => 'Order created successfully, please make payment',
+    '2609' => 'Order balance payment failed',
+    '2610' => 'Order balance payment processing error',
+    '2611' => 'Order balance payment processed successfully',
+    '2612' => 'You have already made an appointment for this technician. Please complete it before making an appointment or replacing the technician',
+    '2613' => 'Coupon usage error',
+    '2614' => 'Order payment amount error',
+    '2615' => 'Coupon usage error',
+    '2616' => 'WeChat payment parameters not configured',
+    '2617' => 'WeChat payment successfully called',
+    '2618' => 'WeChat payment call failed',
+    '2619' => 'Alipay payment parameters are not configured',
+    '2620' => 'Alipay payment is called successfully',
+    '2621' => 'Alipay payment call failed',
+    '2622' => 'Payment callback status unsuccessful',
+    '2623' => 'Payment callback order parameter error',
+    '2624' => 'Payment callback payment amount error',
+    '2625' => 'Payment request information error',
+    '2626' => 'Order paid',
+    '2627' => 'Order callback payment type inconsistent',
+    '2628' => 'Order payment amount error',
+    '2629' => 'Payment order does not exist',
+    '2630' => 'Payment order processed',
 ];

+ 5 - 0
resources/lang/zh-cn/api.php

@@ -85,6 +85,11 @@ return [
     '2036'=> '身份认证已提交,请耐心等候审核',
     '2037'=> '保证金支付订单提交失败',
     '2038'=> '保证金支付订单提交成功',
+    '2039'=> '商家参数错误',
+    '2040'=> '抱歉,您缴纳的保证金在:time天后才可申请退还',
+    '2041'=> '抱歉,您暂无可退还的保证金',
+    '2042'=> '保证金退还申请失败',
+    '2043'=> '保证金退还申请成功',
 
 
     // 语言设置

+ 1 - 0
routes/api.php

@@ -114,6 +114,7 @@ Route::prefix('v1')->group(function(){
     Route::post('/merch/index', [\App\Http\Controllers\Api\v1\MerchantController::class, 'index']);
     Route::post('/merch/list', [\App\Http\Controllers\Api\v1\MerchantController::class, 'list']);
     Route::post('/merch/deposit', [\App\Http\Controllers\Api\v1\MerchantController::class, 'deposit']);
+    Route::post('/merch/rebackDeposit', [\App\Http\Controllers\Api\v1\MerchantController::class, 'rebackDeposit']);
 
     // 商家店员
     Route::post('/merch/clerkList', [\App\Http\Controllers\Api\v1\MerchantClerkController::class, 'index']);