WIN-2308041133\Administrator 4 months ago
parent
commit
532dbeb2fc

+ 2 - 1
app/admin/controller/finance/UserExtract.php

@@ -9,10 +9,11 @@
 namespace app\admin\controller\finance;
 namespace app\admin\controller\finance;
 
 
 use app\admin\controller\AuthController;
 use app\admin\controller\AuthController;
+use app\admin\model\wechat\WechatUser;
 use think\facade\Route as Url;
 use think\facade\Route as Url;
 use crmeb\services\JsonService;
 use crmeb\services\JsonService;
 use app\admin\model\user\UserExtract as UserExtractModel;
 use app\admin\model\user\UserExtract as UserExtractModel;
-use crmeb\services\{UtilService as Util, FormBuilder as Form};
+use crmeb\services\{UtilService as Util, FormBuilder as Form, WechatTemplateService};
 
 
 /**
 /**
  * 用户提现管理
  * 用户提现管理

+ 43 - 0
app/admin/model/user/UserExtract.php

@@ -117,6 +117,26 @@ class UserExtract extends BaseModel
         } else if (strtolower($User['user_type']) == 'routine') {
         } else if (strtolower($User['user_type']) == 'routine') {
             RoutineTemplate::sendExtractFail($uid, $fail_msg, $extract_number, $User['nickname']);
             RoutineTemplate::sendExtractFail($uid, $fail_msg, $extract_number, $User['nickname']);
         }
         }
+        //        通知提现用户
+        $openid = WechatUser::where('uid', $uid)->value('openid');
+        if (!empty($openid)) {
+            $group = [
+                'first' => '提现审核处理通知',
+                'remark' => '点击查看订单详情'
+            ];
+            $time = date('Y-m-d H:i:s', time());
+            $group = array_merge($group, [
+                'thing3' => $User['nickname'],  //客户名称
+                'amount6' => $extract_number,  //提现金额
+                'const15' => '驳回',  //审核结果
+                'thing4' => $extract_type,  //提现分类
+                'time8' => $time, //提现时间
+            ]);
+
+            @file_put_contents('quanju.txt', json_encode($group) . "-模版消息4\r\n", 8);
+            $res = WechatTemplateService::sendTemplate($openid, WechatTemplateService::Extract_SUCCESS, $group);
+            @file_put_contents('quanju.txt', json_encode($res) . "-模版消息返回4\r\n", 8);
+        }
         return self::edit(compact('fail_time', 'fail_msg', 'status'), $id);
         return self::edit(compact('fail_time', 'fail_msg', 'status'), $id);
     }
     }
 
 
@@ -184,7 +204,30 @@ class UserExtract extends BaseModel
                     'remark' => '点击查看我的余额明细'
                     'remark' => '点击查看我的余额明细'
                 ], Url::buildUrl('/user/cashrecord')->suffix('')->domain(true)->build());
                 ], Url::buildUrl('/user/cashrecord')->suffix('')->domain(true)->build());
             }
             }
+
+            //        通知提现用户
+            $openid = WechatUser::where('uid', $data['uid'])->value('openid');
+            $nickname = User::where('uid', $data['uid'])->value('nickname');
+            if (!empty($openid)) {
+                $group = [
+                    'first' => '提现审核处理通知',
+                    'remark' => '点击查看订单详情'
+                ];
+                $time = date('Y-m-d H:i:s', time());
+                $group = array_merge($group, [
+                    'thing3' => $nickname,  //客户名称
+                    'amount6' => $extractNumber,  //提现金额
+                    'const15' => '通过',  //审核结果
+                    'thing4' => $extract_type,  //提现分类
+                    'time8' => $time, //提现时间
+                ]);
+
+                @file_put_contents('quanju.txt', json_encode($group) . "-模版消息5\r\n", 8);
+                $res = WechatTemplateService::sendTemplate($openid, WechatTemplateService::Extract_SUCCESS, $group);
+                @file_put_contents('quanju.txt', json_encode($res) . "-模版消息返回5\r\n", 8);
+            }
         }
         }
+
         return self::edit(['status' => 1], $id);
         return self::edit(['status' => 1], $id);
     }
     }
 
 

+ 2 - 17
app/models/user/UserSpread.php

@@ -74,35 +74,20 @@ class UserSpread extends BaseModel
 //        通知上级
 //        通知上级
         $openid = WechatUser::where('uid', $spread_uid)->value('openid');
         $openid = WechatUser::where('uid', $spread_uid)->value('openid');
         if (!empty($openid)){
         if (!empty($openid)){
-            $url = Url::buildUrl('/order/detail/wx175446111846779570')->suffix('')->domain(true)->build();
+//            $url = Url::buildUrl('/order/detail/wx175446111846779570')->suffix('')->domain(true)->build();
             $group = [
             $group = [
                 'first' => '下级用户绑定成功通知',
                 'first' => '下级用户绑定成功通知',
                 'remark' => '点击查看订单详情'
                 'remark' => '点击查看订单详情'
             ];
             ];
-//            $group = array_merge($group, [
-//                'thing4' => 'cs',  //商品名称
-////                    'character_string2' => $order['pay_type'] == 'offline' ? '线下支付' : date('Y/m/d H:i', $order['pay_time']),
-////                    'phone_number21' => $order['user_address'],
-////                    'phone_number21' => '15356590576',
-//                'thing13' => 'cs',  //快递公司
-//                'character_string14' => 12345789//快递单号
-//            ]);
-//            @file_put_contents('quanju.txt',  json_encode($group)."-模版消息1\r\n", 8);
-//            $res= WechatTemplateService::sendTemplate($openid, WechatTemplateService::ORDER_POSTAGE_SUCCESS, $group, $url);
-//            @file_put_contents('quanju.txt',  json_encode($res)."-模版消息返回1\r\n", 8);
             $time = date('Y-m-d H:i:s', time());
             $time = date('Y-m-d H:i:s', time());
             $group = array_merge($group, [
             $group = array_merge($group, [
-//                'thing1' => $user['nickname'],  //用户姓名
-//                    'character_string2' => $order['pay_type'] == 'offline' ? '线下支付' : date('Y/m/d H:i', $order['pay_time']),
-//                    'phone_number21' => $order['user_address'],
-//                    'phone_number21' => '15356590576',
                 'character_string7' => $user['account'],  //用户账号
                 'character_string7' => $user['account'],  //用户账号
                 'time3' => $time, //绑定时间
                 'time3' => $time, //绑定时间
             ]);
             ]);
 
 
             @file_put_contents('quanju.txt',  $openid."-openid\r\n", 8);
             @file_put_contents('quanju.txt',  $openid."-openid\r\n", 8);
             @file_put_contents('quanju.txt',  json_encode($group)."-模版消息3\r\n", 8);
             @file_put_contents('quanju.txt',  json_encode($group)."-模版消息3\r\n", 8);
-            $res= WechatTemplateService::sendTemplate($openid, WechatTemplateService::BARGAIN_SUCCESS, $group);
+            $res= WechatTemplateService::sendTemplate($openid, WechatTemplateService::SUBORDINATE_BINDING, $group);
             @file_put_contents('quanju.txt',  json_encode($res)."-模版消息返回3\r\n", 8);
             @file_put_contents('quanju.txt',  json_encode($res)."-模版消息返回3\r\n", 8);
 
 
         }
         }

+ 2 - 0
crmeb/services/WechatTemplateService.php

@@ -57,6 +57,8 @@ class WechatTemplateService implements ProviderInterface
 
 
 //    下级用户绑定
 //    下级用户绑定
     const SUBORDINATE_BINDING = 60720;
     const SUBORDINATE_BINDING = 60720;
+    //    提现通知
+    const Extract_SUCCESS = 42935;
     public static function getConstants($code = '')
     public static function getConstants($code = '')
     {
     {
         $oClass = new \ReflectionClass(__CLASS__);
         $oClass = new \ReflectionClass(__CLASS__);