WIN-2308041133\Administrator 8 月之前
父節點
當前提交
3b9f39a56c
共有 2 個文件被更改,包括 51 次插入0 次删除
  1. 50 0
      application/api/controller/Lave.php
  2. 1 0
      application/route.php

+ 50 - 0
application/api/controller/Lave.php

@@ -316,6 +316,56 @@ class Lave extends Api
 
 //        }
     }
+//    检查签约用户是否有符合签约月份数量的扣款记录
+    public function check_pay_pap(){
+        $list = WechatPlanRecord::where('is_signing', 0)->select();  //签约中
+        foreach ($list as $k => $v) {
+//            查找对应签约协议号的月捐记录
+            $count = LaveMonthModel::where('contract_code', $v['contract_code'])->count();
+            $createDate = new \DateTime('@'.$v['createtime']);
+            $currentDate = new \DateTime();
+            $interval = $currentDate->diff($createDate);
+            $monthsDiff = $interval->y * 12 + $interval->m;
+            if ($interval->d > 0) {
+                $monthsDiff += $interval->d / $currentDate->format('t');
+            }
+            $monthsDiff = floor($monthsDiff);
+            @file_put_contents("quanju2.txt", $v['contract_code']."签约协议号-\r\n", 8);
+            @file_put_contents("quanju2.txt", $monthsDiff."相差月份-\r\n", 8);
+            @file_put_contents("quanju2.txt", $count."统计次数-\r\n", 8);
+//            if ($monthsDiff > $count) {  //相差月数大于月捐记录数量
+//                $cid = $v['cid'];
+//                $mch_id = Company::where('id', $cid)->value('pay_weixin_mchid');
+//                $where1['cid'] = $cid;
+//                $where1['user_id'] = $v['uid'];
+//                $where1['order_name'] = $v['order_name'];
+//                $where1['order_id'] = LaveMonthModel::getNewOrderId();;
+//
+////                $where1['category_id']=$v['category_id'];
+//                $where1['amount'] = $v['price'];
+//                $where1['name'] = $v['contract_display_account'];
+//                $where1['contact'] = '';
+//                $where1['tel'] = $v['tel'];
+//                $where1['address'] = '用户未填写联系地址';
+//                $where1['is_open'] = $v['is_open'];
+//                $where1['is_ticket'] = '0';
+//                $where1['type'] = '0';
+//                $where1['record_id'] = $v['id'];
+//                $where1['contract_code'] = $v['contract_code'];
+//                $where1['plan_id'] = $v['plan_id'];
+//
+//                $where1['nonce_str'] = uniqid();
+////                $where1['help_id']='0';
+////                    @file_put_contents("quanju.txt", json_encode($where1)."测试申请扣款-\r\n", 8);
+////                $order = LaveMonthModel::create($where1);
+////            }
+////                    var_dump(988745613);die();
+////                $rs = WechatService::papPayApply($mch_id, $where1['order_id'], $where1['amount'], "lave", '月捐款', 'PAP', [], $cid, $v['contract_id'], $where1['order_name'], $where1['nonce_str']);
+////                @file_put_contents("quanju.txt", json_encode($rs)."-月捐汇报2\r\n", 8);
+//            }
+        }
+        $this->success('获取成功');
+    }
 
 //    解除签约
     public function deleteSign(Request $request)

+ 1 - 0
application/route.php

@@ -91,6 +91,7 @@ Route::group('api', function () {
         Route::get('query_sign_order', 'api/lave/query_sign_order');  //查询签约订单
         Route::get('day_query_sign_order', 'api/lave/day_query_sign_order');  //每天查询签约订单
         Route::get('cs_query_sign', 'api/lave/csquerySign');  //测试查询签约
+        Route::get('check_pay_pap', 'api/lave/check_pay_pap');  //检查每月扣款
         Route::get('querycontract', 'api/lave/querycontract');  //查询签约合同
         Route::get('plan_lst', 'api/lave/plan_lst');  //模版列表
         Route::get('plan_info', 'api/lave/plan_read');  //模版列表