橙汁先生 hace 1 año
padre
commit
8edeae811e
Se han modificado 2 ficheros con 113 adiciones y 4 borrados
  1. 100 0
      app/controller/api/store/merchant/Taskordervr.php
  2. 13 4
      route/api.php

+ 100 - 0
app/controller/api/store/merchant/Taskordervr.php

@@ -0,0 +1,100 @@
1
+<?php
2
+namespace app\controller\api\store\merchant;
3
+
4
+use think\App;
5
+use crmeb\basic\BaseController;
6
+use think\facade\Request;
7
+use think\facade\Db;
8
+
9
+class Taskordervr extends BaseController
10
+{
11
+    //获取收款人信息
12
+    public function lst3()
13
+    {
14
+        $phone = input("post.phone");
15
+
16
+        $user_data = Db::name("user")->where("account",$phone)->find();
17
+
18
+        if(empty( $user_data)){
19
+            return json(['code'=>400,'msg'=>'获取失败!','data'=>'']);
20
+        }
21
+
22
+        //付款账号
23
+        $uid = input("post.uid");
24
+        $udata = Db::name("user")->where("uid",$uid)->find();
25
+        if(!empty( $udata)){
26
+            if($user_data['uid'] == $udata['uid']){
27
+                return json(['code'=>400,'msg'=>'禁止付款账号和收款账号为同一人!','data'=>'']);
28
+            }
29
+
30
+        }
31
+
32
+
33
+        $data = [
34
+            'name'=>'',
35
+            'phone'=>''
36
+        ];
37
+
38
+        if(!empty($user_data)){
39
+            $data['phone'] = $user_data['account'];
40
+            $data['name'] = $user_data['nickname'];
41
+        }
42
+
43
+        return json(['code'=>200,'msg'=>'获取成功!','data'=>$data]);
44
+
45
+    }
46
+
47
+    //接收VR和收款人信息
48
+    public function lst4()
49
+    {
50
+
51
+        // return json(['code'=>400,'msg'=>'获取失败!']);
52
+        $phone = input("post.phone");
53
+        $vr = input("post.vr");
54
+        $uid = input("post.uid");
55
+
56
+        if(empty($uid)){
57
+            return json(['code'=>400,'msg'=>'获取用户失败,请重试!']);
58
+        }
59
+
60
+        $udatas = Db::name("user")->where("uid",$uid)->find();
61
+
62
+        if(empty($udatas)){
63
+            return json(['code'=>400,'msg'=>'找不到该用户,请重试!']);
64
+        }
65
+
66
+        $user_data = Db::name("user")->where("account",$phone)->find();
67
+
68
+        if(empty( $user_data)){
69
+            return json(['code'=>400,'msg'=>'获取用户失败,请重试!']);
70
+        }
71
+
72
+
73
+        $yue_vr =  $udatas['vr'] - $vr;
74
+
75
+        if($yue_vr < 0){
76
+            return json(['code'=>400,'msg'=>'VR不足!']);
77
+        }
78
+
79
+        //return json(['code'=>400,'msg'=>$user_data['vr'] + $vr]);
80
+        //支付s账号
81
+        $user_res = Db::name("user")->where("uid",$uid)->update(['vr'=>$yue_vr]);
82
+        //收款账号
83
+        $jieshouuser_res = Db::name("user")->where("account",$phone)->update(['vr'=>$user_data['vr'] + $vr]);
84
+
85
+        if( $user_res){
86
+            return json(['code'=>200,'msg'=>'操作成功!','data'=>$user_res]);
87
+        }
88
+
89
+
90
+
91
+        // 正常处理请求
92
+        $data = input("post.");
93
+        //   $data = [
94
+        //       'name' => '张三',
95
+        //       'age' => 25
96
+        //   ];
97
+
98
+        return json($data);
99
+    }
100
+}

+ 13 - 4
route/api.php

@@ -302,7 +302,7 @@ Route::group('api/', function () {
302 302
             Route::post('get_team_info', 'User/get_team_info');
303 303
             Route::get('get_brokerage_info', 'User/get_brokerage_info');
304 304
             Route::post('transition_vr', 'User/transition_vr');
305
-            
305
+
306 306
             Route::post('get_token_by_phone', 'User/get_token_by_phone');
307 307
 
308 308
             Route::get('hongbao_info','User/hongbao_info');//红包
@@ -736,12 +736,21 @@ Route::group('api/', function () {
736 736
             //定时任务(测试分配逻辑)
737 737
             Route::get('/product1/lst', 'Taskorder/lst');
738 738
 
739
-              //定时任务(测试股权、合伙人分红逻辑)
739
+            //定时任务(测试股权、合伙人分红逻辑)
740
+            Route::get('/product1/lst1', 'Taskorder/lst1');
741
+
742
+            //定时任务(测试股权、合伙人分红逻辑)
740 743
             Route::get('/product1/lst1', 'Taskorder/lst1');
744
+            //联创
745
+            Route::get('/product1/lst2', 'Taskorderlianc/lst2');
746
+            //获取用户名(VR)
747
+            Route::post('/product1/lst3', 'Taskordervr/lst3');
748
+            //转VR
749
+            Route::post('/product1/lst4', 'Taskordervr/lst4');
741 750
 
742 751
         })->prefix('api.store.merchant.');
743 752
 
744
-       
753
+
745 754
 
746 755
         //文章
747 756
         Route::group('article', function () {
@@ -1016,7 +1025,7 @@ Route::group('api/', function () {
1016 1025
     Route::get('su/SuMoney', 'api.store.product.Su/SuMoney');
1017 1026
     Route::get('su/search2', 'api.store.product.Su/search');
1018 1027
     Route::get('su/detail2/:id', 'api.store.product.Su/goodsDetail');
1019
-    
1028
+
1020 1029
 
1021 1030
 
1022 1031
     //云选联盟