|
|
|
@ -11,6 +11,11 @@ use User\Api\UserApi as UserApi;
|
|
|
|
|
class SpendController extends ThinkController
|
|
|
|
|
{
|
|
|
|
|
const model_name = 'Spend';
|
|
|
|
|
const IsCheckStr=[
|
|
|
|
|
"1"=>"是",
|
|
|
|
|
"2"=>"否"
|
|
|
|
|
];
|
|
|
|
|
public $OpAuthList;
|
|
|
|
|
|
|
|
|
|
public function lists()
|
|
|
|
|
{
|
|
|
|
@ -24,6 +29,10 @@ class SpendController extends ThinkController
|
|
|
|
|
unset($_REQUEST['timestart']);
|
|
|
|
|
unset($_REQUEST['timeend']);
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['is_check'])) {
|
|
|
|
|
$map['is_check'] = (int)($_REQUEST['is_check']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['user_account'])) {
|
|
|
|
|
$map['user_account'] = array('like', trim($_REQUEST['user_account']));
|
|
|
|
|
unset($_REQUEST['user_account']);
|
|
|
|
@ -142,13 +151,13 @@ class SpendController extends ThinkController
|
|
|
|
|
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find());
|
|
|
|
|
|
|
|
|
|
$data = D(self::model_name)->lists($_GET["p"], $map, $order);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$adminUsernameList = getAdminUsernameList(array_column($data['data'], 'market_admin_id'));
|
|
|
|
|
foreach ($data['data'] as $key=>&$value ) {
|
|
|
|
|
($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
|
|
|
|
|
$value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无';
|
|
|
|
|
$value['is_check_str'] = self::IsCheckStr[$value['is_check']];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign('showMarketAdmin', session('user_auth')['show_market_admin']);
|
|
|
|
|
$this->assign('showPromote', session('user_auth')['show_promote']);
|
|
|
|
|
$this->assign('isMarketAdmin', $isMarketAdmin);
|
|
|
|
@ -159,16 +168,72 @@ class SpendController extends ThinkController
|
|
|
|
|
$this->assign('_page', $data['page']);
|
|
|
|
|
$show_data_power = (is_administrator()|| session('user_auth')['show_data']);
|
|
|
|
|
$this->assign('show_data_power', $show_data_power);
|
|
|
|
|
|
|
|
|
|
if(!IS_ROOT){
|
|
|
|
|
$this->OpAuthList= getModuleControllerAuth();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign('menubtn',$this->menuAuth());
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 充值补单功能
|
|
|
|
|
*/
|
|
|
|
|
public function order_repair() {
|
|
|
|
|
if (IS_AJAX) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function menuAuth()
|
|
|
|
|
{
|
|
|
|
|
$mentBtn = [
|
|
|
|
|
"addStatement"=>"<a class='butn' id='addStatement'>参与结算</a>",
|
|
|
|
|
"removeStatement"=>"<a class='butn' id='removeStatement' style='background-color: red;'>移出结算</a>",
|
|
|
|
|
];
|
|
|
|
|
$resarr = [];
|
|
|
|
|
foreach ($mentBtn as $k => $v) {
|
|
|
|
|
if(IS_ROOT){
|
|
|
|
|
$resarr[] = $v;
|
|
|
|
|
}else{
|
|
|
|
|
if(in_array($k,$this->OpAuthList)){
|
|
|
|
|
$resarr[] = $v;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $resarr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function addStatement()
|
|
|
|
|
{
|
|
|
|
|
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
|
|
|
|
|
$ids = $_REQUEST['ids'];
|
|
|
|
|
$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"=>"操作成功"
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
protected function editOrderIscheck($ids,$oldval,$newval){
|
|
|
|
|
$dbres = D(self::model_name)->where("id in ({$ids}) and is_check = '{$oldval}'")->select();
|
|
|
|
|
if(empty($dbres)) return false;
|
|
|
|
|
|
|
|
|
|
$changeIds = implode(",",array_column($dbres,"id"));
|
|
|
|
|
//执行操作
|
|
|
|
|
$res = D(self::model_name)->where("id in ({$changeIds}) and is_check = '{$oldval}'")->save(['is_check'=>$newval]);
|
|
|
|
|
if(empty($res)) return false;
|
|
|
|
|
//日志
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|