|
@@ -313,7 +313,7 @@ class Lave extends Api
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// die();
|
|
// die();
|
|
|
-
|
|
|
|
|
|
|
+ $this->success('扣款完成');
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
// 检查签约用户是否有符合签约月份数量的扣款记录
|
|
// 检查签约用户是否有符合签约月份数量的扣款记录
|
|
@@ -321,19 +321,30 @@ class Lave extends Api
|
|
|
$list = WechatPlanRecord::where('is_signing', 0)->select(); //签约中
|
|
$list = WechatPlanRecord::where('is_signing', 0)->select(); //签约中
|
|
|
foreach ($list as $k => $v) {
|
|
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) { //相差月数大于月捐记录数量
|
|
|
|
|
|
|
+// $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);
|
|
|
|
|
+
|
|
|
|
|
+// if ($monthsDiff > 0&&$monthsDiff > $count+1) { //相差月数大于月捐记录数量
|
|
|
|
|
+ @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);
|
|
|
|
|
+// 查找上个月是否有扣款记录
|
|
|
|
|
+// 获取当前时间的时间戳
|
|
|
|
|
+ $currentTimestamp = time();
|
|
|
|
|
+// 获取一个月前的时间戳
|
|
|
|
|
+ $last_month = strtotime("-1 month", $currentTimestamp);
|
|
|
|
|
+ $count = LaveMonthModel::where('contract_code', $v['contract_code'])->where('createtime','>', $last_month)->count();
|
|
|
|
|
+ if ($count == 0){
|
|
|
|
|
+ @file_put_contents("quanju2.txt", "没有上个月的扣款记录-\r\n", 8);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// $cid = $v['cid'];
|
|
// $cid = $v['cid'];
|
|
|
// $mch_id = Company::where('id', $cid)->value('pay_weixin_mchid');
|
|
// $mch_id = Company::where('id', $cid)->value('pay_weixin_mchid');
|
|
|
// $where1['cid'] = $cid;
|
|
// $where1['cid'] = $cid;
|
|
@@ -353,16 +364,11 @@ class Lave extends Api
|
|
|
// $where1['record_id'] = $v['id'];
|
|
// $where1['record_id'] = $v['id'];
|
|
|
// $where1['contract_code'] = $v['contract_code'];
|
|
// $where1['contract_code'] = $v['contract_code'];
|
|
|
// $where1['plan_id'] = $v['plan_id'];
|
|
// $where1['plan_id'] = $v['plan_id'];
|
|
|
-//
|
|
|
|
|
// $where1['nonce_str'] = uniqid();
|
|
// $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);
|
|
|
|
|
|
|
+// $order = LaveMonthModel::create($where1);
|
|
|
|
|
+// $rs = WechatService::papPayApply($mch_id, $where1['order_id'], $where1['amount'], "lave", '月捐款', 'PAP', [], $cid, $v['contract_id'], $where1['order_name'], $where1['nonce_str']);
|
|
|
// }
|
|
// }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
$this->success('获取成功');
|
|
$this->success('获取成功');
|
|
|
}
|
|
}
|