Просмотр исходного кода

Merge remote-tracking branch 'origin/dev' into dev

xupuyuan 1 год назад
Родитель
Сommit
9d9c1e04d7

+ 5 - 0
app/common/model/merchant/order/OrderGzc.php

@@ -12,6 +12,7 @@ namespace app\common\model\merchant\order;
12 12
 
13 13
 use app\common\model\BaseModel;
14 14
 use app\common\model\user\User;
15
+use app\common\model\user\UserBill;
15 16
 
16 17
 class OrderGzc extends BaseModel
17 18
 {
@@ -31,4 +32,8 @@ class OrderGzc extends BaseModel
31 32
         return $this->hasOne(User::class, 'uid', 'uid');
32 33
     }
33 34
 
35
+    public function bill()
36
+    {
37
+        return $this->hasOne(UserBill::class, 'bill_id', 'link_id');
38
+    }
34 39
 }

+ 88 - 26
app/common/repositories/merchant/order/OrderGzcRepository.php

@@ -17,6 +17,7 @@ use app\traits\GzcApiRequest;
17 17
 use Carbon\Carbon;
18 18
 use crmeb\services\SpreadsheetExcelService;
19 19
 use FormBuilder\Factory\Elm;
20
+use think\facade\Db;
20 21
 use think\facade\Log;
21 22
 use think\facade\Route;
22 23
 
@@ -50,36 +51,97 @@ class OrderGzcRepository extends BaseRepository
50 51
         // 导出
51 52
         $is_excel = request()->param('is_excel', 0);
52 53
         if ($is_excel == 1) {
53
-            $data = $query->with('user')->select();
54
+            $data = $query->with(['user', 'bill'])->select()->toArray();
55
+
54 56
             $arr = [];
55
-            foreach ($data as $item) {
56
-                $arr[] = [
57
-                    $item['id'],
58
-                    $item['platform_no'],
59
-                    $item['user']['nickname'],
60
-                    $item['user']['account'],
61
-                    $item['user_name'],
62
-                    $item['mobile'],
63
-                    $item['user_card'],
64
-                    $item['bank_name'],
65
-                    $item['branch_name'],
66
-                    $item['bank_account'],
67
-                    $item['bank_no'],
68
-                    $item['alipay_account'],
69
-                    $item['alipay_no'],
70
-                    $item['wxpay_account'],
71
-                    $item['wxpay_no'],
72
-                    $item['out_trade_no'],
73
-                    $item['pension'],
74
-                    $item['gzc'] == 1 ? '已发起' : '待发起',
75
-                    $item['gzc_deposit_no'],
76
-                    $item['gzc_confirm_result'],
77
-                    $item['create_time'],
78
-                    $item['update_time']
57
+            if (!empty($data)) {
58
+                $orderTypeMap = [];
59
+                $orderDetailMap = [];
60
+                $orderMap = [
61
+                    0 => ['table' => 'rrx_store_order', 'name' => '平台订单', 'pk' => 'order_id', 'field' => 'order_id, total_price AS order_money, pay_price AS pay_money, con_pri AS commission, mer_id'],
62
+                    1 => ['table' => 'rrx_order_pdd', 'name' => '拼多多', 'pk' => 'order_pdd_id', 'field' => 'order_pdd_id AS order_id, order_money, pay_money, commission'],
63
+                    2 => ['table' => 'rrx_order_vip', 'name' => '唯品会', 'pk' => 'order_vip_id', 'field' => 'order_vip_id AS order_id, pay_money AS order_money, pay_money, commission'],
64
+                    3 => ['table' => 'rrx_order_su', 'name' => '苏宁', 'pk' => 'order_su_id', 'field' => 'order_su_id AS order_id, total_amount AS order_money, pay_amount AS pay_money, commission'],
65
+                    5 => ['table' => 'rrx_order_tb', 'name' => '淘宝', 'pk' => 'order_tb_id', 'field' => 'order_tb_id AS order_id, alipay_total_price AS order_money, alipay_total_price AS pay_money, commission'],
66
+                    6 => ['table' => 'rrx_order_jd', 'name' => '京东', 'pk' => 'order_jd_id', 'field' => 'order_jd_id AS order_id, pay_money AS order_money, pay_money AS pay_money, commission'],
67
+                    9 => ['table' => 'rrx_order_huafei', 'name' => '话费', 'pk' => 'order_huafei_id', 'field' => 'order_huafei_id AS order_id, pay_money AS order_money, pay_money AS pay_money, commission'],
68
+                    10 => ['table' => 'rrx_order_merchant', 'name' => '线下扫码', 'pk' => 'id', 'field' => 'id AS order_id, money AS order_money, money AS pay_money, available AS commission']
79 69
                 ];
70
+
71
+                foreach ($data as $gzcData) {
72
+                    if (!empty($gzcData['link_id']) && !empty($gzcData['bill'])) {
73
+                        $orderTypeMap[$gzcData['bill']['type_shop']][$gzcData['bill']['link_id']][] = $gzcData['id'];
74
+
75
+                    }
76
+                }
77
+
78
+                if (!empty($orderTypeMap)) {
79
+                    foreach ($orderTypeMap as $orderType => $map) {
80
+                        if (isset($orderMap[$orderType])) {
81
+                            $config = $orderMap[$orderType];
82
+                            $result = Db::table($config['table'])
83
+                                ->whereIn($config['pk'], array_keys($map))
84
+                                ->field($config['field'])
85
+                                ->select()
86
+                                ->toArray();
87
+                            if (!empty($result)) {
88
+                                foreach ($result as $orderData) {
89
+                                    foreach ($map[$orderData['order_id']] as $gzcId) {
90
+                                        if (0 === (int)$orderType && !empty($orderData['mer_id'] ?? '')) {
91
+                                            if ($orderData['mer_id'] == 496) {
92
+                                                $orderData['commission'] = '';
93
+                                                $orderData['source'] = '会员专区';
94
+                                            } else if ($orderData['mer_id'] == 439) {
95
+                                                $orderData['source'] = '精彩生活区';
96
+                                            } else if ($orderData['mer_id'] == 491) {
97
+                                                $orderData['commission'] = '';
98
+                                                $orderData['source'] = '复购区';
99
+                                            } else {
100
+                                                $orderData['source'] = '商贸区';
101
+                                            }
102
+                                        } else {
103
+                                            $orderData['source'] = $orderMap[$orderType]['name'];
104
+                                        }
105
+                                        $orderDetailMap[$gzcId] = $orderData;
106
+                                    }
107
+                                }
108
+                            }
109
+                        }
110
+                    }
111
+                }
112
+
113
+                foreach ($data as $item) {
114
+                    $arr[] = [
115
+                        $item['id'],
116
+                        $item['platform_no'],
117
+                        $item['user']['nickname'],
118
+                        $item['user']['account'],
119
+                        $item['user_name'],
120
+                        $item['mobile'],
121
+                        $item['user_card'],
122
+                        $item['bank_name'],
123
+                        $item['branch_name'],
124
+                        $item['bank_account'],
125
+                        $item['bank_no'],
126
+                        $item['alipay_account'],
127
+                        $item['alipay_no'],
128
+                        $item['wxpay_account'],
129
+                        $item['wxpay_no'],
130
+                        $orderDetailMap[$item['id']]['source'] ?? '',
131
+                        $orderDetailMap[$item['id']]['order_money'] ?? '',
132
+                        $orderDetailMap[$item['id']]['commission'] ?? '',
133
+                        $item['out_trade_no'],
134
+                        $item['pension'],
135
+                        $item['gzc'] == 1 ? '已发起' : '待发起',
136
+                        $item['gzc_deposit_no'],
137
+                        $item['gzc_confirm_result'],
138
+                        $item['create_time'],
139
+                        $item['update_time']
140
+                    ];
141
+                }
80 142
             }
81 143
             return $this->getStatisticsExcel([
82
-                'ID', '平台申请单号', '用户昵称', '用户账号', '实名认证姓名', '实名认证电话', '实名认证证件号', '银行名称', '银行名称', '开户账号', '转账流水号', '支付宝账号', '支付宝流水号', '微信账号', '微信流水号', '关联订单', '养老金', '处理状态', '公证处入账编号', '公证处入账结果', '创建时间', '更新时间'
144
+                'ID', '平台申请单号', '用户昵称', '用户账号', '实名认证姓名', '实名认证电话', '实名认证证件号', '银行名称', '银行名称', '开户账号', '转账流水号', '支付宝账号', '支付宝流水号', '微信账号', '微信流水号', '订单来源', '订单金额', '订单利润', '关联订单', '养老金', '处理状态', '公证处入账编号', '公证处入账结果', '创建时间', '更新时间'
83 145
             ], $arr, '公证处入账明细');
84 146
         }
85 147
 

+ 2 - 2
app/controller/api/Auth.php

@@ -1361,7 +1361,7 @@ class Auth extends BaseController
1361 1361
 
1362 1362
     public function verify(UserAuthValidate $validate)
1363 1363
     {
1364
-        $data = $this->request->params(['phone', 'code', 'key',"type"]);
1364
+        $data = $this->request->params(['phone', 'code', 'key',"type", 'areaCode']);
1365 1365
         $validate->sceneVerify()->check($data);
1366 1366
         log::info("发送短信方法");
1367 1367
         if ($data['type']=="register"){
@@ -1382,7 +1382,7 @@ class Auth extends BaseController
1382 1382
         }
1383 1383
         $sms_code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT);
1384 1384
         $sms_time = systemConfig('sms_time') ? systemConfig('sms_time') : 30 ;
1385
-        $res = app()->make(AliYunSmsService::class)->send($data['phone'],  $sms_code);
1385
+        $res = app()->make(AliYunSmsService::class)->send(($data['areaCode'] ?? '') . $data['phone'],  $sms_code);
1386 1386
         if($res['Code']!='OK'){
1387 1387
             Db::name('log')->insert(['data'=>'幸福保短信发送失败:'.json_encode($res,256)]);
1388 1388
             return app('json')->fail('操作过于频繁,请稍后重试~');

+ 1 - 11
app/controller/api/store/merchant/TaskPartnerProfits.php

@@ -322,17 +322,9 @@ class TaskPartnerProfits
322 322
                 # code...
323 323
                 $allAward = $myWeightMoney + $myMixMoney;
324 324
 
325
-
326 325
                 //90%给佣金,10给复购金
327 326
                 $yj_90 = floor($allAward * 0.9 * 100) / 100;
328 327
                 $fg_10 = floor($allAward * 0.1 * 100) / 100;
329
-                if ($v == 272) {
330
-                    $yj_90 = 462.68;
331
-                    $fg_10 = 51.40;
332
-                } else if ($v == 303) {
333
-                    $yj_90 = 163.74;
334
-                    $fg_10 = 18.19;
335
-                }
336 328
 
337 329
                 //                $yj_90 = bcsub($yj_90, $user_bill_uid_list[$v]['number'] ?? 0.00, 2);
338 330
                 //
@@ -357,9 +349,7 @@ class TaskPartnerProfits
357 349
                     $res = Db::name("user")->where("uid", $v)->inc("total_amount_old", $yj_90)->save();
358 350
 
359 351
                     Db::name("user")->where("uid", $v)->inc("amount_old", $yj_90)->save();//不用冻结金额和提现额度来限制佣金发放
360
-                    if ($v != 272 && $v != 303) {
361
-                        Db::name("user")->where("uid", $v)->inc("brokerage_price", $yj_90)->save();
362
-                    }
352
+                    Db::name("user")->where("uid", $v)->inc("brokerage_price", $yj_90)->save();
363 353
                     Db::name("user")->where("uid", $v)->inc("fugou", $fg_10)->save();
364 354
 
365 355
 

+ 38 - 55
app/controller/api/store/merchant/Taskorderguquan.php

@@ -20,65 +20,60 @@ class Taskorderguquan
20 20
         /**
21 21
         补贴下面人员
22 22
         13231658486周行体1000
23
-        13333069689魏惠新1200
24
-        13959100621周金花700
25
-        13701061395李素红600
26
-        17501006833邢艳丽400
27
-        15631982690魏震洪400
28
-        18603401312黄金花500
29
-        13521438652徐立苹600
30
-        15832971815孟晓玮500
31
-        18600200909陈冠霖500
32
-        13910030010安晓波50
33
-        15810064711 王   玲 600
23
+        13333069689魏惠新1000
24
+        13959100621周金花500
25
+        13701061395李素红500
26
+        17501006833邢艳丽300
27
+        15631982690魏震洪300
28
+        18603401312黄金花400
29
+        13521438652徐立苹400
30
+        15832971815孟晓玮300
31
+        18600200909陈冠霖300
32
+        15810064711 王   玲 400
34 33
         13932925303会强400
35
-        13901074090陈玉刚500
36
-        13381085923王建军100
37
-        13601071082隋彩云500
34
+        13901074090陈玉刚400
35
+        13381085923王建军50
36
+        13601071082隋彩云300
38 37
         18001316701闫旭300
39
-        13601179856陈瑞元100
40
-        13161909228刘银霞200
38
+        13601179856陈瑞元50
39
+        13161909228刘银霞100
41 40
         18760167163刘春梅50
42
-        18911752386魏利琴50
43 41
         13215917919李小秋50
44
-        15321221558李伟100
42
+        15321221558李伟50
45 43
         15332507711张传莲50
46 44
         15960349667吕丽娣50
47
-        18612051372李金俭100
48
-        18715313601大饼500
49
-        其余部分做分红,剩余36364业绩不分
45
+        18612051372李金俭50
46
+        18715313601大饼400
47
+        其余部分做分红
50 48
         */
51 49
         $data = [
52 50
             '13231658486' => 1000,
53
-            '13333069689' => 1200,
54
-            '13959100621' => 700,
55
-            '13701061395' => 600,
56
-            '17501006833' => 400,
57
-            '15631982690' => 400,
58
-            '18603401312' => 500,
59
-            '13521438652' => 600,
60
-            '15832971815' => 500,
61
-            '18600200909' => 500,
62
-            '13910030010' => 50,
63
-            '15810064711' => 600,
51
+            '13333069689' => 1000,
52
+            '13959100621' => 500,
53
+            '13701061395' => 500,
54
+            '17501006833' => 300,
55
+            '15631982690' => 300,
56
+            '18603401312' => 400,
57
+            '13521438652' => 400,
58
+            '15832971815' => 300,
59
+            '18600200909' => 300,
60
+            '15810064711' => 400,
64 61
             '13932925303' => 400,
65
-            '13901074090' => 500,
66
-            '13381085923' => 100,
67
-            '13601071082' => 500,
62
+            '13901074090' => 400,
63
+            '13381085923' => 50,
64
+            '13601071082' => 300,
68 65
             '18001316701' => 300,
69
-            '13601179856' => 100,
70
-            '13161909228' => 200,
66
+            '13601179856' => 50,
67
+            '13161909228' => 100,
71 68
             '18760167163' => 50,
72
-            '18911752386' => 50,
73 69
             '13215917919' => 50,
74
-            '15321221558' => 100,
70
+            '15321221558' => 50,
75 71
             '15332507711' => 50,
76 72
             '15960349667' => 50,
77
-            '18612051372' => 100,
78
-            '18715313601' => 500
73
+            '18612051372' => 50,
74
+            '18715313601' => 400
79 75
         ];
80 76
 
81
-
82 77
         $result = Db::name("user")
83 78
             ->whereIn("account", array_keys($data))
84 79
             ->where('is_del', 0)
@@ -888,16 +883,6 @@ class Taskorderguquan
888 883
 
889 884
                 $yj_90 = $v['getcomm'] * 0.9;
890 885
                 $fg_10 = $v['getcomm'] * 0.1;
891
-                if ($v['user_id'] == 272) {
892
-                    $yj_90 = 10.02;
893
-                    $fg_10 = 1.13;
894
-                } else if ($v['user_id'] == 303) {
895
-                    $yj_90 = 61.18;
896
-                    $fg_10 = 6.80;
897
-                } else if ($v['user_id'] == 558) {
898
-                    $yj_90 = 15.00;
899
-                    $fg_10 = 1.13;
900
-                }
901 886
 
902 887
                 if ($isTest == 0) {
903 888
                     // // 更新 user_stock 表中的记录
@@ -909,9 +894,7 @@ class Taskorderguquan
909 894
 
910 895
                     $res1 = Db::name("user")->where("uid", $v['user_id'])->inc("total_amount_old", $yj_90)->save();
911 896
                     $res2 = Db::name("user")->where("uid", $v['user_id'])->inc("amount_old", $yj_90)->save();
912
-                    if ($v['user_id'] != 272 && $v['user_id'] != 303 && $v['user_id'] != 558) {
913
-                        Db::name("user")->where("uid", $v['user_id'])->inc("brokerage_price", $yj_90)->save();
914
-                    }
897
+                    Db::name("user")->where("uid", $v['user_id'])->inc("brokerage_price", $yj_90)->save();
915 898
                     $res3 = Db::name("user")->where("uid", $v['user_id'])->inc("fugou", $fg_10)->save();
916 899
 
917 900
                     $res = true;

+ 1 - 8
app/controller/api/store/merchant/Taskorderlianc.php

@@ -397,7 +397,6 @@ class Taskorderlianc
397 397
 
398 398
         $originator_award = round(($weekRecord * 0.05), 2);
399 399
 
400
-
401 400
         // foreach($list as $k=>$v){
402 401
         //     var_dump($v);
403 402
         // }
@@ -464,16 +463,10 @@ class Taskorderlianc
464 463
                 //90给佣金,10给复购金
465 464
                 $yj_90 = $award * 0.9;
466 465
                 $fg_10 = $award * 0.1;
467
-                if ($v == 303) {
468
-                    $yj_90 = 116.69;
469
-                    $fg_10 = 12.97;
470
-                }
471 466
                 if ($isTest == 0) {
472 467
                     $res = Db::name("user")->where("uid", $v)->inc("total_amount_old", $yj_90)->save();
473 468
                     Db::name("user")->where("uid", $v)->inc("amount_old", $yj_90)->save();//不用冻结金额和提现额度来限制佣金发放
474
-                    if ($v != 303) {
475
-                        Db::name("user")->where("uid", $v)->inc("brokerage_price", $yj_90)->save();
476
-                    }
469
+                    Db::name("user")->where("uid", $v)->inc("brokerage_price", $yj_90)->save();
477 470
                     $res3 = Db::name("user")->where("uid", $v)->inc("fugou", $fg_10)->save();
478 471
 
479 472
                     $res = true;

+ 1 - 1
app/validate/api/UserAuthValidate.php

@@ -17,7 +17,7 @@ class UserAuthValidate extends Validate
17 17
     protected $failException = true;
18 18
 
19 19
     protected $rule = [
20
-        'phone|手机号' => 'require|mobile',
20
+        // 'phone|手机号' => 'require|mobile',
21 21
         'pwd|密码' => 'require|min:6',
22 22
         'sms_code|短信验证码' => 'require|max:4',
23 23
     ];

+ 23 - 4
crmeb/services/AliYunSmsService.php

@@ -36,13 +36,32 @@ class AliYunSmsService
36 36
             ->regionId('cn-hangzhou')
37 37
             ->asDefaultClient();
38 38
         $templateParam['code'] = $code;
39
+        $content = '';
39 40
         log::info("发送短信方法");
40 41
         switch ($templateId) {
41 42
             case 'AUTHCODE':
42
-                $SignName = '融合华夏';
43
-                $TemplateCode = 'SMS_311255692';
43
+                // 移除所有非数字字符(保留+)
44
+                $mobile = preg_replace('/[^0-9+]/', '', $mobile);
44 45
 
45
-                $content = '【华夏幸福保】您的验证码是:' . $code;
46
+                if (strpos($mobile, '+') === false || strpos($mobile, '+86') === 0) {
47
+                    if (strpos($mobile, '+86') === 0) {
48
+                        $mobile = substr($mobile, 3);
49
+                    }
50
+                    $SignName = '融合华夏';
51
+                    $TemplateCode = 'SMS_311255692';
52
+                    $content = '【华夏幸福保】您的验证码是:' . $code;
53
+                } else {
54
+                    if (strpos($mobile, '+') === 0) {
55
+                        $mobile = substr($mobile, 1);
56
+                    }
57
+                    $SignName = '融合华夏';
58
+                    $TemplateCode = 'SMS_492105133';
59
+                    $templateParam = [
60
+                        'code_zh' => $code,
61
+                        'code_en' => $code
62
+                    ];
63
+                    $content = '【融合华夏】您的验证码是:' . $code . ',请输入此验证码以完成验证流程。Your verification code is:' . $code . '. Please enter this code to complete your verification process.';
64
+                }
46 65
                 break;
47 66
             case 'ONESELFCARRY':
48 67
                 $SignName = '华夏幸福保';
@@ -78,7 +97,7 @@ class AliYunSmsService
78 97
                 ->request();
79 98
 
80 99
             log::info("短信:返回参数");
81
-            log::info($result);
100
+            log::info(json_encode($result->toArray()));
82 101
             Db::name('sms_record')->insert(['phone' => $mobile, 'content' => $content, 'template' => $TemplateCode, 'create_time'=>date("Y-m-d H:i:s")]);
83 102
             return $result->toArray();
84 103
         // } catch (ClientException $e) {

+ 3 - 3
route/api.php

@@ -979,9 +979,9 @@ Route::group('api/', function () {
979 979
 
980 980
     //验证码
981 981
     Route::post('auth/verify', 'api.Auth/verify');
982
-    Route::post('auth/sendSms', 'api.Auth/verify')
983
-        ->middleware(SignatureMiddleware::class)
984
-        ->middleware(RateLimitMiddleware::class);
982
+    Route::post('auth/sendSms', 'api.Auth/verify');
983
+        // ->middleware(SignatureMiddleware::class)
984
+        // ->middleware(RateLimitMiddleware::class);
985 985
     //微信配置
986 986
     Route::get('wechat/config', 'api.Wechat/jsConfig');
987 987
     //图片验证码