Commit 5e261d1d authored by zhuwei's avatar zhuwei

bug

parent 77f29f99
...@@ -59,6 +59,8 @@ class ConvertCouponService ...@@ -59,6 +59,8 @@ class ConvertCouponService
if(!$user_id or !$report_id or !$bargain_id or !$order_id){ if(!$user_id or !$report_id or !$bargain_id or !$order_id){
return false; return false;
} }
big_log('=============客户DI:'.$user_id.' START=================');
//验证 客户首次登录时间 是否在 收意向金时间 大于48小时给返现红包兑现 //验证 客户首次登录时间 是否在 收意向金时间 大于48小时给返现红包兑现
$verification_res = $this->verificationFirstLoginTime($user_id); $verification_res = $this->verificationFirstLoginTime($user_id);
...@@ -76,15 +78,17 @@ class ConvertCouponService ...@@ -76,15 +78,17 @@ class ConvertCouponService
// 存在未过期 券数等于1直接核销 // 存在未过期 券数等于1直接核销
$coupon_list_count = count($coupon_list); $coupon_list_count = count($coupon_list);
if($coupon_list_count == 0){ if($coupon_list_count == 0){
return false; return false;
}elseif($coupon_list_count > 1){ }elseif($coupon_list_count > 1){
// 券数大于1 选取金额最大的核销 // 券数大于1 选取金额最大的核销
$coupon_list_new = $this->getMaxCoupon($coupon_list);
$coupon_list = []; $coupon_list = [];
$coupon_list[] = $this->getMaxCoupon($coupon_list); $coupon_list[] = $coupon_list_new;
} }
//修改券状态为已使用
//修改券状态为已使用
$this->m_coupon->updateUseStatus($coupon_list[0]['id'],1,$report_id,$bargain_id,$order_id,date("Y-m-d H:i:s", time())); $this->m_coupon->updateUseStatus($coupon_list[0]['id'],1,$report_id,$bargain_id,$order_id,date("Y-m-d H:i:s", time()));
// 将活动奖励金额写入账户余额 // 将活动奖励金额写入账户余额
...@@ -128,6 +132,7 @@ class ConvertCouponService ...@@ -128,6 +132,7 @@ class ConvertCouponService
public function getMaxCoupon($coupon_list){ public function getMaxCoupon($coupon_list){
$field ='money'; $field ='money';
$temp = []; $temp = [];
foreach ($coupon_list as $k=>$v){ foreach ($coupon_list as $k=>$v){
$temp[]=$v[$field]; $temp[]=$v[$field];
} }
...@@ -229,8 +234,10 @@ class ConvertCouponService ...@@ -229,8 +234,10 @@ class ConvertCouponService
*/ */
public function verificationFirstLoginTime($user_id){ public function verificationFirstLoginTime($user_id){
$user_info = $this->getUserInfo($user_id); $user_info = $this->getUserInfo($user_id);
if (!$user_info) if (!$user_info){
big_log('客户不存在!');
return false; return false;
}
$first_login_time = $user_info[0]['first_login_time']; $first_login_time = $user_info[0]['first_login_time'];
if (!$first_login_time) if (!$first_login_time)
{ {
...@@ -243,7 +250,7 @@ class ConvertCouponService ...@@ -243,7 +250,7 @@ class ConvertCouponService
$pay_log = $this->m_pay_log->getPayLogByUserId('a.create_time',$params); $pay_log = $this->m_pay_log->getPayLogByUserId('a.create_time',$params);
$pay_log_time = $pay_log['create_time']; $pay_log_time = $pay_log['create_time'];
if (!$pay_log_time){ if (!$pay_log_time){
big_log('客户首次登录时间为空'); big_log('客户不存在收意向金');
return false; return false;
} }
$pay_hour = (strtotime($pay_log_time)-strtotime($first_login_time))/3600; $pay_hour = (strtotime($pay_log_time)-strtotime($first_login_time))/3600;
......
...@@ -181,18 +181,10 @@ class ImageDepot extends Basic ...@@ -181,18 +181,10 @@ class ImageDepot extends Basic
public function ceshi() public function ceshi()
{ {
// $this->m_pay_log = new OPayLogModel(); $service = new ConvertCouponService();
$service->convertCoupon(135281, 12,12,12); //核销红包
// $s_convert = new ConvertCouponService(); dump(0);exit;
// $s_convert = new OPayLogModel();
// // $s_convert->convertCoupon();
// $s_convert->adddata();
$first_login_time = '2019-03-10 11:04:21';
$pay_log_time = '2019-03-12 15:50:27';
$hour = floor((strtotime($pay_log_time)-strtotime($first_login_time))/3600);
dump($hour);exit;
} }
......
...@@ -88,6 +88,7 @@ class Basic extends Controller ...@@ -88,6 +88,7 @@ class Basic extends Controller
'index/checkReferrer', 'index/checkReferrer',
'index/getActivityCoupon', 'index/getActivityCoupon',
'index/userAccountBalanceList', 'index/userAccountBalanceList',
'index/ceshi',
); );
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment