增加充值赠送功能(后端充值+配置)
Change-Id: I17e6561c5edfbbcb9194d5387966e3560370f814
This commit is contained in:
parent
0f12680953
commit
ebb5c92cb5
|
@ -919,4 +919,11 @@ class Recharge extends REST_Controller
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_give_fee_post(){
|
||||||
|
$fee = $this->input->post('fee');
|
||||||
|
$userInfo = $this->user;
|
||||||
|
$this->load->library('Recharge_config');
|
||||||
|
echo $this->recharge_config->rechargeRule((object)$userInfo, $userInfo->company_id, $fee, 1);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -172,6 +172,13 @@ class User_model extends CI_Model
|
||||||
return $query->row();
|
return $query->row();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $ids id字符串列表
|
||||||
|
*/
|
||||||
|
public function get_user_type_by_ids($ids){
|
||||||
|
return $this->db->query("select * from tb_user_type where enabled=1 and company_id='".$this->session->userdata('companyId')."' and id in ({$ids})")->result_array();
|
||||||
|
}
|
||||||
|
|
||||||
public function get_payqr($uid)
|
public function get_payqr($uid)
|
||||||
{
|
{
|
||||||
$query = $this->db->query("select * from tb_payqr where uid = {$uid} and oid=0 order by expire desc limit 1");
|
$query = $this->db->query("select * from tb_payqr where uid = {$uid} and oid=0 order by expire desc limit 1");
|
||||||
|
|
|
@ -495,6 +495,36 @@ class Recharge extends CI_Controller
|
||||||
}
|
}
|
||||||
//print_r($detail);exit;
|
//print_r($detail);exit;
|
||||||
$r = gpay_add_user_account_uid($detail['user_id'], floatval($detail['jf']), $payInfo, $updateInfo);
|
$r = gpay_add_user_account_uid($detail['user_id'], floatval($detail['jf']), $payInfo, $updateInfo);
|
||||||
|
|
||||||
|
// 判断充值是否成功
|
||||||
|
if($r == 'suc'){
|
||||||
|
// 判断是否是现金账户充值
|
||||||
|
if($jobInfo['account_type_id'] == 2){
|
||||||
|
// 判断是否有充值赠送
|
||||||
|
$this->load->library('Recharge_config');
|
||||||
|
$rechargeInfo = $this->recharge_config->rechargeRule((object)$rowUser, $rowUser['company_id'], floatval($detail['jf']), 2);
|
||||||
|
$rechargeInfo = json_decode($rechargeInfo, 1);
|
||||||
|
if($rechargeInfo['status'] == 1) {
|
||||||
|
$giveFee = $rechargeInfo['data']['gift_fee'];
|
||||||
|
if($giveFee > 0){
|
||||||
|
$rechargePayInfo = array(
|
||||||
|
'admin_id' => $adminId,
|
||||||
|
'rtype' => 1,
|
||||||
|
'ac_type' => 1,
|
||||||
|
'supplier_id' => $supplierId,
|
||||||
|
'notes' => '充值赠送',
|
||||||
|
);
|
||||||
|
$r = gpay_add_user_account_uid($detail['user_id'], floatval($giveFee), $rechargePayInfo);
|
||||||
|
if ($r == 'suc') {
|
||||||
|
$giveContent = ",赠送金额充值成功。";
|
||||||
|
}else{
|
||||||
|
$giveContent = ",赠送金额充值失败。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
$action = '扣费';
|
$action = '扣费';
|
||||||
|
@ -1050,7 +1080,30 @@ class Recharge extends CI_Controller
|
||||||
$sms = array($cellphone, $content);
|
$sms = array($cellphone, $content);
|
||||||
$smsList = array($sms);
|
$smsList = array($sms);
|
||||||
//send_sms_p($smsList);
|
//send_sms_p($smsList);
|
||||||
lwReturn(true, array('msg' => '充值成功'));
|
// 获取充值在赠送金额
|
||||||
|
$this->load->library('Recharge_config');
|
||||||
|
$rechargeInfo = $this->recharge_config->rechargeRule((object)$userInfo, $userInfo['company_id'], $count, 2);
|
||||||
|
$rechargeInfo = json_decode($rechargeInfo, 1);
|
||||||
|
if($rechargeInfo['status'] == 1){
|
||||||
|
$giveFee = $rechargeInfo['data']['gift_fee'];
|
||||||
|
if($giveFee > 0){
|
||||||
|
$rechargePayInfo = array(
|
||||||
|
'admin_id' => $adminId,
|
||||||
|
'rtype' => 1,
|
||||||
|
'ac_type' => 1,
|
||||||
|
'supplier_id' => $supplierId,
|
||||||
|
'notes' => '充值赠送',
|
||||||
|
);
|
||||||
|
$r = gpay_add_user_account_uid($userInfo['id'], floatval($giveFee), $rechargePayInfo);
|
||||||
|
if ($r == 'suc') {
|
||||||
|
$giveContent = ",赠送金额充值成功。";
|
||||||
|
}else{
|
||||||
|
$giveContent = ",赠送金额充值失败。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lwReturn(true, array('msg' => '充值成功'.$giveContent));
|
||||||
} else {
|
} else {
|
||||||
lwReturn(false, array('msg' => '充值失败'));
|
lwReturn(false, array('msg' => '充值失败'));
|
||||||
}
|
}
|
||||||
|
@ -1306,5 +1359,174 @@ class Recharge extends CI_Controller
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 充值赠送配置
|
||||||
|
public function rechargeConfigIndex(){
|
||||||
|
$data['asset'] = $this->asset;
|
||||||
|
$data['pageTitle'] = '充值赠送配置';
|
||||||
|
$data['breadcrumb'] = array(array('充值赠送配置',null));
|
||||||
|
// 只能查询当前公司的配置
|
||||||
|
$this->lw_load->normalLoad($data,'recharge/config/index');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 列表
|
||||||
|
public function rechargeConfigList($page){
|
||||||
|
$this->load->library('lw_pagination2');
|
||||||
|
$param = $this->input->post('param');
|
||||||
|
$start_day = $this->input->post('start_day');
|
||||||
|
$end_day = $this->input->post('end_day');
|
||||||
|
$start_time = $this->input->post('start_time');
|
||||||
|
$end_time = $this->input->post('end_time');
|
||||||
|
$name = $this->input->post('name');
|
||||||
|
|
||||||
|
$companyId = $this->session->userdata('companyId');
|
||||||
|
|
||||||
|
$this->load->model('user_model');
|
||||||
|
|
||||||
|
$where = " company_id='{$companyId}' ";
|
||||||
|
if($start_day){
|
||||||
|
$where .= " and start_day>='{$start_day}' ";
|
||||||
|
}
|
||||||
|
if($end_day){
|
||||||
|
$where .= " and end_day<='{$end_day}' ";
|
||||||
|
}
|
||||||
|
if($start_time){
|
||||||
|
$where .= " and start_time>='{$start_time}' ";
|
||||||
|
}
|
||||||
|
if($end_time){
|
||||||
|
$where .= " and end_time<='{$end_time}' ";
|
||||||
|
}
|
||||||
|
if($name){
|
||||||
|
$where .= " and name like '%{$name}%' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
*
|
||||||
|
from
|
||||||
|
tb_recharge_config
|
||||||
|
where {$where}
|
||||||
|
";
|
||||||
|
|
||||||
|
$hasWhere = true;
|
||||||
|
$group = null;
|
||||||
|
$order = "gift_type asc, idx desc";
|
||||||
|
$action = "getListByPage";
|
||||||
|
$dataName='dataList';
|
||||||
|
$paramFilter = array('name');
|
||||||
|
$data = $this->lw_pagination2->lists($sql,$param,$page,$hasWhere,$group,$order,$action,$dataName,$paramFilter);
|
||||||
|
|
||||||
|
foreach ($data['dataList'] as $k => $v){
|
||||||
|
if($v['user_type_id'] == '*'){
|
||||||
|
$data['dataList'][$k]['user_type_id'] = "全部";
|
||||||
|
}else{
|
||||||
|
$user_type_id = explode(',', $v['user_type_id']);
|
||||||
|
// 去重
|
||||||
|
$user_type_id = array_unique($user_type_id);
|
||||||
|
$user_type_ids = join(",", $user_type_id);
|
||||||
|
$user_type_list = $this->user_model->get_user_type_by_ids($user_type_ids);
|
||||||
|
$user_type_name = array_column($user_type_list, 'name');
|
||||||
|
$data['dataList'][$k]['user_type_id'] = join(',', $user_type_name);
|
||||||
|
}
|
||||||
|
$data['dataList'][$k]['effective_type'] = $v['effective_type'] == 1 ? "app充值" : "后台充值";
|
||||||
|
$data['dataList'][$k]['gift_type'] = $v['gift_type'] == 1 ? "每年" : "每次";
|
||||||
|
}
|
||||||
|
echo $this->load->view('recharge/config/list',$data,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 修改充值赠送配置
|
||||||
|
public function rechargeConfigEdit($id){
|
||||||
|
$this->load->model('recharge_model');
|
||||||
|
$companyId = $this->session->userdata('companyId');
|
||||||
|
$this->load->library('lw_db', array('tb_name' => 'tb_recharge_config'), 'tb_recharge_config');
|
||||||
|
|
||||||
|
$info = $this->input->post();
|
||||||
|
if(isset($info['doSubmit'])){
|
||||||
|
$data['name'] = trim($info['name']);
|
||||||
|
$data['price'] = trim($info['price']);
|
||||||
|
$data['start_amount_range'] = trim($info['start_amount_range']);
|
||||||
|
$data['end_amount_range'] = trim($info['end_amount_range']);
|
||||||
|
$data['start_day'] = trim($info['start_day']);
|
||||||
|
$data['end_day'] = trim($info['end_day']);
|
||||||
|
|
||||||
|
$data['start_time'] = trim($info['start_time']);
|
||||||
|
$data['end_time'] = trim($info['end_time']);
|
||||||
|
|
||||||
|
$data['many_times_consume_start'] = trim($info['many_times_consume_start']);
|
||||||
|
$data['many_times_consume_end'] = trim($info['many_times_consume_end']);
|
||||||
|
|
||||||
|
$data['user_type_id'] = $info['user_type_id'];
|
||||||
|
$data['effective_type'] = $info['effective_type'];
|
||||||
|
$data['gift_type'] = $info['gift_type'];
|
||||||
|
$data['status'] = $info['status'];
|
||||||
|
|
||||||
|
if(empty($data['name'])){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'备注不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif($data['price'] === '' || $data['price'] === null) {
|
||||||
|
echo $this->lw_load->jsonResult(false, array('msg' => '赠送金额不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif($data['start_amount_range'] === '' || $data['start_amount_range'] === null) {
|
||||||
|
echo $this->lw_load->jsonResult(false, array('msg' => '起始金额不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif($data['end_amount_range'] === '' || $data['end_amount_range'] === null) {
|
||||||
|
echo $this->lw_load->jsonResult(false, array('msg' => '结束金额不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif($data['start_day'] > $data['end_day']) {
|
||||||
|
echo $this->lw_load->jsonResult(false, array('msg' => '开始日期不能大于结束日期'));
|
||||||
|
exit;
|
||||||
|
}elseif(empty($data['start_time'])){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'开始时间不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif(empty($data['end_time'])){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'结束时间不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif($data['start_time'] > $data['end_time']){
|
||||||
|
echo $this->lw_load->jsonResult(false, array('msg' => '开始时间不能大于结束时间'));
|
||||||
|
exit;
|
||||||
|
}elseif($data['many_times_consume_start'] === '' || $data['many_times_consume_start'] == null){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'消费起始次数不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif($data['many_times_consume_end'] == '' || $data['many_times_consume_end'] == null){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'消费结束次数不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif(empty($data['user_type_id'])){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'用户类型不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif(empty($data['effective_type'])){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'充值生效类型不能为空'));
|
||||||
|
exit;
|
||||||
|
}elseif(empty($data['gift_type'])){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'赠送类型不能为空'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(in_array("*", $data['user_type_id'])){
|
||||||
|
$data['user_type_id'] = '*';
|
||||||
|
}else{
|
||||||
|
$data['user_type_id'] = ",".join(",", $data['user_type_id']).",";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $this->lw_load->jsonResult($this->tb_recharge_config->update($data, "id='{$id}'"),array('msg'=>'修改规则成功!'));
|
||||||
|
}else{
|
||||||
|
$this->asset = $this->lw_assets->select2($this->asset);
|
||||||
|
$data['asset'] = $this->asset;
|
||||||
|
$configInfo = $this->recharge_model->getRechargeConfigById($id);
|
||||||
|
if(empty($configInfo)){
|
||||||
|
echo $this->lw_load->jsonResult(false,array('msg'=>'获取规则信息失败!'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_type_id = explode(',', $configInfo['user_type_id']);
|
||||||
|
// 去重
|
||||||
|
$user_type_ids = array_unique($user_type_id);
|
||||||
|
$data['config_user_type_id'] = $user_type_ids;
|
||||||
|
|
||||||
|
$data['user_type_list'] = $this->db->query("select id,name from tb_user_type where enabled=1 and company_id='".$companyId."'")->result_array();
|
||||||
|
$data['info'] = $configInfo;
|
||||||
|
$data['id'] = $configInfo['id'];
|
||||||
|
echo $this->load->view('recharge/config/edit',$data,true);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -481,4 +481,8 @@ class Recharge_model extends CI_Model
|
||||||
$data['pageHtml'] = $this->load->view('template/pagination', $data, true);
|
$data['pageHtml'] = $this->load->view('template/pagination', $data, true);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRechargeConfigById($id){
|
||||||
|
return $this->db->get_where('tb_recharge_config', array('id' => $id))->row_array();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,293 @@
|
||||||
|
<?php
|
||||||
|
$info = isset($info) ? $info : array();
|
||||||
|
//$typeList = isset($typeList) ? $typeList : array();
|
||||||
|
//$type = isset($type) ? $type : array();
|
||||||
|
$user_type_list = isset($user_type_list) ? $user_type_list : array();
|
||||||
|
$config_user_type_id = isset($config_user_type_id) ? $config_user_type_id : array();
|
||||||
|
?>
|
||||||
|
<style>
|
||||||
|
.select2-container {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="modal-dialog modal-primary modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<form id="submitForm">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button aria-label="Close" data-dismiss="modal" class="close" type="button"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title">充值赠送配置</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div id="alert"></div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="box box-solid bg-teal-gradient">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">规则信息</h3>
|
||||||
|
</div><!-- /.box-header -->
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="row col-md-12">
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="row margin-bottom">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">备注</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="name" name="name" type="text" class="form-control" value="<?=$info['name']?>" placeholder="请输入备注">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">赠送金额</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="price" name="price" type="text" class="form-control" value="<?=$info['price']?>" placeholder="请输入第一次消费优惠金额">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row margin-bottom">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">充值金额(起)</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="start_amount_range" name="start_amount_range" type="text" class="form-control" value="<?=$info['start_amount_range']?>" placeholder="请输入充值金额(起)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">充值金额(止)</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="end_amount_range" name="end_amount_range" type="text" class="form-control" value="<?=$info['end_amount_range']?>" placeholder="请输入充值金额(止)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row margin-bottom">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">开始日期</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="start_day" name="start_day" type="text" class="form-control form-date" value="<?=$info['start_day']?>" readonly placeholder="选择开始日期">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">结束日期</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="end_day" name="end_day" type="text" class="form-control form-date" value="<?=$info['end_day']?>" readonly placeholder="选择结束日期">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row margin-bottom">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">开始时间</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="start_time" name="start_time" type="text" class="form-control form-time" value="<?=$info['start_time']?>" readonly placeholder="选择开始日期">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">结束时间</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="end_time" name="end_time" type="text" class="form-control form-time" value="<?=$info['end_time']?>" readonly placeholder="选择结束日期">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row margin-bottom">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">用户类型</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<select name="user_type_id[]" class="form-control select2" id="user_type_id" multiple>
|
||||||
|
<option value="*" <?=in_array("*", $config_user_type_id)?"selected":""?>>全部用户类型</option>
|
||||||
|
<?
|
||||||
|
foreach ($user_type_list as $k => $v){
|
||||||
|
$selected = in_array($v['id'], $config_user_type_id)?"selected":"";
|
||||||
|
echo "<option value='{$v['id']}' {$selected}>{$v['name']}</option>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">充值生效类型</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<select name="effective_type" class="form-control" id="effective_type">
|
||||||
|
<option value="1" <?=$info['effective_type'] == 1?"selected":""?>>APP充值</option>
|
||||||
|
<option value="2" <?=$info['effective_type'] == 2?"selected":""?>>后台充值</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row margin-bottom">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">赠送类型</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<select name="gift_type" class="form-control" id="gift_type">
|
||||||
|
<option value="1" <?=$info['gift_type'] == 1?"selected":""?>>按每年</option>
|
||||||
|
<option value="2" <?=$info['gift_type'] == 2?"selected":""?>>按每次</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">是否启用</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<select name="status" class="form-control" id="gift_type">
|
||||||
|
<option value="1" <?=$info['status'] == 1?"selected":""?>>启用</option>
|
||||||
|
<option value="0" <?=$info['status'] == 0?"selected":""?>>停用</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row margin-bottom">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">消费起始次数</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="many_times_consume_start" name="many_times_consume_start" type="text" class="form-control" value="<?=$info['many_times_consume_start']?>" placeholder="消费起始次数">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-md-4">消费结束次数</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<input id="many_times_consume_end" name="many_times_consume_end" type="text" class="form-control" value="<?=$info['many_times_consume_end']?>" placeholder="消费结束次数">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p style="padding-left: 30px;">
|
||||||
|
<small>
|
||||||
|
注:<br>
|
||||||
|
如第1次消费优惠,则这样填写<b style="color: red">0</b>,1<br>
|
||||||
|
如第2次消费优惠,则这样填写<b style="color: red">2</b>,<b style="color: red">2</b> <br>
|
||||||
|
如第5-10次消费优惠,则这样填写<b style="color: red">5</b>,10 <br>
|
||||||
|
如不限次数消费优惠,则这样填写<b style="color: red">0</b>,<b style="color: red">0</b> <br>
|
||||||
|
</small>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.box-body -->
|
||||||
|
</div><!-- /.row -->
|
||||||
|
</div><!-- ./box-body -->
|
||||||
|
</div><!-- /.box -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button data-dismiss="modal" class="btn btn-default" type="button">关闭</button>
|
||||||
|
<button id="submitBtn" type="submit" name="doSubmit" class="btn btn-primary">确认</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$(".select2").select2();
|
||||||
|
$(".form-date").datetimepicker({
|
||||||
|
language: "zh-CN",
|
||||||
|
weekStart: 1,
|
||||||
|
todayBtn: 1,
|
||||||
|
autoclose: 1,
|
||||||
|
todayHighlight: 1,
|
||||||
|
startView: 2,
|
||||||
|
minView: 2,
|
||||||
|
maxView: 4,
|
||||||
|
forceParse: 0,
|
||||||
|
format: 'yyyy-mm-dd'
|
||||||
|
});
|
||||||
|
$(".form-time").datetimepicker({
|
||||||
|
format: 'hh:ii:ss', // 格式为时分秒
|
||||||
|
showMeridian: false, // 不显示上下午
|
||||||
|
useCurrent: false, // 默认不设置当前时间
|
||||||
|
language: 'zh-CN',
|
||||||
|
startView: 1, // 从小时视图开始
|
||||||
|
maxView: 1, // 最大视图为小时
|
||||||
|
minView: 0, // 最小视图为秒
|
||||||
|
forceParse: 0,
|
||||||
|
autoclose: true, // 选择完成后自动关闭
|
||||||
|
pickTime: true, // 允许选择时间
|
||||||
|
minuteStep: 1, // 每步一分钟
|
||||||
|
secondStep: 1, // 每步一秒钟
|
||||||
|
pickerPosition: 'bottom-left' // 选择器位置
|
||||||
|
});
|
||||||
|
var id = "<?=$id?>";
|
||||||
|
|
||||||
|
var submitForm = $('#submitForm');
|
||||||
|
var validator = submitForm.validate({
|
||||||
|
rules: {
|
||||||
|
name: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
// start_day: {
|
||||||
|
// required: true
|
||||||
|
// },
|
||||||
|
// end_day: {
|
||||||
|
// required: true
|
||||||
|
// },
|
||||||
|
start_time: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
end_time: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
price: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
many_times_consume_start: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
many_times_consume_end: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
user_type_id: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
effective_type: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
gift_type: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
start_amount_range:{
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
end_amount_range:{
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitHandler: function (form) {
|
||||||
|
cancelClick("submitBtn");
|
||||||
|
submitForm.ajaxSubmit({
|
||||||
|
url: "<?=site_url('recharge/rechargeConfigEdit')?>/"+id,
|
||||||
|
type: 'post',
|
||||||
|
success: function(data){
|
||||||
|
var data = JSON.parse(data);
|
||||||
|
$.zui.messager.show(data.msg);
|
||||||
|
if(data.success){
|
||||||
|
getListByPage(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
|
@ -0,0 +1,172 @@
|
||||||
|
<?php
|
||||||
|
$list = isset($list) ? $list : array();
|
||||||
|
?>
|
||||||
|
<div class="row">
|
||||||
|
<!--
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">筛选</h3>
|
||||||
|
<div class="box-tools pull-right">
|
||||||
|
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="row col-md-12">
|
||||||
|
<div class="box-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>开始日期</label>
|
||||||
|
<input id="search-start-day" class="form-control form-date" readonly type="text" value="">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>结束日期</label>
|
||||||
|
<input id="search-end-day" class="form-control form-date" readonly type="text" value="">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>开始时间</label>
|
||||||
|
<input id="search-start-time" class="form-control form-time" readonly type="text" value="">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>结束时间</label>
|
||||||
|
<input id="search-end-time" class="form-control form-time" readonly type="text" value="">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<label>备注</label>
|
||||||
|
<input id="search-name" type="text" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-footer">
|
||||||
|
<div class="row col-md-12">
|
||||||
|
<div class="col-md-2 col-md-offset-4">
|
||||||
|
<button class="btn btn-primary btn-block" type="button" onclick="getListByPage(1)">查询</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<button class="btn btn-success btn-block" onclick="configAdd()">添加</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<h3 class="box-title">信息</h3>
|
||||||
|
</div>
|
||||||
|
<div id="dataList" class="box-body">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" tabindex="-1" data-attention-animation="true" id="modalView"></div>
|
||||||
|
<script>
|
||||||
|
var keycode = "";
|
||||||
|
var lastTime = null,
|
||||||
|
nextTime;
|
||||||
|
var lastCode = null,
|
||||||
|
nextCode;
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$(".form-date").datetimepicker({
|
||||||
|
language: "zh-CN",
|
||||||
|
weekStart: 1,
|
||||||
|
todayBtn: 1,
|
||||||
|
autoclose: 1,
|
||||||
|
todayHighlight: 1,
|
||||||
|
startView: 2,
|
||||||
|
minView: 2,
|
||||||
|
maxView: 4,
|
||||||
|
forceParse: 0,
|
||||||
|
format: 'yyyy-mm-dd'
|
||||||
|
});
|
||||||
|
$(".form-time").datetimepicker({
|
||||||
|
language: "zh-CN",
|
||||||
|
weekStart: 1,
|
||||||
|
todayBtn: 1,
|
||||||
|
autoclose: 1,
|
||||||
|
todayHighlight: 1,
|
||||||
|
startView: 1, // 从小时视图开始
|
||||||
|
minView: 0, // 最小视图为小时
|
||||||
|
maxView: 1, // 最大视图为小时
|
||||||
|
forceParse: 0,
|
||||||
|
// showMeridian: 1, // 显示上下午
|
||||||
|
format: 'hh:ii:00' // 格式为时分秒
|
||||||
|
});
|
||||||
|
getListByPage(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
function getParamData() {
|
||||||
|
var startDate = $("#search-start-day").val();
|
||||||
|
var endDate = $("#search-end-day").val();
|
||||||
|
var startTime = $("#search-start-time").val();
|
||||||
|
var endTime = $("#search-end-time").val();
|
||||||
|
var data = {
|
||||||
|
startDate: startDate,
|
||||||
|
endDate: endDate,
|
||||||
|
startTime: startTime,
|
||||||
|
endTime: endTime
|
||||||
|
};
|
||||||
|
var name = $("#search-name").val().trim();
|
||||||
|
if (name != "") {
|
||||||
|
data.name = name;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getListByPage(page) {
|
||||||
|
//参数:
|
||||||
|
var param = Object();
|
||||||
|
var paramEqual = Object();
|
||||||
|
var paramLike = Object();
|
||||||
|
|
||||||
|
var name = $("#search-name").val();
|
||||||
|
var startDate = $("#search-start-day").val();
|
||||||
|
var endDate = $("#search-end-day").val();
|
||||||
|
var startTime = $("#search-start-time").val();
|
||||||
|
var endTime = $("#search-end-time").val();
|
||||||
|
|
||||||
|
$("#dataList").load("<?=site_url('recharge/rechargeConfigList')?>/"+page,{
|
||||||
|
"param":JSON.stringify(param),
|
||||||
|
start_day:startDate,
|
||||||
|
end_day:endDate,
|
||||||
|
startTime: startTime,
|
||||||
|
endTime: endTime,
|
||||||
|
name:name,
|
||||||
|
});
|
||||||
|
|
||||||
|
//$.ajax({
|
||||||
|
// url: "<?php //= site_url('recharge/rechargeConfigList') ?>///" + page,
|
||||||
|
// data: paramData,
|
||||||
|
// type: 'post',
|
||||||
|
// dataType: 'json',
|
||||||
|
// success: function(data) {
|
||||||
|
// if (data.success) {
|
||||||
|
// $("#dataList").html(data);
|
||||||
|
// $("#search-medical-card").attr("value",data.medical_card);
|
||||||
|
// } else {
|
||||||
|
// $.zui.messager.show(data.msg);
|
||||||
|
// $("#dataList").html(data.msg);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//});
|
||||||
|
}
|
||||||
|
function configEdit(id){
|
||||||
|
|
||||||
|
$("#modalView").load("<?=site_url('recharge/rechargeConfigEdit')?>/"+id,function(data){
|
||||||
|
if (!data.match("^\{(.+:.+,*){1,}\}$"))
|
||||||
|
{
|
||||||
|
$("#modalView").modal();
|
||||||
|
}else{
|
||||||
|
var data = JSON.parse(data);
|
||||||
|
if(!data.success){
|
||||||
|
$.zui.messager.show(data.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?php
|
||||||
|
$dataList = isset($dataList) ? $dataList : array();
|
||||||
|
?>
|
||||||
|
<div class="row table-responsive no-padding">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>备注</th>
|
||||||
|
<th>日期段</th>
|
||||||
|
<th>时间段</th>
|
||||||
|
<th>赠送金额</th>
|
||||||
|
<th>充值金额范围</th>
|
||||||
|
<th>消费起始次数</th>
|
||||||
|
<th>消费结束次数</th>
|
||||||
|
<th>用户类型</th>
|
||||||
|
<th>生效的类型</th>
|
||||||
|
<th>赠送的类型</th>
|
||||||
|
<th>是否启用</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (!$dataList) {
|
||||||
|
echo "<td>当前没有数据</td>";
|
||||||
|
} else {
|
||||||
|
$i = 1;
|
||||||
|
foreach ($dataList as $data): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?=$i?></td>
|
||||||
|
<td><?=$data['name']?></td>
|
||||||
|
<td>
|
||||||
|
<?
|
||||||
|
if($data['start_day'] && $data['end_day']) {
|
||||||
|
echo $data['start_day'] . ' 至 ' . $data['end_day'];
|
||||||
|
}else{
|
||||||
|
echo '-';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?
|
||||||
|
if($data['start_time'] && $data['end_time']) {
|
||||||
|
echo $data['start_time'] . ' 至 ' . $data['end_time'];
|
||||||
|
}else{
|
||||||
|
echo '-';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td><?=$data['price'] ?></td>
|
||||||
|
<td><?=$data['start_amount_range']?> ~ <?=$data['end_amount_range']?></td>
|
||||||
|
<td>
|
||||||
|
<?
|
||||||
|
echo $data['many_times_consume_start'] == 0 && $data['many_times_consume_end'] == 0 ? '不限' : "第" . $data['many_times_consume_start'] . '次';
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?
|
||||||
|
echo $data['many_times_consume_start'] == 0 && $data['many_times_consume_end'] == 0 ? '不限' : "第" . $data['many_times_consume_end'] . '次';
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td><?=$data['user_type_id'] ?></td>
|
||||||
|
<td><?=$data['effective_type'] ?></td>
|
||||||
|
<td><?=$data['gift_type'] ?></td>
|
||||||
|
<td><?=$data['status'] == 1?"启用":"停用" ?></td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-sm btn-success" onclick="configEdit(<?=$data['id']?>)">编辑</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php $i++; endforeach;
|
||||||
|
} ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.row -->
|
|
@ -778,7 +778,16 @@
|
||||||
html.push('<span class="minute' + clsName + '">' + hours + ':' + (i < 10 ? '0' + i : i) + '</span>');
|
html.push('<span class="minute' + clsName + '">' + hours + ':' + (i < 10 ? '0' + i : i) + '</span>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.picker.find('.datetimepicker-minutes td').html(html.join(''));
|
// this.picker.find('.datetimepicker-minutes td').html(html.join(''));
|
||||||
|
var addSec = /,s{1,2},/.test( ',' + this.format.parts.join( ',') + ','), sSec = addSec ? '<div><span style="width: 20%">秒:</span><select style="width:70%;height:26px;margin: 1%;">' : '';
|
||||||
|
this.addSec = addSec;
|
||||||
|
if (addSec) {
|
||||||
|
// var orgSec = this.viewDate.getSeconds();
|
||||||
|
var orgSec = '00';
|
||||||
|
for ( var _i = 0; _i < 60; _i++) sSec += '<option value="' + _i + '"' + (_i == orgSec ? ' selected' : '') + '>' + (_i < 10 ? '0' : '') + _i + '</option>';
|
||||||
|
sSec += '</select></div>';
|
||||||
|
}
|
||||||
|
this.picker.find( '.datetimepicker-minutes td').html(html.join( '') + sSec);
|
||||||
|
|
||||||
var currentYear = this.date.getUTCFullYear();
|
var currentYear = this.date.getUTCFullYear();
|
||||||
var months = this.setTitle('.datetimepicker-months', year)
|
var months = this.setTitle('.datetimepicker-months', year)
|
||||||
|
@ -919,6 +928,8 @@
|
||||||
click: function (e) {
|
click: function (e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
///防止选择秒钟选择器日期控件层隐藏
|
||||||
|
if (e.target.tagName == 'SELECT' || e.target.tagName == 'OPTION') return;
|
||||||
var target = $(e.target).closest('span, td, th, legend');
|
var target = $(e.target).closest('span, td, th, legend');
|
||||||
if (target.is('.' + this.icontype)) {
|
if (target.is('.' + this.icontype)) {
|
||||||
target = $(target).parent().closest('span, td, th, legend');
|
target = $(target).parent().closest('span, td, th, legend');
|
||||||
|
@ -996,7 +1007,9 @@
|
||||||
day = this.viewDate.getUTCDate(),
|
day = this.viewDate.getUTCDate(),
|
||||||
hours = this.viewDate.getUTCHours(),
|
hours = this.viewDate.getUTCHours(),
|
||||||
minutes = this.viewDate.getUTCMinutes(),
|
minutes = this.viewDate.getUTCMinutes(),
|
||||||
seconds = this.viewDate.getUTCSeconds();
|
// seconds = this.viewDate.getUTCSeconds();
|
||||||
|
//修改datetimepicker秒钟获取方式
|
||||||
|
seconds = this.addSec ? this.picker.find( 'select').val() : this.viewDate.getUTCSeconds();
|
||||||
|
|
||||||
if (target.is('.month')) {
|
if (target.is('.month')) {
|
||||||
this.viewDate.setUTCDate(1);
|
this.viewDate.setUTCDate(1);
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
<?php
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
class CI_Recharge_config {
|
||||||
|
protected $CI;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->CI = &get_instance();
|
||||||
|
$this->CI->load->database();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $userInfo 用户信息 object
|
||||||
|
* @param $companyId 公司ID
|
||||||
|
* @param $fee 充值金额
|
||||||
|
* @param $effective_type 生效的类型:1app,2后台
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function rechargeRule($userInfo, $companyId, $fee, $effective_type=1){
|
||||||
|
$gift_fee = 0;
|
||||||
|
|
||||||
|
// 把金额转换为分
|
||||||
|
$where = "
|
||||||
|
status='1'
|
||||||
|
and company_id='{$companyId}'
|
||||||
|
and '{$fee}' between start_amount_range and end_amount_range
|
||||||
|
and effective_type='{$effective_type}'
|
||||||
|
";
|
||||||
|
|
||||||
|
$rule_where = $where . " and (CURDATE() BETWEEN start_day and end_day) and (CURTIME() BETWEEN start_time and end_time) ";
|
||||||
|
$datetime_pz = $this->get_recharge_rule($rule_where);
|
||||||
|
|
||||||
|
$pz = array();
|
||||||
|
if(!empty($datetime_pz)){
|
||||||
|
$pz = $datetime_pz;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rule_where = $where . " and CURTIME() BETWEEN start_time and end_time and start_day is null and end_day is null";
|
||||||
|
$time_pz = $this->get_recharge_rule($rule_where);
|
||||||
|
$pz = array_merge($pz, $time_pz);
|
||||||
|
|
||||||
|
if($pz) {
|
||||||
|
foreach ($pz as $k => $v) {
|
||||||
|
$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))) {
|
||||||
|
// 如果规则不含有用户类型 && 不含有*,则跳过
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if($v['gift_type'] == 1){
|
||||||
|
// 每年赠送
|
||||||
|
// 获取今年的充值次数
|
||||||
|
$year_count = $this->get_recharge_count($userInfo->id, $v['gift_type']);
|
||||||
|
|
||||||
|
if($year_count != 0){
|
||||||
|
$year_count = $year_count+1;
|
||||||
|
}
|
||||||
|
if($v['many_times_consume_start'] == 0 && $v['many_times_consume_end'] == 0){
|
||||||
|
// 无限制
|
||||||
|
$gift_fee = $v['price'];
|
||||||
|
}elseif($year_count >= $v['many_times_consume_start'] && $year_count <= $v['many_times_consume_end']){
|
||||||
|
// 在规则的次数内
|
||||||
|
$gift_fee = $v['price'];
|
||||||
|
}else{
|
||||||
|
// 不在规则的次数内,pass
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$count = $this->get_recharge_count($userInfo->id, $v['gift_type']);
|
||||||
|
if($count != 0){
|
||||||
|
$count = $count+1;
|
||||||
|
}
|
||||||
|
// 每次赠送
|
||||||
|
if($v['many_times_consume_start'] == 0 && $v['many_times_consume_end'] == 0) {
|
||||||
|
// 无限制
|
||||||
|
$gift_fee = $v['price'];
|
||||||
|
}elseif($count >= $v['many_times_consume_start'] && $count <= $v['many_times_consume_end']){
|
||||||
|
// 在规则的次数内
|
||||||
|
$gift_fee = $v['price'];
|
||||||
|
}else{
|
||||||
|
// 不在规则的金额内,pass
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode(array(
|
||||||
|
'status' => 1,
|
||||||
|
'message' => 'success',
|
||||||
|
'data' => array(
|
||||||
|
'recharge_fee' => $fee,
|
||||||
|
'gift_fee' => $gift_fee
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function get_recharge_rule($where){
|
||||||
|
$sql = "select * from tb_recharge_config where {$where} order by gift_type asc, idx desc";
|
||||||
|
return $this->CI->db->query($sql)->result_array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $userId 用户ID
|
||||||
|
* @param $gift_type 赠送类型:1每年赠送,2每次赠送
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
private function get_recharge_count($userId, $gift_type){
|
||||||
|
if($gift_type == 1){
|
||||||
|
// 每年赠送
|
||||||
|
return $this->CI->db->query("select count(id) as num from tb_recharge where user_id=? and type=1 and YEAR(record_datetime) = YEAR(CURDATE())", array($userId))->row()->num;
|
||||||
|
}else{
|
||||||
|
// 每次赠送
|
||||||
|
return $this->CI->db->query("select count(id) as num from tb_recharge where user_id=? and type=1", array($userId))->row()->count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -528,6 +528,7 @@ function gpay_add_user_account($account_id, $ac, $info, &$updateInfo = '')
|
||||||
$extra_fee = intval($info['extra_fee']);
|
$extra_fee = intval($info['extra_fee']);
|
||||||
$to_account_id = intval($info['to_account_id']);
|
$to_account_id = intval($info['to_account_id']);
|
||||||
$from_account_id = intval($info['from_account_id']);
|
$from_account_id = intval($info['from_account_id']);
|
||||||
|
$notes = addslashes($info['notes']) ?: null;
|
||||||
|
|
||||||
if ($ac < 0) return 'err';
|
if ($ac < 0) return 'err';
|
||||||
$aInfo = gpay_get_account_by_id($account_id);
|
$aInfo = gpay_get_account_by_id($account_id);
|
||||||
|
@ -558,6 +559,7 @@ function gpay_add_user_account($account_id, $ac, $info, &$updateInfo = '')
|
||||||
'extra_fee' => $extra_fee,
|
'extra_fee' => $extra_fee,
|
||||||
'to_account_id' => $to_account_id,
|
'to_account_id' => $to_account_id,
|
||||||
'from_account_id' => $from_account_id,
|
'from_account_id' => $from_account_id,
|
||||||
|
'notes' => $notes,
|
||||||
);
|
);
|
||||||
$isql = '';
|
$isql = '';
|
||||||
foreach ($jinfo as $key => $value) {
|
foreach ($jinfo as $key => $value) {
|
||||||
|
|
Loading…
Reference in New Issue