|
|
|
@ -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->editOrderIscheck($ids,2,1);
|
|
|
|
|
$this->ajaxReturn(array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
"info"=>"加入结算成功"
|
|
|
|
|
"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')]);
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 充值补单功能
|
|
|
|
|
*/
|
|
|
|
|
public function order_repair() {
|
|
|
|
|
if (IS_AJAX) {
|
|
|
|
|
|
|
|
|
|
//日志
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|