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

Merge branch 'dev' into dev-sxb

sunxbiao 1 год назад
Родитель
Сommit
5cff8a32d5

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

@@ -12,6 +12,7 @@ namespace app\common\model\merchant\order;
12
 
12
 
13
 use app\common\model\BaseModel;
13
 use app\common\model\BaseModel;
14
 use app\common\model\user\User;
14
 use app\common\model\user\User;
15
+use app\common\model\user\UserBill;
15
 
16
 
16
 class OrderGzc extends BaseModel
17
 class OrderGzc extends BaseModel
17
 {
18
 {
@@ -31,4 +32,8 @@ class OrderGzc extends BaseModel
31
         return $this->hasOne(User::class, 'uid', 'uid');
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
 use Carbon\Carbon;
17
 use Carbon\Carbon;
18
 use crmeb\services\SpreadsheetExcelService;
18
 use crmeb\services\SpreadsheetExcelService;
19
 use FormBuilder\Factory\Elm;
19
 use FormBuilder\Factory\Elm;
20
+use think\facade\Db;
20
 use think\facade\Log;
21
 use think\facade\Log;
21
 use think\facade\Route;
22
 use think\facade\Route;
22
 
23
 
@@ -50,36 +51,97 @@ class OrderGzcRepository extends BaseRepository
50
         // 导出
51
         // 导出
51
         $is_excel = request()->param('is_excel', 0);
52
         $is_excel = request()->param('is_excel', 0);
52
         if ($is_excel == 1) {
53
         if ($is_excel == 1) {
53
-            $data = $query->with('user')->select();
54
+            $data = $query->with(['user', 'bill'])->select()->toArray();
55
+
54
             $arr = [];
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
             return $this->getStatisticsExcel([
143
             return $this->getStatisticsExcel([
82
-                'ID', '平台申请单号', '用户昵称', '用户账号', '实名认证姓名', '实名认证电话', '实名认证证件号', '银行名称', '银行名称', '开户账号', '转账流水号', '支付宝账号', '支付宝流水号', '微信账号', '微信流水号', '关联订单', '养老金', '处理状态', '公证处入账编号', '公证处入账结果', '创建时间', '更新时间'
144
+                'ID', '平台申请单号', '用户昵称', '用户账号', '实名认证姓名', '实名认证电话', '实名认证证件号', '银行名称', '银行名称', '开户账号', '转账流水号', '支付宝账号', '支付宝流水号', '微信账号', '微信流水号', '订单来源', '订单金额', '订单利润', '关联订单', '养老金', '处理状态', '公证处入账编号', '公证处入账结果', '创建时间', '更新时间'
83
             ], $arr, '公证处入账明细');
145
             ], $arr, '公证处入账明细');
84
         }
146
         }
85
 
147
 

+ 24 - 0
app/common/repositories/user/UserRepository.php

@@ -1103,6 +1103,7 @@ class UserRepository extends BaseRepository
1103
                     if($award_type == 1){
1103
                     if($award_type == 1){
1104
                         // 增加
1104
                         // 增加
1105
                         $isert_data['pm'] = 1;
1105
                         $isert_data['pm'] = 1;
1106
+                        $isert_data['gzc'] = 1;
1106
                         Db::name('user')->where('uid',$user['uid'])->inc('annuity', $num)->update();
1107
                         Db::name('user')->where('uid',$user['uid'])->inc('annuity', $num)->update();
1107
                     }else{
1108
                     }else{
1108
                         // 减少
1109
                         // 减少
@@ -1112,6 +1113,29 @@ class UserRepository extends BaseRepository
1112
                 }
1113
                 }
1113
                 Db::name('user_bill')->insert($isert_data);
1114
                 Db::name('user_bill')->insert($isert_data);
1114
             }
1115
             }
1116
+
1117
+            if ($commission_type == 5 && $award_type == 1) {
1118
+                $cer = Db::name('user')
1119
+                    ->where('uid', $user['uid'])
1120
+                    ->field('real_name, phone, card_id')
1121
+                    ->find();
1122
+                $ylj_data_log = [
1123
+                    'user_name' => $cer['real_name'],
1124
+                    "mobile" => $cer['phone'],
1125
+                    "user_card" => $cer['card_id'],//身份证
1126
+                    "pension" => $num,//养老金
1127
+                    "out_trade_no" => '',
1128
+                    "account_type" => '',
1129
+                    "order_type" => 0,
1130
+                    "pay_time" => '',
1131
+                    "create_time" => date('Y-m-d H:i:s'),
1132
+                    "update_time" => date('Y-m-d H:i:s'),
1133
+                    "uid" => $user['uid'],
1134
+                    "platform_no" => 'IN10' . (int)(microtime(true) * 1000) . mt_rand(10000, 99999),
1135
+                    "link_id" => ''
1136
+                ];
1137
+                Db::name('gzc_logs')->insert($ylj_data_log);
1138
+            }
1115
             $insert_data = [
1139
             $insert_data = [
1116
                 'uid' => $user['uid'],
1140
                 'uid' => $user['uid'],
1117
                 'type' => $type,
1141
                 'type' => $type,

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

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

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

@@ -322,17 +322,9 @@ class TaskPartnerProfits
322
                 # code...
322
                 # code...
323
                 $allAward = $myWeightMoney + $myMixMoney;
323
                 $allAward = $myWeightMoney + $myMixMoney;
324
 
324
 
325
-
326
                 //90%给佣金,10给复购金
325
                 //90%给佣金,10给复购金
327
                 $yj_90 = floor($allAward * 0.9 * 100) / 100;
326
                 $yj_90 = floor($allAward * 0.9 * 100) / 100;
328
                 $fg_10 = floor($allAward * 0.1 * 100) / 100;
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
                 //                $yj_90 = bcsub($yj_90, $user_bill_uid_list[$v]['number'] ?? 0.00, 2);
329
                 //                $yj_90 = bcsub($yj_90, $user_bill_uid_list[$v]['number'] ?? 0.00, 2);
338
                 //
330
                 //
@@ -357,9 +349,7 @@ class TaskPartnerProfits
357
                     $res = Db::name("user")->where("uid", $v)->inc("total_amount_old", $yj_90)->save();
349
                     $res = Db::name("user")->where("uid", $v)->inc("total_amount_old", $yj_90)->save();
358
 
350
 
359
                     Db::name("user")->where("uid", $v)->inc("amount_old", $yj_90)->save();//不用冻结金额和提现额度来限制佣金发放
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
                     Db::name("user")->where("uid", $v)->inc("fugou", $fg_10)->save();
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
         13231658486周行体1000
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
         13932925303会强400
33
         13932925303会强400
35
-        13901074090陈玉刚500
36
-        13381085923王建军100
37
-        13601071082隋彩云500
34
+        13901074090陈玉刚400
35
+        13381085923王建军50
36
+        13601071082隋彩云300
38
         18001316701闫旭300
37
         18001316701闫旭300
39
-        13601179856陈瑞元100
40
-        13161909228刘银霞200
38
+        13601179856陈瑞元50
39
+        13161909228刘银霞100
41
         18760167163刘春梅50
40
         18760167163刘春梅50
42
-        18911752386魏利琴50
43
         13215917919李小秋50
41
         13215917919李小秋50
44
-        15321221558李伟100
42
+        15321221558李伟50
45
         15332507711张传莲50
43
         15332507711张传莲50
46
         15960349667吕丽娣50
44
         15960349667吕丽娣50
47
-        18612051372李金俭100
48
-        18715313601大饼500
49
-        其余部分做分红,剩余36364业绩不分
45
+        18612051372李金俭50
46
+        18715313601大饼400
47
+        其余部分做分红
50
         */
48
         */
51
         $data = [
49
         $data = [
52
             '13231658486' => 1000,
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
             '13932925303' => 400,
61
             '13932925303' => 400,
65
-            '13901074090' => 500,
66
-            '13381085923' => 100,
67
-            '13601071082' => 500,
62
+            '13901074090' => 400,
63
+            '13381085923' => 50,
64
+            '13601071082' => 300,
68
             '18001316701' => 300,
65
             '18001316701' => 300,
69
-            '13601179856' => 100,
70
-            '13161909228' => 200,
66
+            '13601179856' => 50,
67
+            '13161909228' => 100,
71
             '18760167163' => 50,
68
             '18760167163' => 50,
72
-            '18911752386' => 50,
73
             '13215917919' => 50,
69
             '13215917919' => 50,
74
-            '15321221558' => 100,
70
+            '15321221558' => 50,
75
             '15332507711' => 50,
71
             '15332507711' => 50,
76
             '15960349667' => 50,
72
             '15960349667' => 50,
77
-            '18612051372' => 100,
78
-            '18715313601' => 500
73
+            '18612051372' => 50,
74
+            '18715313601' => 400
79
         ];
75
         ];
80
 
76
 
81
-
82
         $result = Db::name("user")
77
         $result = Db::name("user")
83
             ->whereIn("account", array_keys($data))
78
             ->whereIn("account", array_keys($data))
84
             ->where('is_del', 0)
79
             ->where('is_del', 0)
@@ -888,16 +883,6 @@ class Taskorderguquan
888
 
883
 
889
                 $yj_90 = $v['getcomm'] * 0.9;
884
                 $yj_90 = $v['getcomm'] * 0.9;
890
                 $fg_10 = $v['getcomm'] * 0.1;
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
                 if ($isTest == 0) {
887
                 if ($isTest == 0) {
903
                     // // 更新 user_stock 表中的记录
888
                     // // 更新 user_stock 表中的记录
@@ -909,9 +894,7 @@ class Taskorderguquan
909
 
894
 
910
                     $res1 = Db::name("user")->where("uid", $v['user_id'])->inc("total_amount_old", $yj_90)->save();
895
                     $res1 = Db::name("user")->where("uid", $v['user_id'])->inc("total_amount_old", $yj_90)->save();
911
                     $res2 = Db::name("user")->where("uid", $v['user_id'])->inc("amount_old", $yj_90)->save();
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
                     $res3 = Db::name("user")->where("uid", $v['user_id'])->inc("fugou", $fg_10)->save();
898
                     $res3 = Db::name("user")->where("uid", $v['user_id'])->inc("fugou", $fg_10)->save();
916
 
899
 
917
                     $res = true;
900
                     $res = true;

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

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

+ 15 - 2
app/controller/api/store/order/StoreOrder.php

@@ -211,8 +211,21 @@ class StoreOrder
211
 
211
 
212
         //log::info("计算养老金 good_id: {$good_id},price{$total_price},yanglao:{$yanglao}");
212
         //log::info("计算养老金 good_id: {$good_id},price{$total_price},yanglao:{$yanglao}");
213
         // $price = $decScore = $decJingScore =  0;
213
         // $price = $decScore = $decJingScore =  0;
214
-        foreach ($cartIds as $k=>$item){
215
-
214
+        foreach ($cartIds as $k => $item) {
215
+            // 如果不是 会员专区的 商品 提示 大陆外(港澳台) 暂时不能发货
216
+            // 66529	台湾
217
+            // 68405	澳门
218
+            // 68406	香港
219
+            if ($product_mer_id != 496 && $addressId != 0) {
220
+                $address_code_list = Db::name('user_address')->where('uid', $uid)->where('address_id', $addressId)->value('code_list');
221
+                if ($address_code_list) {
222
+                    $addressList = explode(',', $address_code_list);
223
+                    $shiftAddressId = array_shift($addressList);
224
+                    if (in_array($shiftAddressId, [7, 66529, 68405, 68406])) {
225
+                        return app('json')->fail('该收货地区暂待开放');
226
+                    }
227
+                }
228
+            }
216
         $checkGong = $gong -> checkGong($item['product_id'],$item['product_attr_unique'],$item['cart_num'],$uid,$addressId);
229
         $checkGong = $gong -> checkGong($item['product_id'],$item['product_attr_unique'],$item['cart_num'],$uid,$addressId);
217
         if(isset($checkGong['code']) && $checkGong['code'] == -1) return app('json')->fail($checkGong['message']);
230
         if(isset($checkGong['code']) && $checkGong['code'] == -1) return app('json')->fail($checkGong['message']);
218
         // $money=Db::name('store_product_attr_value')->where('unique',$item['product_attr_unique'])->value('price');
231
         // $money=Db::name('store_product_attr_value')->where('unique',$item['product_attr_unique'])->value('price');

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

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

+ 23 - 4
crmeb/services/AliYunSmsService.php

@@ -36,13 +36,32 @@ class AliYunSmsService
36
             ->regionId('cn-hangzhou')
36
             ->regionId('cn-hangzhou')
37
             ->asDefaultClient();
37
             ->asDefaultClient();
38
         $templateParam['code'] = $code;
38
         $templateParam['code'] = $code;
39
+        $content = '';
39
         log::info("发送短信方法");
40
         log::info("发送短信方法");
40
         switch ($templateId) {
41
         switch ($templateId) {
41
             case 'AUTHCODE':
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
                 break;
65
                 break;
47
             case 'ONESELFCARRY':
66
             case 'ONESELFCARRY':
48
                 $SignName = '华夏幸福保';
67
                 $SignName = '华夏幸福保';
@@ -78,7 +97,7 @@ class AliYunSmsService
78
                 ->request();
97
                 ->request();
79
 
98
 
80
             log::info("短信:返回参数");
99
             log::info("短信:返回参数");
81
-            log::info($result);
100
+            log::info(json_encode($result->toArray()));
82
             Db::name('sms_record')->insert(['phone' => $mobile, 'content' => $content, 'template' => $TemplateCode, 'create_time'=>date("Y-m-d H:i:s")]);
101
             Db::name('sms_record')->insert(['phone' => $mobile, 'content' => $content, 'template' => $TemplateCode, 'create_time'=>date("Y-m-d H:i:s")]);
83
             return $result->toArray();
102
             return $result->toArray();
84
         // } catch (ClientException $e) {
103
         // } catch (ClientException $e) {