Change-Id: I5924c545e1daf9c906fa0f2e9f2df72c3ab52903
This commit is contained in:
vguanyiwgd 2024-06-05 15:09:45 +08:00
parent ebb5c92cb5
commit c466edc96c
3 changed files with 22 additions and 19 deletions

View File

@ -924,6 +924,6 @@ class Recharge extends REST_Controller
$fee = $this->input->post('fee'); $fee = $this->input->post('fee');
$userInfo = $this->user; $userInfo = $this->user;
$this->load->library('Recharge_config'); $this->load->library('Recharge_config');
echo $this->recharge_config->rechargeRule((object)$userInfo, $userInfo->company_id, $fee, 1); echo $this->recharge_config->rechargeRule((array)$userInfo, $userInfo->company_id, $fee, 1);
} }
} }

View File

@ -502,7 +502,7 @@ class Recharge extends CI_Controller
if($jobInfo['account_type_id'] == 2){ if($jobInfo['account_type_id'] == 2){
// 判断是否有充值赠送 // 判断是否有充值赠送
$this->load->library('Recharge_config'); $this->load->library('Recharge_config');
$rechargeInfo = $this->recharge_config->rechargeRule((object)$rowUser, $rowUser['company_id'], floatval($detail['jf']), 2); $rechargeInfo = $this->recharge_config->rechargeRule($rowUser, $rowUser['company_id'], floatval($detail['jf']), 2);
$rechargeInfo = json_decode($rechargeInfo, 1); $rechargeInfo = json_decode($rechargeInfo, 1);
if($rechargeInfo['status'] == 1) { if($rechargeInfo['status'] == 1) {
$giveFee = $rechargeInfo['data']['gift_fee']; $giveFee = $rechargeInfo['data']['gift_fee'];
@ -1082,7 +1082,7 @@ class Recharge extends CI_Controller
//send_sms_p($smsList); //send_sms_p($smsList);
// 获取充值在赠送金额 // 获取充值在赠送金额
$this->load->library('Recharge_config'); $this->load->library('Recharge_config');
$rechargeInfo = $this->recharge_config->rechargeRule((object)$userInfo, $userInfo['company_id'], $count, 2); $rechargeInfo = $this->recharge_config->rechargeRule($userInfo, $userInfo['company_id'], $count, 2);
$rechargeInfo = json_decode($rechargeInfo, 1); $rechargeInfo = json_decode($rechargeInfo, 1);
if($rechargeInfo['status'] == 1){ if($rechargeInfo['status'] == 1){
$giveFee = $rechargeInfo['data']['gift_fee']; $giveFee = $rechargeInfo['data']['gift_fee'];
@ -1414,6 +1414,7 @@ class Recharge extends CI_Controller
$paramFilter = array('name'); $paramFilter = array('name');
$data = $this->lw_pagination2->lists($sql,$param,$page,$hasWhere,$group,$order,$action,$dataName,$paramFilter); $data = $this->lw_pagination2->lists($sql,$param,$page,$hasWhere,$group,$order,$action,$dataName,$paramFilter);
if(empty($data['dataList'])){
foreach ($data['dataList'] as $k => $v){ foreach ($data['dataList'] as $k => $v){
if($v['user_type_id'] == '*'){ if($v['user_type_id'] == '*'){
$data['dataList'][$k]['user_type_id'] = "全部"; $data['dataList'][$k]['user_type_id'] = "全部";
@ -1429,6 +1430,7 @@ class Recharge extends CI_Controller
$data['dataList'][$k]['effective_type'] = $v['effective_type'] == 1 ? "app充值" : "后台充值"; $data['dataList'][$k]['effective_type'] = $v['effective_type'] == 1 ? "app充值" : "后台充值";
$data['dataList'][$k]['gift_type'] = $v['gift_type'] == 1 ? "每年" : "每次"; $data['dataList'][$k]['gift_type'] = $v['gift_type'] == 1 ? "每年" : "每次";
} }
}
echo $this->load->view('recharge/config/list',$data,true); echo $this->load->view('recharge/config/list',$data,true);
} }

View File

@ -17,6 +17,7 @@ class CI_Recharge_config {
* @return void * @return void
*/ */
public function rechargeRule($userInfo, $companyId, $fee, $effective_type=1){ public function rechargeRule($userInfo, $companyId, $fee, $effective_type=1){
$userInfo = (array)$userInfo;
$gift_fee = 0; $gift_fee = 0;
// 把金额转换为分 // 把金额转换为分
@ -42,14 +43,14 @@ class CI_Recharge_config {
if($pz) { if($pz) {
foreach ($pz as $k => $v) { foreach ($pz as $k => $v) {
$user_type_id = explode(',', $v['user_type_id']); $user_type_id = explode(',', $v['user_type_id']);
if ($v['user_type_id'] != '*' || (!in_array($userInfo->type_id, $user_type_id) && !in_array('*', $user_type_id))) { if ($v['user_type_id'] != '*' || (!in_array($userInfo['type_id'], $user_type_id) && !in_array('*', $user_type_id))) {
// 如果规则不含有用户类型 && 不含有*,则跳过 // 如果规则不含有用户类型 && 不含有*,则跳过
continue; continue;
} }
if($v['gift_type'] == 1){ if($v['gift_type'] == 1){
// 每年赠送 // 每年赠送
// 获取今年的充值次数 // 获取今年的充值次数
$year_count = $this->get_recharge_count($userInfo->id, $v['gift_type']); $year_count = $this->get_recharge_count($userInfo['id'], $v['gift_type']);
if($year_count != 0){ if($year_count != 0){
$year_count = $year_count+1; $year_count = $year_count+1;
@ -65,7 +66,7 @@ class CI_Recharge_config {
continue; continue;
} }
}else{ }else{
$count = $this->get_recharge_count($userInfo->id, $v['gift_type']); $count = $this->get_recharge_count($userInfo['id'], $v['gift_type']);
if($count != 0){ if($count != 0){
$count = $count+1; $count = $count+1;
} }