优化充值操作

master
chenzhi 4 years ago
parent eeb1821859
commit 74d9d6ed18

@ -2556,14 +2556,14 @@ function getCompanyBlongOther($id = -1)
* array(
* op_type=>操作类型 0:新增1:编辑 2:删除 3:下载,
* op_name=>操作说明 例如:编辑,删除,锁定等,
* url=>需要跳转的url 添加去列表加唯一id编辑直接去编辑页面下载可以重新下载(新开页面),
* url=>U函数可以跳转 的操作地址,
* key=>关键词:用户的账号,游戏的名词等,
* menu=>非必须,菜单目录,不存在的话按控制器寻找。
* )
*/
function addOperationLog($options)
{
$checkarr = ['op_type','url','key'];
$checkarr = ['op_type','key'];
foreach ($checkarr as $v) {
if(!array_key_exists($v,$options)){
return false;
@ -2572,6 +2572,9 @@ function addOperationLog($options)
if(!array_key_exists("op_name",$options)){
$options['op_name'] = ($options['op_type'] == 1 ? "编辑" : ($options['op_type'] == 2 ? "删除" :($options['op_type'] == 3 ? "导出" :"新增")));
}
if(!array_key_exists("url",$options)){
$options['url'] = MODULE_NAME."/".CONTROLLER_NAME."/".ACTION_NAME;
}
//获取ip
$addarray = [
"op_ip"=>$_SERVER['REMOTE_ADDR'],

@ -198,50 +198,42 @@ class SpendController extends ThinkController
public function addStatement()
{
if(!isset($_REQUEST['ids']) || !isset($_REQUEST['type'])) $this->error("参数错误");
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = D(self::model_name)->where("id in ({$ids}) and type = '1'")->select();
if(empty($dbres)){
$this->ajaxReturn(array(
'status' => 1,
"info"=>"加入结算成功"
));
}
$ids = array_column($dbres,"id");
foreach ($dbres as $key=>$value) {
if($value['withdraw_type'] !=3) {
$this->DBModel->where("id = {$value['id']} and verify_status = 0")->delete();
} else {
$this->DBModel->where("id = {$value['id']} and verify_status != 2")->delete();
}
}
addOperationLog(['op_type'=>2,'key'=>$ids,"op_name"=>"删除结算单",'url'=>U('lists')]);
$this->editOrderIscheck($ids,2,1);
$this->ajaxReturn(array(
'status' => 1,
"info"=>"操作成功"
));
}
public function removeStatement()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$this->editOrderIscheck($ids,1,2);
$this->ajaxReturn(array(
'status' => 1,
"info"=>"删除成功"
"info"=>"操作成功"
));
}
protected function editOrderIscheck($ids,$oldval,$newval){
$dbres = D(self::model_name)->where("id in ({$ids}) and type = '{$oldval}'")->select();
$dbres = D(self::model_name)->where("id in ({$ids}) and is_check = '{$oldval}'")->select();
if(empty($dbres)) return false;
$changeIds = array_column($dbres,"id");
$changeIds = implode(",",array_column($dbres,"id"));
//执行操作
$res = D(self::model_name)->where("id in ({$changeIds}) and type = '{$oldval}'")->save(['is_check'=>$newval]);
$res = D(self::model_name)->where("id in ({$changeIds}) and is_check = '{$oldval}'")->save(['is_check'=>$newval]);
if(empty($res)) return false;
return array_column($dbres,"id");
//日志
if($newval == 1){
$op_name = "加入结算";
$key = "addStatement";
}else{
$op_name = "移出结算";
$key = "removeStatement";
}
addOperationLog(['op_type'=>1,'key'=>$key,"op_name"=>$op_name,"content"=>json_encode(["ids"=>$_REQUEST['ids'],"is_check"=>$newval])]);
return true;
}
/**
* 充值补单功能
*/
public function order_repair() {
if (IS_AJAX) {
}
}
}

@ -262,7 +262,7 @@
<else/>
<volist name="list_data" id="data">
<tr>
<td ><input class="ids" type="checkbox" data-status="{$data.verify_status}" data-export="{$data.can_export}" value="{$data['id']}" name="ids[]"></td>
<td ><input class="ids" type="checkbox" data-ischeck="{$data.is_check}" value="{$data['id']}" name="ids[]"></td>
<td>
<if condition="$show_data_power eq true ">
{$data.pay_order_number}
@ -718,6 +718,63 @@
});
$("#game_name").change();
$("#addStatement,#removeStatement").on("click",function(){
var id = $(this).attr("id");
if(id == "addStatement"){
var opname = "参与结算";
var opurl = "{:U('addStatement')}";
var opst ="[不参与结算]";
var status = [2];
}else if(id=="removeStatement"){
var opname = "移出结算";
var opurl = "{:U('removeStatement')}";
var opst ="[参与结算]";
var status = [1];
}
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
const ischeck = $(elem).data("ischeck");
if($.inArray(ischeck,status) > -1){
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要'+opname+'的操作,仅'+opst+'状态可以进行'+opname+"</font>");
return;
}
text = text.join(",");
layer.confirm('【提示】'+opname+'操作后,相应的结算单需要进行重算后生效', {
btn: ['确认','取消'],
title:false
}, function(index){
layer.close(index);
layer.load(2);
$.ajax({
type: "POST",
url: opurl,
dataType: 'json',
async: true,
data: {ids:text},
success:function(data){
layer.closeAll('loading');
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
})
/**
* 初始化select2单选默认带搜索功能。
*/

Loading…
Cancel
Save