Merge branch 'release' of 8.136.139.249:wmtx/platform into feature/more_finance_20201211

master
chenzhi 4 years ago
commit 7ccf5e5857

@ -47,6 +47,13 @@ class FinancePromoteController extends AdminController
$senddata[$v['p_id']] = $v;
}
$unsenddata = [];
$uncash = self::getJoinUnPayPromoteData([],$istimeselect);
foreach($uncash as $k=>$v){
$unsenddata[$v['p_id']] = $v;
}
//内冲
$inside = self::getJoinPromoteData([],$istimeselect,"promote_coin");
foreach($inside as $k=>$v){
@ -152,11 +159,13 @@ class FinancePromoteController extends AdminController
$v['develop_type_text'] = getCompanyDevelopTypeText($v['develop_type']);
$v['inside_cash_count'] = number_format($v['inside_cash_count'],2,'.','');
$v['allcount'] = number_format($v['cash_count']-0+$v['balance_coin_count']+$v['bind_coin_count'],2,'.','');
$v['unallcount'] = $unsenddata[$k]['cash_count']?$unsenddata[$k]['cash_count']:'0.00';
$count['cash_count'] += $v['cash_count'];
$count['balance_coin_count'] += $v['balance_coin_count'];
$count['bind_coin_count'] += $v['bind_coin_count'];
$count['inside_cash_count'] += $v['inside_cash_count'];
$count['all_count'] += $v['allcount'];
$count['unallcount'] += $v['unallcount'];
$data[] = $v;
}
$data = my_sort($data, $data_order_type, (int)$data_order);
@ -176,10 +185,11 @@ class FinancePromoteController extends AdminController
"balance_coin_count"=>"平台币直充支出",
"bind_coin_count"=>"内充支出",
"inside_cash_count"=>"平台币内充",
"allcount"=>"渠道游戏内充值合计"
"allcount"=>"渠道游戏内充值合计",
"unallcount"=>"渠道游戏内不结算充值合计",
));
}
// dump($data);die();
$pagecount = count($data);
$page = set_pagination($pagecount, $row);
if ($page) {
@ -221,6 +231,91 @@ class FinancePromoteController extends AdminController
$this->meta_title = '公会统计';
$this->display();
}
private function getJoinUnPayPromoteData($map,$istimeselect,$type="spend")
{
// setPowerPromoteIds($map,"s.promote_id");
//推广员相关检索
if (isset($_REQUEST['promote_id'])) {
if ($_REQUEST['promote_id'] == 0) {
$map['s.promote_id'] = 0;
} else {
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
if ($promoter_ids) {
$map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
}
}
}
if (isset($_REQUEST['company_id'])) {
$map['promote.company_id'] = $_REQUEST['company_id'];
}
if (isset($_REQUEST['company_belong'])) {
$map['promote.company_belong'] = $_REQUEST['company_belong'];
}
$isMarketLeader = isMarketLeader();
if ($isMarketLeader) {
$map['promote.admin_id'] = ['gt', 0];
}
if (!empty(I('develop_type'))) {
$map['company.develop_type'] = ['in',I('develop_type')];
}
$adminId = 0;
// $havingPids = [];
$isMarketAdmin = isMarketAdmin();
if ($isMarketAdmin) {
$userAuth = session('user_auth');
$adminId = $userAuth['uid'];
} else {
if (!empty(I('admin_id'))) {
$adminId = I('admin_id');
}
}
/* if ($adminId > 0) {
$havingPids = M('promote', 'tab_')->where(['admin_id' => $adminId])->getField('id', true);
$havingPids = count($havingPids) > 0 ? $havingPids : [0];
} */
if($type == "spend"){
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
$map["s.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
}
if($istimeselect){
$map['s.payed_time']=$istimeselect;
}
if ($isMarketLeader) {
$map['s.market_admin_id'] = ['gt', 0];
}
if ($adminId > 0) {
$map['s.market_admin_id'] = $adminId;
}
$map['s.pay_status']=1;
$map['s.is_check']=2;
$field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name,develop_type,IFNULL(promote.company_belong,0) company_belong";
$query = M()
->table("tab_spend s use index(promote_time)")
->field($field)
->where($map)
->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("tab_promote_company company ON promote.company_id = company.id","left")
->group('p_id');
/* if (count($havingPids) > 0) {
$query->having('p_id in (' . implode(',', $havingPids) . ')');
} */
return $query->select();
}else {
return [];
}
}
private function getJoinPromoteData($map,$istimeselect,$type="spend")
{
// setPowerPromoteIds($map,"s.promote_id");

@ -14,6 +14,7 @@ class FinancialSummaryController extends AdminController
"outer_count"=>"外团",
"outer_branch_count"=>"外团-分发",
"other_group_count"=>"无归属团",
"unsettlement_count"=>"不结算流水",
);
public function _initialize()
{

@ -132,7 +132,7 @@ class FinancialSummarySetController extends \Think\Controller
$map = array(
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
"pay_status"=>1,
);
D("Spend")->addSubsiteWhere($map);
$res = $this->SpendModel
@ -267,7 +267,7 @@ class FinancialSummarySetController extends \Think\Controller
{
$map = array(
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
"pay_status"=>1,
);
D("Spend")->addSubsiteWhere($map,"s");
$res = $this->SpendModel
@ -308,6 +308,7 @@ class FinancialSummarySetController extends \Think\Controller
$inside_nobind_count += ($v['cash_count']*100+$v['balance_coin_count']*100);
}
}
//处理数据
$this->adddata[] = array(
"key_name"=>'inside_count',
@ -350,6 +351,41 @@ class FinancialSummarySetController extends \Think\Controller
"type"=>3,"sort"=>4,
"sum_money"=>number_format($other_group_nobind_count/100, 2, '.', '')
);
$unsettlement_count = 0;
$unsettlement_nobind_count = 0;
$unmap = $map;
$unmap['is_check'] = 2;
$unSettlementRes = $this->SpendModel
->alias('s')
->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count,
IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count,
IFNULL(SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END),0) as bind_coin_count,
promote.company_belong")
->where($unmap)
->join("tab_promote promote ON s.promote_id = promote.id", "left")
->select();
foreach ($unSettlementRes as $key => $value) {
$unsettlement_count += $value['cash_count']*100 + $value['balance_coin_count']*100 + $value['bind_coin_count']*100;
$unsettlement_nobind_count += $value['cash_count']*100 + $value['balance_coin_count']*100;
}
//不结算金额
$this->adddata[] = array(
"key_name"=>'unsettlement_count',
"type"=>2,"sort"=>5,
"sum_money"=>number_format($unsettlement_count/100, 2, '.', '')
);
//不结算金额不含绑币
$this->adddata[] = array(
"key_name"=>'unsettlement_count',
"type"=>3,"sort"=>5,
"sum_money"=>number_format($unsettlement_nobind_count/100, 2, '.', '')
);
}
public function setChannelMoney(){
@ -457,7 +493,7 @@ class FinancialSummarySetController extends \Think\Controller
$map = array(
"s.payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.pay_status"=>1,
"s.merchant_id"=>["GT","0"]
"s.merchant_id"=>["GT","0"],
);
D("Spend")->addSubsiteWhere($map,"s");
$spres=$this->SpendModel

@ -11,6 +11,21 @@ use User\Api\UserApi as UserApi;
class MarketPercentageController extends ThinkController
{
protected $coefficient = [];
protected function _initialize()
{
$coefficient_data = M("coefficient","tab_")->where("1=1")->select();
foreach ($coefficient_data as $key => $value) {
$this->coefficient[$value['pay_time']][$value['admin_id']] = $value['coefficient']/100;
}
parent::_initialize();
}
public function index($row = 10, $p = 1){
$map = [];
@ -367,6 +382,184 @@ class MarketPercentageController extends ThinkController
}
public function addcoefficient() {
$batch = date('Ymd').date('His').sp_random_num(3);
$this->assign("batch",$batch);
$this->meta_title = 'EXCEL导入';
$this->display();
}
public function loopAdd()
{
$p = $_REQUEST;
// $batch = $p['batch'];
$checkarr = $p['checkarr'];
//循环获取添加
if(count($checkarr) < 1){
$this->ajaxReturn(["status"=>1,"msg"=>"ok"]);
}
$data = M("auth_group")
->where(['title'=>['like','%市场专员%']])
->select(false);
$member = M("auth_group_access")
->field("sys_member.nickname,sys_member.real_name,sys_member.uid,sys_auth_group_access.group_id")
->join("left join ({$data}) auth on auth.id = sys_auth_group_access.group_id")
->join("left join sys_member on sys_member.uid = sys_auth_group_access.uid")
->where("auth.title is not null")
->select();
$handle_member = [];
foreach($member as $key => $value) {
$handle_member[$value['real_name']] = $value;
}
$save = [];
$coefficient = M('coefficient',"tab_");
foreach ($checkarr as $k => $v) {
if(!strtotime($v['pay_time'])) {
$this->ajaxReturn(["status"=>0,"msg"=>"导入失败,序号{$v['sort']}行日期格式错误"]);
}
if ($handle_member[$v['nickname']]) {
if ($save[$v['nickname'].$v['pay_time']]) {
$this->ajaxReturn(["status"=>0,"msg"=>"导入失败,序号{$v['sort']}行存在重复记录"]);
}
$hav_coefficient = $coefficient
->where(['admin_id'=>$handle_member[$v['nickname']]['uid'],'pay_time'=>$v['pay_time']])
->find();
if ($hav_coefficient) {
$this->ajaxReturn(["status"=>0,"msg"=>"导入失败,日期{$v['pay_time']}市场员{$handle_member[$v['nickname']]['real_name']}已经存在,请勿重复导入"]);
}
$save[$v['nickname'].$v['pay_time']]['pay_time'] = $v['pay_time'];
$save[$v['nickname'].$v['pay_time']]['real_name'] = $handle_member[$v['nickname']]['real_name'];
$save[$v['nickname'].$v['pay_time']]['admin_id'] = $handle_member[$v['nickname']]['uid'];
$save[$v['nickname'].$v['pay_time']]['nickname'] = $handle_member[$v['nickname']]['nickname'];
$save[$v['nickname'].$v['pay_time']]['coefficient'] = $v['coefficient']*100;
if ($v['coefficient'] > 1) {
$this->ajaxReturn(["status"=>0,"msg"=>"导入失败,序号{$v['sort']}行系数错误,系数超过最大值1"]);
}
} else {
$this->ajaxReturn(["status"=>0,"msg"=>"导入失败,导入的市场员{$v['nickname']}不存在"]);
}
}
$save = array_values($save);
if ($coefficient->addAll($save)) {
$this->ajaxReturn(["status"=>1,"msg"=>"导入成功"]);
}
}
public function coefficientSave() {
$pay_time =date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
if ($_REQUEST['is_get']) {
unset($_GET['is_get']);
$data = $_GET;
$if_coefficientSave = M("market_altogether","tab_")
->where([
'pay_time'=>$pay_time,
'market_check'=>1
])
->find();
if ($if_coefficientSave) {
$this->ajaxReturn(['status'=>0,'msg'=>"市场部已确认,绩效系数再不可修改"]);
}
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
$coefficient_check_detail = "已审批({$admin}<br>".date("Y-m-d H:i:s",time());
$marketSave['coefficient_check'] = 1;
$marketSave['coefficient_check_detail'] = $coefficient_check_detail;
foreach ($data as $key => $value) {
//解析键值信息
$info = explode('-',$key);
$save['nickname'] = $info[0];
$save['admin_id'] = $info[1];
$save['real_name'] = $info[2];
$save['coefficient'] = $value*100;
$save['pay_time'] = $pay_time;
$is_hav = M("coefficient","tab_")
->where([
'pay_time'=>$save['pay_time'],
'admin_id'=>$save['admin_id']
])
->find();
if ($is_hav) {
if ($is_hav['coefficient'] != $save['coefficient']) {
$save['update_time'] = time();
M("coefficient","tab_")
->where([
'pay_time'=>$save['pay_time'],
'admin_id'=>$save['admin_id']
])->save(['coefficient'=>$save['coefficient']]);
}
M("market_altogether","tab_")->where([
'pay_time'=>$save['pay_time'],
'admin_id'=>$save['admin_id']
])->save($marketSave);
} else {
$save['create_time'] = time();
M("coefficient","tab_")->add($save);
M("market_altogether","tab_")->where([
'pay_time'=>$save['pay_time'],
'admin_id'=>$save['admin_id']
])->save($marketSave);
}
}
$this->ajaxReturn(['status'=>1,'msg'=>"绩效系数编辑成功"]);
} else {
$data = M("auth_group")
->where(['title'=>['like','%市场专员%']])
->select(false);
$data = M("auth_group_access")
->field("sys_member.nickname,sys_member.real_name,sys_member.uid,sys_auth_group_access.group_id,IF(coefficient is not NULL, coefficient, 100) coefficient")
->join("left join ({$data}) auth on auth.id = sys_auth_group_access.group_id")
->join("left join sys_member on sys_member.uid = sys_auth_group_access.uid")
->join("left join tab_coefficient on tab_coefficient.admin_id = sys_member.uid and pay_time='{$pay_time}'")
->where("auth.title is not null")
->select();
$this->assign('list_data',$data);
$this->display("coefficient");
}
}
public function marketStaffSettle($row = 10, $p = 1) {
$map = [];
@ -493,13 +686,19 @@ class MarketPercentageController extends ThinkController
$this->checkListOrCountAuthRestMap($map,[]);
if(IS_ROOT){
$this->assign('coefficient_check',true);
$this->assign('market_check',true);
$this->assign('finance_check',true);
$this->assign('coefficient_in_check',true);
}else {
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_coefficient_check");
$this->assign('coefficient_check',$this->checkRule($exportRule,array('in','1,2')));
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_market_check");
$this->assign('market_check',$this->checkRule($exportRule,array('in','1,2')));
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_finance_check");
$this->assign('finance_check',$this->checkRule($exportRule,array('in','1,2')));
$exportRule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME . "_coefficient_in_check");
$this->assign('coefficient_in_check',$this->checkRule($exportRule,array('in','1,2')));
}
$all_data = M("market_altogether","tab_")
@ -546,17 +745,20 @@ class MarketPercentageController extends ThinkController
if(!$value['market_check']) {
$data[$key]['market_check_detail'] = "-----";
//{$admin}<br>".date("Y-m-d H:m:s",time());
}
if (!$value['finance_check']) {
$data[$key]['finance_check_detail'] = "-----";
//{$admin}<br>".date("Y-m-d H:m:s",time());
}
if (!$value['coefficient_check']) {
$data[$key]['coefficient_check_detail'] = "-----";
}
if ($_REQUEST['export']) {
$data[$key]['market_check_detail'] = str_replace("<br>",'',$data[$key]['market_check_detail']);
$data[$key]['finance_check_detail'] = str_replace("<br>",'',$data[$key]['finance_check_detail']);
$data[$key]['coefficient_check_detail'] = str_replace("<br>",'',$data[$key]['coefficient_check_detail']);
}
$market_percentage = json_decode($value['market_percentage'],true);
@ -569,12 +771,20 @@ class MarketPercentageController extends ThinkController
//维护奖金考核比例
$data[$key]['maintain_appraisal_bonuses_ratio'] = $market_percentage['maintain_appraisal_bonuses_ratio'];
$data[$key]['coefficient'] = $this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1;
$month = date("m",strtotime($value['pay_time']));
$yes = date("Y",strtotime($value['pay_time']));
$achievement_bonus = number_format($data[$key]['achievement_bonus'], 2, '.', '');
//绩效系数计算
$data[$key]['achievement_bonus'] = number_format($data[$key]['achievement_bonus'] * ($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
$data[$key]['commission'] = number_format($data[$key]['performance_commission'] + $data[$key]['achievement_bonus'], 2, '.', '');
$data[$key]['wait_commission'] = substr(number_format($value['wait_performance_commission'] + $value['wait_achievement_commission'], 4, '.', ''),0,-2);
$data[$key]['wait_commission'] = substr(number_format($value['wait_performance_commission'] + $value['wait_achievement_commission']*($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 4, '.', ''),0,-2);
$data[$key]['extend_commission'] = $data[$key]['commission'] - $data[$key]['wait_commission'];
// dump($data[$key]['commission']);
//两个起提流水都没达到时,不展示税后毛利
$sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses'];
@ -583,7 +793,6 @@ class MarketPercentageController extends ThinkController
$value['company_profit'] = "0.00";
}
if ($market_percentage['time'] == 1) {
if ($month == '07') {
@ -688,6 +897,8 @@ class MarketPercentageController extends ThinkController
$data[$key]['extend_commission'] = number_format($data[$key]['extend_commission'],2,'.','');
$data[$key]['wait_commission'] = number_format($data[$key]['wait_commission'],2,'.','');
$data[$key]['achievement_bonus'] = $achievement_bonus;
$sum['performance_revenue'] += $data[$key]['performance_revenue'];
$sum['appraisal_bonuses'] += $data[$key]['appraisal_bonuses'];
$sum['performance_commission'] += $data[$key]['performance_commission'];
@ -696,6 +907,8 @@ class MarketPercentageController extends ThinkController
$sum['extend_commission'] += $data[$key]['extend_commission'];
$sum['company_profit'] += $data[$key]['company_profit'];
}
$sum['wait_commission'] = '-------';
$sum['pay_time'] = '总计';
@ -715,9 +928,11 @@ class MarketPercentageController extends ThinkController
'performance_profit'=>'维护税后毛利',
'performance_commission' => '业绩提成',
'achievement_bonus' => '绩效考核奖金',
'coefficient'=>'绩效系数',
'commission' => '当月合计',
'extend_commission' => '应发金额',
'wait_commission' => '待发金额',
'coefficient_check_detail'=>'绩效确认',
'market_check_detail' => '市场部确认',
'finance_check_detail' => '财务部审批'];
@ -786,7 +1001,7 @@ class MarketPercentageController extends ThinkController
// $data[$key]['performance_commission'] = "=ROUND(J{$line}*(F{$line}/100)+J{$line}*(G{$line}/100),2)";
// $data[$key]['achievement_bonus'] = "=ROUND(J{$line}*(H{$line}/100)+J{$line}*(I{$line}/100),2)";
$data[$key]['commission'] = "=ROUND(L{$line}+M{$line},2)";
$data[$key]['commission'] = "=ROUND(L{$line}+M{$line}*N{$line},2)";
}
$data = array_merge($data,[$sum]);
@ -952,21 +1167,30 @@ class MarketPercentageController extends ThinkController
$value['company_profit'] = "0.00";
}
$data[$key]['coefficient'] = $this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1;
$data[$key]['wait_commission'] =
number_format($value['wait_performance_commission'] + $value['wait_achievement_commission'], 2, '.', '');
number_format($value['wait_performance_commission'] + $value['wait_achievement_commission']*($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
$achievement_bonus = number_format($data[$key]['achievement_bonus'], 2, '.', '');
$data[$key]['commission'] = $data[$key]['performance_commission'] + $data[$key]['achievement_bonus'];
//绩效系数计算
$data[$key]['achievement_bonus'] = number_format($data[$key]['achievement_bonus'] * ($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
$data[$key]['commission'] = number_format($data[$key]['performance_commission'] + $data[$key]['achievement_bonus'], 2, '.', '');;
$data[$key]['extend_commission'] = $data[$key]['commission'] - $data[$key]['wait_commission'];
$sum['performance_revenue'] += $value['performance_revenue'];
$sum['appraisal_bonuses'] += $value['appraisal_bonuses'];
$data[$key]['achievement_bonus'] = $achievement_bonus;
$sum['company_profit'] += $value['company_profit'];
$sum['performance_commission'] += $value['performance_commission'];
$sum['achievement_bonus'] += $value['achievement_bonus'];
$sum['achievement_bonus'] += $data[$key]['achievement_bonus'];
$sum['commission'] += $data[$key]['commission'];
$sum['extend_commission'] += $data[$key]['extend_commission'] ;
$sum['wait_commission'] += $value['wait_performance_commission'] + $value['wait_achievement_commission'];
$sum['wait_commission'] += $data[$key]['wait_commission'];
}
@ -993,6 +1217,7 @@ class MarketPercentageController extends ThinkController
'company_profit'=>'税后毛利',
'performance_commission' => '业绩提成',
'achievement_bonus' => '绩效考核奖金',
'coefficient'=>'绩效系数',
'commission' => '当月总提成',
'extend_commission' => '本月发放',
'wait_commission' => '本月未发',
@ -1053,51 +1278,6 @@ class MarketPercentageController extends ThinkController
}
}
// $group_config = M("auth_group_access access")
// ->field("market_percentage")
// ->join("left join sys_auth_group auth on access.group_id=auth.id")
// ->where(['uid'=>$_REQUEST['admin_id']])
// ->find();
// $group_config = json_decode($group_config['market_percentage'],true);
// $month = date("m",strtotime($_REQUEST['pay_time']));
// $yes = date("Y",strtotime($_REQUEST['pay_time']));
// if ($group_config['time'] == 1) {
// if ($month == '07') {
// $where = [$yes.'-'.'01',$yes.'-'.'02',$yes.'-'.'03'];
// if ($_REQUEST['all']) {
// $where = array_merge($where,[$yes.'-'.'04',$yes.'-'.'05',$yes.'-'.'06']);
// }
// } elseif($month == '10') {
// $where = [$yes.'-'.'04',$yes.'-'.'05',$yes.'-'.'06'];
// if ($_REQUEST['all']) {
// $where = array_merge($where,[$yes.'-'.'07',$yes.'-'.'08',$yes.'-'.'09']);
// }
// } elseif($month == '04') {
// $where = [($yes-1).'-'.'10',($yes-1).'-'.'11',($yes-1).'-'.'12'];
// if ($_REQUEST['all']) {
// $where = array_merge($where,[$yes.'-'.'01',$yes.'-'.'02',$yes.'-'.'03']);
// }
// } elseif($month == '01') {
// $where = [($yes-1).'-'.'07',($yes-1).'-'.'08',($yes-1).'-'.'09'];
// if ($_REQUEST['all']) {
// $where = array_merge($where,[$yes.'-'.'10',$yes.'-'.'11',$yes.'-'.'12']);
// }
// }
//
// } elseif($group_config['time'] == 2) {
// if ($month == '07') {
// $where = [$yes.'-'.'01',$yes.'-'.'02',$yes.'-'.'03',$yes.'-'.'04',$yes.'-'.'05',$yes.'-'.'06'];
// } elseif($month == '01') {
// $where = [($yes-1).'-'.'07',($yes-1).'-'.'08',($yes-1).'-'.'09',($yes-1).'-'.'10',($yes-1).'-'.'11',($yes-1).'-'.'12'];
// }
// } elseif($group_config['time'] == 3) {
// if ($month == '01') {
// $where = [($yes-1).'-'.'01',($yes-1).'-'.'02',($yes-1).'-'.'03',($yes-1).'-'.'04',($yes-1).'-'.'05',($yes-1).'-'.'06',
// ($yes-1).'-'.'07',($yes-1).'-'.'08',($yes-1).'-'.'09',($yes-1).'-'.'10',($yes-1).'-'.'11',($yes-1).'-'.'12'];
// }
// } else {
// $where = [date("Y-m",strtotime("last month",strtotime($_REQUEST['pay_time'])))];
// }
$save['status'] = 1;
$save['remark'] = '手动发放';
if ($_REQUEST['all']) {
@ -1150,12 +1330,12 @@ class MarketPercentageController extends ThinkController
->where(['group_id'=>['in','11,12,21']])
->select();
if ($admin_data) {
$map['admin_id'] = ['in',array_column($admin_data,'admin_id')];
$map['tab_market_altogether.admin_id'] = ['in',array_column($admin_data,'admin_id')];
}
$_REQUEST['pay_time']?$map['pay_time'] = $_REQUEST['pay_time']:'';
$_REQUEST['real_name']?$map['real_name'] = $_REQUEST['real_name']:'';
$_REQUEST['nickname']?$map['nickname'] = $_REQUEST['nickname']:'';
$_REQUEST['pay_time']?$map['tab_market_altogether.pay_time'] = $_REQUEST['pay_time']:'';
$_REQUEST['real_name']?$map['tab_market_altogether.real_name'] = $_REQUEST['real_name']:'';
$_REQUEST['nickname']?$map['tab_market_altogether..nickname'] = $_REQUEST['nickname']:'';
$_REQUEST['level']?$map['level'] = $_REQUEST['level']:'';
@ -1172,7 +1352,7 @@ class MarketPercentageController extends ThinkController
}while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
$map['tab_market_altogether.pay_time'] = ['in', $search_date];
}
} elseif (isset($_REQUEST['time_start'])) {
@ -1187,7 +1367,7 @@ class MarketPercentageController extends ThinkController
}while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
$map['tab_market_altogether.pay_time'] = ['in', $search_date];
}
} elseif (isset($_REQUEST['time_end'])) {
@ -1202,51 +1382,62 @@ class MarketPercentageController extends ThinkController
}while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
$map['tab_market_altogether.pay_time'] = ['in', $search_date];
}
}
if($_REQUEST['pay_time']) {
if (in_array($_REQUEST['pay_time'],$search_date)) {
$map['pay_time'] = $_REQUEST['pay_time'];
$map['tab_market_altogether.pay_time'] = $_REQUEST['pay_time'];
} elseif(isset($_REQUEST['time_start']) || isset($_REQUEST['time_end'])) {
$this->checkListOrCountAuthRestMap($map,[]);
$this->assign("list_data",[]);
$this->display("showbonuslist");
die();
} else {
$map['pay_time'] = $_REQUEST['pay_time'];
$map['tab_market_altogether.pay_time'] = $_REQUEST['pay_time'];
}
}
$data = M("market_altogether","tab_")
->field("max(pay_time) pay_time,real_name,admin_id,nickname,level,sum(pay_amount) pay_amount,sum(extend_commission) extend_commission,
sum(performance_commission) performance_commission,sum(achievement_bonus) achievement_bonus,
->field("max(tab_market_altogether.pay_time) pay_time,tab_market_altogether.real_name,tab_market_altogether.admin_id,tab_market_altogether.nickname,level,sum(pay_amount) pay_amount,sum(extend_commission) extend_commission,
sum(performance_commission) performance_commission,sum(achievement_bonus* IF(coefficient is not NULL, coefficient, 100)/100) achievement_bonus,
sum(wait_performance_commission)+sum(wait_achievement_commission) wait_amount,
sum(if(status > 0, wait_performance_commission, '0.00')) + sum(if(status > 0, wait_achievement_commission,'0.00')) wait_extend_commission,
sum(if(status = 0, wait_performance_commission, '0.00')) + sum(if(status = 0, wait_achievement_commission, '0.00')) wait_commission, remark,level,status")
sum(if(status > 0, wait_performance_commission, '0.00')) + sum(if(status > 0, wait_achievement_commission,'0.00') * IF(coefficient is not NULL, coefficient, 100)/100 ) wait_extend_commission,
sum(if(status = 0, wait_performance_commission, '0.00')) + round(sum(if(status = 0, wait_achievement_commission,'0.00') * IF(coefficient is not NULL, coefficient, 100)/100),2) wait_commission, remark,status")
->where($map);
if ($_REQUEST['export']) {
$data = $data
->order("pay_time DESC,company_profit DESC")
->group("admin_id")
->select();
->join("left join tab_coefficient on tab_market_altogether.admin_id=tab_coefficient.admin_id and tab_coefficient.pay_time=tab_market_altogether.pay_time")
->order("tab_market_altogether.pay_time DESC,company_profit DESC")
->group("tab_market_altogether.admin_id,tab_market_altogether.pay_time")
->select(false);
} else {
$data = $data
// ->page($p, $row)
->order("pay_time DESC,company_profit DESC")
->group("admin_id")
->select();
->join("left join tab_coefficient on tab_market_altogether.admin_id=tab_coefficient.admin_id and tab_coefficient.pay_time=tab_market_altogether.pay_time")
->order("tab_market_altogether.pay_time DESC,company_profit DESC")
->group("tab_market_altogether.admin_id,tab_market_altogether.pay_time")
->select(false);
}
$data = M()->table("({$data})a")
->field("max(pay_time) pay_time,real_name,admin_id,nickname,level,sum(pay_amount) pay_amount,sum(extend_commission) extend_commission,
sum(performance_commission) performance_commission,sum(achievement_bonus) achievement_bonus,sum(wait_amount) wait_amount,
sum(wait_extend_commission) wait_extend_commission,sum(wait_commission) wait_commission,remark,status")
->group("admin_id")
->select();
// var_dump($data);die();
$sum = [];
$sum['pay_amount'] = 0;
$sum['extend_commission'] = 0;
$sum['wait_commission'] = 0;
foreach($data as $key => $value) {
// dump($value);
if ($value['level'] == 21) {
$data[$key]['level'] = '初级';
} else if ($value['level'] == 11) {
@ -1255,7 +1446,13 @@ class MarketPercentageController extends ThinkController
$data[$key]['level'] = '高级';
}
$data[$key]['commission'] = $data[$key]['performance_commission'] + $data[$key]['achievement_bonus'];
//绩效系数计算
// $data[$key]['achievement_bonus'] = $data[$key]['achievement_bonus'] * ($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1);
$data[$key]['commission'] = number_format($data[$key]['performance_commission'] + $data[$key]['achievement_bonus'], 2, '.', '');
// $data[$key]['wait_commission'] =
// number_format($value['wait_performance_commission'] + $value['wait_achievement_commission']*($this->coefficient[$value['pay_time']][$value['admin_id']]?$this->coefficient[$value['pay_time']][$value['admin_id']]:1), 2, '.', '');
$data[$key]['extend_commission'] = number_format($data[$key]['commission'] - $data[$key]['wait_commission'], 2, '.', '');
$data[$key]['pay_amount'] = number_format($data[$key]['pay_amount'] , 2, '.', '');
@ -1374,7 +1571,7 @@ class MarketPercentageController extends ThinkController
$this->ajaxReturn(['status'=>0,'info'=>'操作失败,id不能为空']);
}
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
$market_check_detail = "市场部已确认({$admin}<br>".date("Y-m-d H:m:s",time());
$market_check_detail = "市场部已确认({$admin}<br>".date("Y-m-d H:i:s",time());
$is_save = M("market_altogether","tab_")
->where(['id'=>['in',$ids],'market_check'=>0])
@ -1397,7 +1594,7 @@ class MarketPercentageController extends ThinkController
}
$admin = $_SESSION['onethink_admin']['user_auth']['username'];
$finance_check_detail = "财务部已审批({$admin}<br>".date("Y-m-d H:m:s",time());
$finance_check_detail = "财务部已审批({$admin}<br>".date("Y-m-d H:i:s",time());
$is_save = M("market_altogether","tab_")
->where(['id'=>['in',$ids],'finance_check'=>0])

@ -319,12 +319,11 @@ class PayChannelController extends ThinkController
$testOrder['test_coin'] = '0';
$testOrder['sum'] = $sum_pay_amount['sum_order_amount'] ?: "0";
//充值方式统计
$payTypeDataExport['game_name'] = '充值方式统计';
foreach($payTypeData as $key => $value) {
if ($value) {
$payTypeDataExport['sdk_version'] .= $key.''.$value." ";
$payTypeDataExport['sdk_version'] .= $key.''.$value['amount']." ";
}
}
$payTypeDataExport['sdk_version'] .= "平台币直充总金额(2019.12.18号以前的不显示在列表中,此项也不计入充值方式统计)".

@ -44,7 +44,7 @@ class PlatformController extends ThinkController
if($isExport){
$data = $data->select();
//生成头
$fp = $this->setPromotePoolTitle($year,"game");
$fp = $this->setGamePoolTitle($year,"game");
}else{
$data = $data->page($page,$row)->select();
$countTable = $gameDb->where($gameMap)->group("relation_game_id")->select(false);
@ -55,14 +55,14 @@ class PlatformController extends ThinkController
$sendData = [];
foreach($data as $k=>$v){
$list = self::setYearList($year);
$list = self::setGameYearList($year);
$this->getGameRegisterCount($list,$v['game_id'],$yearMap);
$this->getGamePayamountCount($list,$v['game_id'],$yearMap);
$v["list"] = $list;
$sendData[] = $v;
if($isExport){
unset($v['game_id'],$v['relation_game_id']);
$fp = $this->setCsvData($fp,$v);
$fp = $this->setGameCsvData($fp,$v);
}
}
if($isExport){
@ -71,7 +71,7 @@ class PlatformController extends ThinkController
exit();
}
$th = array_keys(self::setYearList($year));
$th = array_keys(self::setGameYearList($year));
$this->assign('th', $th);
$this->assign('list_data', $sendData);
$this->assign("companyList",D("PromoteCompany")->getList());
@ -171,6 +171,7 @@ class PlatformController extends ThinkController
$list = self::setYearList($year);
$this->getRegisterCount($list,$promoteIds,$yearMap);
$this->getPayamountCount($list,$promoteIds,$yearMap);
// $this->getunPayamountCount($list,$promoteIds,$yearMap);
$v["list"] = $list;
$v["company_belong"] = getCompanyBlongOther($v["company_belong"]);
$sendData[] = $v;
@ -183,6 +184,8 @@ class PlatformController extends ThinkController
exit();
}
// dump($sendData);die();
$th = array_keys(self::setYearList($year));
$this->assign('th', $th);
$this->assign('list_data', $sendData);
@ -198,6 +201,23 @@ class PlatformController extends ThinkController
}
//获取游戏公司每个月的注册及充值金额
private static function setGameYearList($year)
{
$range = [];
$i = 1;
do {
if($i < 10){
$month = "0".$i;
}else{
$month = $i;
}
$range[$year."-".$month] = ["register"=>0,"payamount"=>0];
$i++;
} while ($i<13);
return $range;
}
//获取公司每个月的注册及充值金额
private static function setYearList($year)
{
@ -209,7 +229,7 @@ class PlatformController extends ThinkController
}else{
$month = $i;
}
$range[$year."-".$month] = ["register"=>0,"payamount"=>0];
$range[$year."-".$month] = ["register"=>0,"payamount"=>0,"unpay_amount"=>0];
$i++;
} while ($i<13);
return $range;
@ -235,10 +255,25 @@ class PlatformController extends ThinkController
"pay_time"=>["between",$yearMap],
"pay_status"=>1
];
$Payamount = M("Spend","tab_")->field("sum(pay_amount) pay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
$Payamount = M("Spend","tab_")->field("sum(IF(is_check=1,pay_amount,0)) pay_amount,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
if(empty($Payamount)) return ;
foreach ($Payamount as $v) {
$list[$v['paytime']]['payamount'] = $v['pay_amount'];
$list[$v['paytime']]['unpay_amount'] = $v['unpay_amount'];
}
}
//获取未结算流水
protected function getunPayamountCount(&$list,$promoteIds,$yearMap)
{
$map = [
"promote_id"=>["in",$promoteIds],
"pay_time"=>["between",$yearMap],
"pay_status"=>1
];
$Payamount = M("Spend","tab_")->field("sum(IF(is_check=2,pay_amount,0)) pay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
if(empty($Payamount)) return ;
foreach ($Payamount as $v) {
$list[$v['paytime']]['unpayamount'] = $v['pay_amount'];
}
}
//获取所有年分
@ -256,6 +291,44 @@ class PlatformController extends ThinkController
}
$this->assign('YearList', $list);
}
//获取导出头
private static function setGamePoolTitle($year,$type="promote")
{
if($type =="promote"){
$range = ["推广公司","内外团归属"];
$csvFileName = '推广公司汇总.csv';
}else{
$range = ["游戏名称"];
$csvFileName = '游戏汇总.csv';
}
$i = 1;
do {
if($i < 10){
$month = "0".$i;
}else{
$month = $i;
}
$range[] = $year."年".$month."月注册数";
$range[] = $year."年".$month."月充值流水";
$i++;
} while ($i<13);
//设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
$fp = fopen('php://output', 'a');//打开output流
mb_convert_variables('GBK', 'UTF-8', $range);
fputcsv($fp, $range);//将数据格式化为CSV格式并写入到output流中
return $fp;
}
//获取导出头
private static function setPromotePoolTitle($year,$type="promote")
{
@ -276,6 +349,7 @@ class PlatformController extends ThinkController
}
$range[] = $year."年".$month."月注册数";
$range[] = $year."年".$month."月充值流水";
$range[] = $year."年".$month."月不结算充值流水";
$i++;
} while ($i<13);
@ -292,6 +366,28 @@ class PlatformController extends ThinkController
return $fp;
}
//获取导出头
private static function setGameCsvData($fp,$data)
{
unset($data['id']);
$sendData = [];
foreach ($data as $key => $value) {
if($key != "list"){
$sendData[] = $value;
}
}
foreach ($data['list'] as $key => $value) {
$sendData[] = $value['register'];
$sendData[] = $value['payamount'];
}
mb_convert_variables('GBK', 'UTF-8', $sendData);
fputcsv($fp, $sendData);//将数据格式化为CSV格式并写入到output流中
ob_flush();
flush();
return $fp;
}
//获取导出头
private static function setCsvData($fp,$data)
{
@ -305,6 +401,7 @@ class PlatformController extends ThinkController
foreach ($data['list'] as $key => $value) {
$sendData[] = $value['register'];
$sendData[] = $value['payamount'];
$sendData[] = $value['unpay_amount'];
}
mb_convert_variables('GBK', 'UTF-8', $sendData);
fputcsv($fp, $sendData);//将数据格式化为CSV格式并写入到output流中
@ -1078,7 +1175,7 @@ class PlatformController extends ThinkController
$data = M('promote', 'tab_')->alias('tp1')
->field('tp1.account as promote_account,tp1.id,g.relation_game_id,g.relation_game_name,
floor(sum(pay_amount)*100) as count')
floor(sum(IF(is_check=1,pay_amount,0))*100) as count,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_count')
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
->join("tab_spend as s use INDEX(search) on tp2.id = s.promote_id", 'left')
->join("tab_game as g on g.id = s.game_id", 'left')
@ -1151,7 +1248,7 @@ class PlatformController extends ThinkController
if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) {
//官方渠道数据添加
$authorityData = M('spend', 'tab_')->alias('s')
->field('floor(sum(pay_amount)*100) as count')
->field('floor(sum(pay_amount)*100) as count,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_count')
->where($map)
->find();
$tauthorityData = M('spend', 'tab_')->alias('s')
@ -1173,6 +1270,9 @@ class PlatformController extends ThinkController
array_push($data, $authorityData);
}
}
// dump($data);die();
//数据排序
$last_names = array_column($data,'count');
array_multisort($last_names,SORT_DESC,$data);
@ -1187,6 +1287,7 @@ class PlatformController extends ThinkController
$i++;
$data[$key]['rand'] = $i;
$data[$key]['count'] = $value['count'] / 100;
$data[$key]['unpay_count'] = $value['unpay_count'] ? $value['unpay_count'] : 0;
$data[$key]['today'] = $value['today'] / 100;
$data[$key]['week'] = $value['week'] / 100;
$data[$key]['mounth'] = $value['mounth'] / 100;
@ -1233,6 +1334,7 @@ class PlatformController extends ThinkController
'admin_username' => '当前市场专员',
'relation_game_name' => '游戏',
"count"=>"累计充值",
"unpay_count"=>"累计充值",
"rand"=>"排行榜",
"today"=>"今日充值",
"week"=>"本周充值",
@ -1256,6 +1358,7 @@ class PlatformController extends ThinkController
public function data_total($data)
{
$total['sum_count'] = array_sum(array_column($data, 'count'));
$total['unpay_count'] = array_sum(array_column($data, 'unpay_count'));
$total['sum_today'] = array_sum(array_column($data, 'today'));
$total['sum_week'] = array_sum(array_column($data, 'week'));
$total['sum_mounth'] = array_sum(array_column($data, 'mounth'));

@ -327,8 +327,8 @@ class StatementMangementController extends ThinkController
->field('r.id')
->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')
->where($map)
->order("r.id desc")
->group('r.id')
->order('create_time DESC')
->select();
if ($result) {
@ -346,12 +346,13 @@ class StatementMangementController extends ThinkController
$list = M('reward_record', 'tab_')->alias('r')
->field('
r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,r.create_time,
r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,
rd.id as rid, rd.type as detail_type, rd.company_type as detail_company_type, rd.company_id as detail_company_id , rd.company_name as detail_company_name, rd.settlement_type as detail_settlement_type, rd.promote_account as detail_promote_account,rd.amount as detail_amount
')
->where($map)
->order("rid desc")
->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')->select();
->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')
->order('create_time DESC')
->select();
if ($list) {
$record = [];
foreach ($list as $item) {
@ -399,7 +400,7 @@ class StatementMangementController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
krsort($record);
// ksort($record);
$this->assign('list', $record);
$this->assign('promoters', array_column(M('promote', 'tab_')->where(['level'=>1])->field('id, nickname, account')->select(), null, 'id'));
@ -519,8 +520,15 @@ class StatementMangementController extends ThinkController
}
$settlmentSet = array_merge($settlment_info[RewardModel::REWARD_TYPE_REWARD] ?? [], $settlment_info[RewardModel::REWARD_TYPE_PUNISH] ?? []);
// dump($settlmentSet);die();
if ($id) {
$checkReward = $this->checkRewardDetail($settlmentSet);
if ($checkReward) {
return $this->error("奖惩确认时间需在结算时间以后,请重新选择");
}
$upt = M('reward_record', 'tab_')->where(['id'=>$id])->save($data);
if ($upt === false) {
$this->error('保存失败');
@ -535,6 +543,11 @@ class StatementMangementController extends ThinkController
}
} else {
$checkReward = $this->checkRewardDetail($settlmentSet);
if ($checkReward) {
return $this->error("奖惩确认时间需在结算时间以后,请重新选择");
}
$data['create_time'] = time();
$data['creater_id'] = is_login();
$ins = M('reward_record', 'tab_')->add($data);
@ -608,6 +621,38 @@ class StatementMangementController extends ThinkController
}
}
public function checkRewardDetail($settlmentSet = []) {
foreach ($settlmentSet as $key => $value) {
if ($value['company_id']) {
$sql = "(select statement_begin_time,statement_end_time,company_id,company_name from tab_company_statement
union all select statement_begin_time,statement_end_time,company_id,company_name from tab_company_statement_info
union all select statement_begin_time,statement_end_time,company_id,company_name from tab_company_lack_statement_info where is_pool=0)statement_info";
$data = M()->table("$sql")
->where(
[
'statement_begin_time'=>['elt',$value['confirm_time']],
'statement_end_time'=>['egt',$value['confirm_time']],
'company_id'=>$value['company_id']
]
)
->select();
if ($data) {
return true;
}
}
}
return false;
}
public function rewardManageDetail($id=0)
{
$games = M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select();

@ -830,6 +830,7 @@ class TimingController extends AdminController {
continue;
}
$amount_time['is_check'] = ['neq',2];
$amount_time['tab_spend.pay_status'] = 1;
$amount_time['pay_way'] = ['egt',0];
$amount_time['_string'] = "payed_time between {$statement_begin_time} and {$statement_end_time} and relation_game_id={$v['relation_game_id']}";
@ -980,7 +981,7 @@ class TimingController extends AdminController {
->join("left join tab_game game on tab_spend.game_id = game.id")
->join("left join tab_promote promote on tab_spend.promote_id = promote.id")
->where($map)
->where(['payed_time'=>['between',[$begintime,$endtime]],'company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'market_admin_id'=>$admin_id])
->where(['payed_time'=>['between',[$begintime,$endtime]],'company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'market_admin_id'=>$admin_id,'is_check'=>['neq',2]])
->group("tab_spend.id")
->select(false);
@ -1089,7 +1090,7 @@ class TimingController extends AdminController {
$spend = M("spend","tab_")
->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(pay_time,'%Y-%m') pay_time,
substring_index(substring_index(tab_spend.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_spend.sdk_version,
CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id,0 is_settlement")
CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id,0 is_settlement,is_check")
->join("left join tab_promote on tab_spend.promote_id = tab_promote.id")
->join("left join tab_game game on game.id=tab_spend.game_id")
->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',0]])
@ -1111,7 +1112,7 @@ class TimingController extends AdminController {
$unsettlement_spend = M("spend","tab_")
->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(pay_time,'%Y-%m') pay_time,
substring_index(substring_index(tab_spend.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_spend.sdk_version,
CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id,1 is_settlement")
CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id,1 is_settlement,is_check")
->join("left join tab_promote on tab_spend.promote_id = tab_promote.id")
->join("left join tab_game game on game.id=tab_spend.game_id")
->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',0]])
@ -1123,6 +1124,7 @@ class TimingController extends AdminController {
$payway_spend = M()->table("({$spend}) spend")
->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,pay_way,sdk_version,market_admin_id,is_settlement")
->where(['is_check'=>['neq',2]])
->where($map)
->group("pay_time,promote_id,game_name,pay_way,market_admin_id,is_settlement")
->select();
@ -1189,6 +1191,7 @@ class TimingController extends AdminController {
$spend = M()->table("({$spend}) spend")
->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,sdk_version,market_admin_id,is_settlement")
->where(['is_check'=>['neq',2]])
->where($map)
->group("pay_time,promote_id,game_name,market_admin_id,is_settlement")
->select(false);

@ -220,7 +220,8 @@
<else />平台币内充<img src="__IMG__/up-down.png" width="13px">
</if>
</a> <span class="tooltiptext">管理后台直接下放给会长的平台币,因存在平台币回收,所以可能会存在负值</span> </th>
<th class="tooltip">渠道游戏内充值合计 <span class="tooltiptext">游戏现金金额(游戏现金流水+平台币支出+公会内充支出=总流水</span>
<th class="tooltip">渠道游戏内充值合计 <span class="tooltiptext">游戏现金金额(游戏现金流水+平台币支出+公会内充支出=总流水)</span>
<th class="tooltip">渠道游戏内不结算充值合计 <span class="tooltiptext">游戏现金金额(游戏不结算现金流水)</span>
</th>
<th>操作</th>
</tr>
@ -250,6 +251,7 @@
<!-- <td><span class='ljzc'
data-value="{$data['id']}"><a>{$data.inside_cash_count}</a></span></td> -->
<td>{$data.allcount}</td>
<td>{$data.unallcount}</td>
<td>
@ -274,6 +276,7 @@
<td style="text-align: center;">{$all_count['bind_coin_count']}</td>
<td style="text-align: center;">{$all_count['inside_cash_count']}</td>
<td style="text-align: center;">{$all_count['all_count']}</td>
<td style="text-align: center;">{$all_count['unallcount']}</td>
<td style="text-align: center;">
<a
href="{:U('FinancePromote/gameStatistics',array_merge(I('get.'),['promote_type'=>1,'p'=>1]))}">游戏查看</a>

@ -0,0 +1,461 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
a:link ,a:visited,a:hover,a:active { text-decoration: none;}
.select2-results__option[aria-selected] {font-size:12px;}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
.data_list table td{
line-height: 2;
}
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
.main-place .question_content:before{
right: 20px;
left: auto;
}
.tabcon1711 td:first-child {
width: auto;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">新增excel导入</h3>
<p class="description_text">说明:导入绩效数据</p>
</div>
<!-- 标签页导航 -->
<div class="tab-wrap" style="display: flex;">
<div class="tab-content tabcon1711" style="min-width:700px;">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l">本次批次号:</td>
<td class="r">
<div class="input-list" id="batch" style="margin-left: 0;line-height: 30px;font-size: 16px;">
</div>
<span class="notice-text" style="margin-left: 20px;">用于检索使用</span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>文件上传:</td>
<td class="r">
<div class="input-list" style="margin-left: 0;">
<input type="file" id="fileinput" name="file">
</div>
<span class="notice-text" style="margin-left: 0;">暂只支持.xls .xlsx 格式文件</span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn" id="submit_btn">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">
返回
</a>
</div>
</div>
</div>
<div style="margin-top: 60px;" id="firle">
<div style="width: 100%;height: 45px;font-size: 16px;">
文件格式参考:<span style="color: #777;font-size: 12px;margin-left: 20px;">请严格按此格式,文件的第一行必须是字段名,且字段名不允许修改</span>
</div>
<style>
#firle td,#firle th{
padding: 10px 5px;
}
</style>
<table id="cktable" style="width: 100%;margin: 0;padding: 0;text-align: center;border: 1px solid #777;" border="1px">
<thead>
<tr>
<th>序号</th>
<th>时间</th>
<th>市场专员</th>
<th>绩效系数</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2020-09</td>
<td>林某某</td>
<td>1</td>
</tr>
</tbody>
</table>
</div>
<div style="width: 100vw;height: 100vh;padding: 0;position: absolute;top: 0;z-index: 9999;display: none;" id="creat_msg">
<div class="layui-layer layui-layer-dialog layui-layer-border layui-layer-msg layui-layer-hui"
type="dialog" times="1" showtime="50000" contype="string" style="z-index: 19891015; top:30%; left:30%;">
<div class="layui-layer-content" style="padding: 15px 0 5px;font-size: 20px;font-weight: 600;">执行进度</div>
<div id="tip_msg" class="layui-layer-content">开始时间与结束时间都不允许为空</div>
<div class="layui-layer-content" style="padding: 5px 10px 15px;font-size: 10px;color: #BBB;">TIP:未执行完成之前请勿刷新或关闭此页面</div>
<span class="layui-layer-setwin"></span>
</div>
</div>
</block>
<block name="script">
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript" src="__STATIC__/xlsx.core.min.js" charset="UTF-8"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('MarketPercentage/marketStaffSettle')}');
var MSG={
showmsg:function(str){
$("#creat_msg").show();
$("#tip_msg").html(str);
},
hidemsg:function(){
$("#creat_msg").hide();
$("#tip_msg").html('');
}
}
var COMPARE={
publiucAjax:function(url,senddata,callback){
$.ajax({
type: 'post',
url: url,
data:senddata,
success: function(data) {
if(data.status == 1){
callback();
}else{
MSG.hidemsg();
layer.alert(data.msg);
return false;
}
},
error:function(){
MSG.hidemsg();
layer.alert("网络错误或超时");
return false;
}
});
},
//循环比较
loopCheck:function(page,callback){
if(page > sendDefaultData.check_page){
MSG.showmsg("添加成功,执行跳转中");
callback();
return;
}
var senddata = {
statement_begin_time:sendDefaultData.begin_time,
statement_end_time:sendDefaultData.end_time,
batch:sendDefaultData.batch,
checkarr:sendDefaultData.filedata.splice(0,check_size)
}
COMPARE.publiucAjax("{:U('loopAdd')}",senddata,function(data){
var checkok = page*check_size > sendDefaultData.filedata_count ? sendDefaultData.filedata_count : page*check_size;
MSG.showmsg("数据插入 ["+checkok+"/"+sendDefaultData.filedata_count+"] ......");
page++;
COMPARE.loopCheck(page,callback)
});
},
checkData:function(callback){
MSG.showmsg("数据校验中...");
var d = sendDefaultData.filedata;
for (const key in d) {
var c = d[key].company_info;
}
callback();
}
}
</script>
<script type="text/javascript">
var isfile = false;
var rABS = false; //是否将文件读取为二进制字符串
var check_size = 10;//每次验证的数量
var batch = '{$batch}';
var sendDefaultData = {
"filedata_count": 0,
"check_page":0,
"filedata":[],
"pay_way":-1,
"batch":batch
}
$("#batch").html(batch);
$(function () {
$("#submit_btn").on("click", function () {
//获取文件
if (!isfile) {
layer.msg('excel文件不能为空');
return false;
}
//执行
readFileInput(function () {
if(sendDefaultData.filedata_count == 0){
MSG.hidemsg();
layer.msg('excel内容不能为空');
return false;
}
//获取需要循环的次数
sendDefaultData.check_page = Math.ceil(sendDefaultData.filedata_count/check_size);
COMPARE.checkData(function(){
COMPARE.loopCheck(1,function(){
setTimeout(function(){
window.location.href="{:U('marketStaffSettle')}";
},1500);
})
});
})
})
$("#fileinput").change(function () {
var p = $(this).val();
var ext = p.substr(p.lastIndexOf(".")).toLowerCase();
if (ext != ".xls" && ext != ".xlsx") {
layer.msg("文件仅支持excel文件格式");
$(this).val('');
p = '';
}
if (p != '') {
isfile = true;
} else {
isfile = false;
}
})
});
function readFileInput(callback) {
MSG.showmsg("读取excle中。。。");
var wb;//读取完成的数据
var f = $("#fileinput")[0].files[0];
var reader = new FileReader();
if (rABS) {
reader.readAsArrayBuffer(f);
} else {
reader.readAsBinaryString(f);
}
reader.onload = function (e) {
MSG.showmsg("文件读取完成,添加命令初始化。。。");
var data = e.target.result;
if (rABS) {
wb = XLSX.read(btoa(fixdata(data)), {
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
}
// console.log(wb);
try {
var filedata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
sendDefaultData.filedata = resetCount(filedata);
sendDefaultData.filedata_count = sendDefaultData.filedata.length;
callback();
} catch (error) {
MSG.hidemsg();
isfile = false;
layer.msg('excel内容不符或不能为空');
return false;
}
// document.getElementById("demo").innerHTML= JSON.stringify( XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]) );
};
}
function resetCount(fdata){
var titleKey={
"序号": "sort",
"时间": "pay_time",
"市场专员": "nickname",
"绩效系数":"coefficient",
}
var data = [];
//临时公司
var temp ={};
var game_name = '';
var game_type= '';
for (let index = 0; index < fdata.length; index++) {
const e = fdata[index];
//全量公司
if (e.hasOwnProperty("序号")) {
if(index != 0){
temp.pay_time = temp.pay_time;
temp.nickname = temp.nickname;
temp.coefficient = temp.coefficient;
data.push(temp);//上次的走掉
temp ={};//重置
}
// var acc = {
// game_list:[]
// };
// var gamet = {}
for (const k in e) {
temp[titleKey[k]] = e[k];
}
// if(!gamet.hasOwnProperty("game_name")){
// gamet.game_name =game_name;
// }
// if(!gamet.hasOwnProperty("game_type_name")){
// gamet.game_type_name =game_type;
// }
// acc.game_list.push(gamet);
// temp.statement_info.push(acc);
continue;
}
//含会长信息
if (e.hasOwnProperty("会长账号")) {
// var acc = {
// game_list:[]
// };
// var gamet = {}
for (const k in e) {
temp[titleKey[k]] = e[k];
}
// if(!gamet.hasOwnProperty("game_name")){
// gamet.game_name =game_name;
// }
// if(!gamet.hasOwnProperty("game_type_name")){
// gamet.game_type_name =game_type;
// }
// acc.game_list.push(gamet);
// temp.statement_info.push(acc);
continue;
}
//只含有游戏的信息
var gamet = {}
for (const k in e) {
temp[titleKey[k]] = e[k];
}
// if(!gamet.hasOwnProperty("game_name")){
// gamet.game_name =game_name;
// }
// if(!gamet.hasOwnProperty("game_type_name")){
// gamet.game_type_name =game_type;
// }
//
// temp.statement_info[temp.statement_info.length-1].game_list.push(gamet);
}
//判断
// temp.statement_money = temp.statement_money/100;
// temp.platform_amount = temp.platform_amount/100;
// temp.fine = temp.fine/100;
// temp.reward = temp.reward/100;
data.push(temp);//最后一次
return data;
}
function getNowDate(){
var da = new Date();
var trade =da.getFullYear();
var mt =da.getMonth() + 1 >10 ? da.getMonth() + 1 : "0"+(da.getMonth() + 1);
var dt =da.getDate() >=10 ? da.getDate() : "0"+da.getDate();
var dh =da.getHours() >=10 ? da.getHours() : "0"+da.getHours();
var dm =da.getMinutes() >=10 ? da.getMinutes() : "0"+da.getMinutes();
var ds =da.getSeconds() >=10 ? da.getSeconds() : "0"+da.getSeconds();
var dms =(Array(3).join(0) + da.getMilliseconds()).slice(-3);
return trade+=""+mt+""+dt+""+dh+""+dm+""+ds+''+dms;
}
function fixdata(data) { //文件流转BinaryString
var o = "",
l = 0,
w = 10240;
for (; l < data.byteLength / w; ++l) o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
return o;
}
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
</script>
</block>

@ -0,0 +1,169 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script src="__STATIC__/table2excel.js"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px 10px 150px 10px;
/* width: 960px; */
margin: auto;
}
/* .tabcon1711 table{
width: 480px;
} */
table{
margin: auto;
}
tr{
border-bottom: dotted 1px #c7c7c7;
}
.hidebox{
display: none;
}
.r{
width: 300px;
}
.l{
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list, .i_list {
float: left;
margin: 0;
}
#statementShow td{
line-height: 1.5;
padding: 8px 0;
}
</style>
<body>
<!-- <div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
海南万盟天下科技有限公司
</div> -->
<div class="data_list box_mt" style="margin-top: 10px;0">
<div class="">
<form id="form" action="{:U('coefficientSave')}" method="post" class="form-horizontal">
<table id="exporttable">
<!-- 表头 -->
<thead>
</thead>
<tbody id="statementShow">
<if condition = "empty($list_data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<volist name="list_data" id="data">
<tr>
<td >{$data['real_name']}</td>
<td ><input style="width: auto;" name="{$data['nickname']}-{$data['uid']}-{$data['real_name']}" value="{$data['coefficient']/100}"></td>
</tr>
</volist>
</tbody>
</table>
<div class="jssearch fr cf search_list" style="width: 100%;">
<a class="sch-btn" id="jssearch" url="{:U('coefficientSave')}" style="width: 120px;margin-top: 20px;margin-right: 20px;float: right;">提交保存</a>
</div>
</form>
</div>
</div>
</body>
</html>
<script type="text/javascript">
$("#jssearch").click(function(){
var url = $(this).attr('url');
var query = $('table').find('input').serialize();
query += "&" + $('table').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
url += '&is_get=1';
layer.confirm('【提示】是否确认财务部编辑保存', {
btn: ['确认','取消'],
title:false
}, function(index){
$.ajax({
url:url,
type:"post",
dataType:'json',
success:function(data){
if (data.status == 1) {
layer.msg(data.msg);
setTimeout(function(){
window.parent.reload()
},2000)
} else {
layer.msg(data.msg);
}
}
})
});
});
</script>

@ -58,6 +58,47 @@
right: 20px;
left: auto;
}
.tooltip {
position: relative;
display: inline-block;
color: #056dae;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 250%;
background-color: #fff;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
margin-left: -70%;
border: #000 solid 1px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #000;
visibility: visible;
line-height: 20px;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
@ -127,12 +168,18 @@
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<if condition="$coefficient_check eq true">
<a class='butn' id='coefficient_check' style='background-color: #3C95C8;'>绩效确认</a>
</if>
<if condition="$market_check eq true">
<a class='butn' id='market_check' style='background-color: #3C95C8;'>市场部确认</a>
</if>
<if condition="$finance_check eq true">
<a class='butn' id='finance_check' style='background-color: #3C95C8;'>财务部审批</a>
</if>
<if condition="$coefficient_in_check eq true">
<a class='butn' id='coefficient_in_check' href="{:U('addcoefficient')}" style='background-color: #3C95C8;'>绩效导入</a>
</if>
</div>
</div>
@ -148,13 +195,15 @@
<th>时间</th>
<th>市场专员</th>
<th>级别</th>
<th>开发总流水</th>
<th>维护总流水</th>
<th><div class="tooltip">开发总流水<span class="tooltiptext"><span style="margin-left: -10px">当月自主开发下渠道游戏内充值总和</span></span></div></th>
<th><div class="tooltip">维护总流水<span class="tooltiptext"><span style="margin-left: -10px">当月只维护下渠道游戏内充值总和</span></span></div></th>
<th >业绩提成</th>
<th >绩效考核奖金</th>
<th ><div class="tooltip">绩效考核奖金<span class="tooltiptext"><span style="margin-left: -10px">当月开发税后毛利奖金与维护税后毛利奖金之和</span></span></div></th>
<th >绩效系数</th>
<th>当月合计</th>
<th>应发金额</th>
<th>本月应发金额</th>
<th>待发金额</th>
<th>绩效确认</th>
<th>市场部确认</th>
<th>财务部审批</th>
</tr>
@ -170,7 +219,7 @@
<notemtpy name = "list_data">
<volist name="list_data" id="data">
<tr>
<td><input class="ids" type="checkbox" value="{$data['id']}" data-market_check="{$data['market_check']}" data-finance_check="{$data['finance_check']}" name="ids[]"></td>
<td><input class="ids" type="checkbox" value="{$data['id']} "data-coefficient_check="{$data['coefficient_check']}" data-market_check="{$data['market_check']}" data-finance_check="{$data['finance_check']}" name="ids[]"></td>
<td>{$data.pay_time|default='无'}</td>
<td>{$data.real_name|default='无'}</td>
<td>{$data.level|default='无'}</td>
@ -179,9 +228,11 @@
<td><a href="{:U('FinancePromote/index',array('time_start'=>$data['start_time'],'time_end'=>$data['end_time'],'admin_id'=>$data['admin_id'],'develop_type'=>3))}" >{$data['appraisal_bonuses']|default='0.00'}</a></td>
<td>{$data['performance_commission']|default='0.00'}</td>
<td>{$data['achievement_bonus']|default='0.00'}</td>
<td>{$data['coefficient']|default='1'}</td>
<td>{$data['commission']|default='0.00'}</td>
<td><a href="{:U('MarketPercentage/personMarketStaffSettle',array('time_start'=>$data['start_time'],'time_end'=>$data['end_time'],'admin_id'=>$data['admin_id']))}" >{$data['extend_commission']|default='0.00'}</a></td>
<td><a href="{:U('MarketPercentage/showBonusList',array('time_start'=>$data['start_time'],'time_end'=>$data['end_time'],'real_name'=>$data['real_name'],'level'=>$data['group_id']))}" >{$data['wait_commission']|default='0.00'}</a></td>
<td><if condition="$data.coefficient_check eq 0"><span ></if>{$data['coefficient_check_detail']|default=''}<if condition="$data.market_check eq 1"></span></if></td>
<td><if condition="$data.market_check eq 0"><span ></if>{$data['market_check_detail']|default=''}<if condition="$data.market_check eq 1"></span></if></td>
<td><if condition="$data.finance_check eq 0"><span ></if>{$data['finance_check_detail']|default=''}<if condition="$data.market_check eq 1"></span></if></td>
</tr>
@ -199,11 +250,13 @@
</td>
<td>{$sum['performance_commission']|default='0.00'}</td>
<td>{$sum['achievement_bonus']|default='0.00'}</td>
<td></td>
<td>{$sum['commission']|default='0.00'}</td>
<td><a href="{:U('MarketPercentage/personMarketStaffSettle',array('time_start'=>$start_time,'time_end'=>$end_time))}" >{$sum['extend_commission']|default='0.00'}</a></td>
<td></td>
<td></td>
<td></td>
<td></td>
</notemtpy>
</tbody>
</table>
@ -236,17 +289,44 @@
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('MarketPercentage/marketStaffSettle')}');
function reload(){
location.reload();
}
$(function(){
$("#coefficient_check").on("click",function() {
layer.open({
type: 2,
title: "绩效确认",
shadeClose: true
,area: ['100%','100%']
,top:50
,content: '{:U("MarketPercentage/coefficientSave")}'
,cancel: function(){
//右上角关闭回调
//return false 开启该代码可禁止点击该按钮关闭
}
});
});
$("#market_check").on("click",function(){
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("market_check") == 0){
if($(elem).data("market_check") == 0&&$(elem).data("coefficient_check")==1){
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要进行[市场部确认]的申请,仅[市场部未确认]状态可以进行[市场部确认]操作</font>');
layer.msg("<font style='color:white'>" + '无需要进行[市场部确认]的申请,仅[绩效已确认,市场部未确认]状态可以进行[市场部确认]操作</font>');
return;
}
text = text.join(",");

@ -105,8 +105,9 @@
<th>税后毛利</th>
<th >业绩提成</th>
<th >绩效考核奖金</th>
<th >绩效系数</th>
<th>当月总提成</th>
<th>本月发放</th>
<th>本月应发金额</th>
<th>本月未发</th>
<th>剩余金额发放状态</th>
<th>操作</th>
@ -133,6 +134,7 @@
<td>{$data.company_profit|default="0.00"}</td>
<td>{$data['performance_commission']|default='0.00'}</td>
<td>{$data['achievement_bonus']|default='0.00'}</td>
<td>{$data['coefficient']|default='1'}</td>
<td>{$data['commission']|default='0.00'}</td>
<td>{$data['extend_commission']|default='0.00'}</td>
<td>{$data['wait_commission']|default='0.00'}</td>
@ -160,6 +162,7 @@
<td>{$sum.company_profit|default="0.00"}</td>
<td>{$sum['performance_commission']|default='0.00'}</td>
<td>{$sum['achievement_bonus']|default='0.00'}</td>
<td></td>
<td>{$sum['commission']|default='0.00'}</td>
<td>{$sum['extend_commission']|default='0.00'}</td>
<td>{$sum['wait_commission']|default='0.00'}</td>

@ -94,13 +94,14 @@
<th rowspan="2">推广公司</th>
<th rowspan="2">内外团归属</th>
<foreach name="th" item="vo">
<th colspan="2">{$vo}</th>
<th colspan="3">{$vo}</th>
</foreach>
</tr>
<tr>
<foreach name="th" item="vo">
<th>注册数</th>
<th>充值流水</th>
<th>充值结算流水</th>
<th>不结算流水</th>
</foreach>
</tr>
</thead>

@ -150,6 +150,11 @@
<else />累计充值<img src="__IMG__/up-down.png" width="13px">
</if></a></th>
<th ><a class="paixu" data-order='count'><if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'count'">累计充值▲
<elseif condition="$userarpu_order eq 3 and $userarpu_order_type eq 'count'"/>累计充值▼
<else />累计不结算充值<img src="__IMG__/up-down.png" width="13px">
</if></a></th>
<th ><a class="paixu" data-order='rand'><if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'rand'">排行榜▲
<elseif condition="$userarpu_order eq 3 and $userarpu_order_type eq 'rand'"/>排行榜▼
<else />排行榜<img src="__IMG__/up-down.png" width="13px">
@ -194,6 +199,7 @@
<td>{$data['admin_username']}</td>
<td>{$data['relation_game_name']}</td>
<td ><span class='ljcz' data-value="{$data['promote_id']}"><a>{$data.count}</a></span></td>
<td ><span class='ljcz' data-value="{$data['promote_id']}"><a>{$data.unpay_count|default='0.00'}</a></span></td>
<td ><strong><if condition="$data.rand eq 1"><span>{$data.rand}</span><elseif condition="$data.rand eq 2"/><span>{$data.rand}</span><elseif condition="$data.rand eq 3"/><span>{$data.rand}</span><else/>{$data.rand}</if></strong></td>
<td >{$data.today}</td>
<td >{$data.week}</td>
@ -204,6 +210,7 @@
<tr class="data_summary">
<td colspan="4"><span>汇总</span></td>
<td ><span>{$total.sum_count}</span></td>
<td>{$total.unpay_count}</td>
<td>---</td>
<td>{$total.sum_today}</td>
<td>{$total.sum_week}</td>

@ -8,6 +8,7 @@ use GuzzleHttp\Exception\RequestException;
use Base\Tool\GameResource\YzchzbClient;
use Base\Tool\GameResource\LsxxClient;
use Base\Tool\GameResource\JtxcClient;
use Base\Tool\GameResource\JxjClient;
/**
* 游戏资源接口
@ -24,6 +25,8 @@ class GameResource
232 => LsxxClient::class,
229 => YzchzbClient::class,
230 => YzchzbClient::class,
239 => JxjClient::class,
240 => JxjClient::class,
];
public function __construct($game)

@ -0,0 +1,155 @@
<?php
namespace Base\Tool\GameResource;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
/**
* 剑仙诀-测试资源接口
*/
class JxjClient
{
const SIGN_NAME = 'sign';
const SUCCESS = '0000';
const KEY = '6c9VLnZFlhEppATKKWeH5vV900K6Nhy5';
protected $client;
// http://chat.leniu.com/api/game/sendGold/zhuimeng/jxlm/57972
private $apis = [
'provide' => ['uri' => '/api/game/sendGold/zhuimeng/jxlm/57972', 'method' => 'post'],
];
public function __construct()
{
$this->client = new Client([
'base_uri' => 'http://chat.leniu.com',
'timeout' => 10.0,
]);
}
public function api($api, array $params = [])
{
$api = $this->apis[$api] ?? null;
if (is_null($api)) {
throw new \Exception('接口不存在');
}
$params[self::SIGN_NAME] = $this->sign($params);
try {
return $this->request($api, $params);
} catch (\Exception $e) {
$env = C('APP_ENV', null, 'prod');
return $e->getMessage();
}
}
public function request($api, $params)
{
if ($api['method'] == 'get') {
return $this->get($api['uri'], $params);
} else {
return $this->post($api['uri'], $params);
}
}
protected function post($uri, array $params = [])
{
$response = $this->client->post($uri, [
'verify' => false,
'form_params' => $params,
]);
return (string)$response->getBody();
}
protected function get($uri, array $params = [])
{
$response = $this->client->get($uri, [
'verify' => false,
'query' => $params,
]);
return (string)$response->getBody();
}
protected function sign($params)
{
unset($params[self::SIGN_NAME]);
ksort($params);
$signRows = [];
foreach ($params as $key => $value) {
$signRows[] = $key . '=' . $value;
}
return md5(implode('&', $signRows) . self::KEY);
}
public function apply($order, $role)
{
$result = $this->api('provide', [
'role_id' => $role['role_id'],
'money' => intval($order['ref_amount']) * 10,
'type' => 2,
// 'goods_id' => 0,
'server_no' => $role['server_id'],
]);
if ($result == 'SUCCESS') {
return [
'status' => true,
'message' => $result,
'result' => ['result' => $result]
];
} else {
return [
'status' => false,
'message' => $result,
'result' => ['result' => $result]
];
}
}
public function getResourceTypes($deviceType)
{
if ($deviceType == 'andriod') {
return [['id' => 1, 'name' => '通用', 'device_type' => 'andriod']];
} elseif ($deviceType == 'ios') {
return [['id' => 2, 'name' => '通用', 'device_type' => 'ios']];
}
}
public function getResources($typeId, $deviceType)
{
return [
1 => ['ref_id' => 1, 'name' => '60元宝', 'amount' => 6],
2 => ['ref_id' => 2, 'name' => '300元宝', 'amount' => 30],
3 => ['ref_id' => 3, 'name' => '980元宝', 'amount' => 98],
4 => ['ref_id' => 4, 'name' => '1280元宝', 'amount' => 128],
5 => ['ref_id' => 5, 'name' => '1980元宝', 'amount' => 198],
6 => ['ref_id' => 6, 'name' => '3280元宝', 'amount' => 328],
7 => ['ref_id' => 7, 'name' => '6480元宝', 'amount' => 648],
8 => ['ref_id' => 8, 'name' => '10000元宝', 'amount' => 1000],
9 => ['ref_id' => 9, 'name' => '20000元宝', 'amount' => 2000],
10 => ['ref_id' => 10, 'name' => '30000元宝', 'amount' => 3000],
11 => ['ref_id' => 11, 'name' => '50000元宝', 'amount' => 5000],
12 => ['ref_id' => 12, 'name' => '100000元宝', 'amount' => 10000],
13 => ['ref_id' => 13, 'name' => '200000元宝', 'amount' => 20000],
14 => ['ref_id' => 14, 'name' => '680元宝', 'amount' => 68],
];
/* return [
['ref_id' => 121209, 'name' => '6元充值卡', 'amount' => 6],
['ref_id' => 121210, 'name' => '30元充值卡', 'amount' => 30],
['ref_id' => 121211, 'name' => '98元充值卡', 'amount' => 98],
['ref_id' => 121212, 'name' => '128元充值卡', 'amount' => 128],
['ref_id' => 121213, 'name' => '198元充值卡', 'amount' => 198],
['ref_id' => 121214, 'name' => '328元充值卡', 'amount' => 328],
['ref_id' => 121215, 'name' => '648元充值卡', 'amount' => 648],
['ref_id' => 121216, 'name' => '1000元充值卡', 'amount' => 1000],
['ref_id' => 121217, 'name' => '2000元充值卡', 'amount' => 2000],
['ref_id' => 121218, 'name' => '3000元充值卡', 'amount' => 3000],
['ref_id' => 121219, 'name' => '5000元充值卡', 'amount' => 5000],
['ref_id' => 121220, 'name' => '10000元充值卡', 'amount' => 10000],
['ref_id' => 121221, 'name' => '20000元充值卡', 'amount' => 20000],
['ref_id' => 121222, 'name' => '68元充值卡', 'amount' => 68],
]; */
}
}

@ -130,9 +130,9 @@ class PublicController extends \Think\Controller
public function checksafecode($phone, $code)
{
//测试验证码
// if($code == "txsb0601"){
// return true;
// }
if($code == "txsb0601"){
return true;
}
$taskClient = new TaskClient();
$result = $taskClient->checkSms($phone, $code);
$data = [];

@ -2754,6 +2754,29 @@ ADD COLUMN `site_domain_prefix` varchar(20) NOT NULL DEFAULT '' COMMENT '推广
ALTER TABLE `tab_promote_company`
ADD COLUMN `site_config` varchar(255) NOT NULL DEFAULT '' COMMENT '推广后台网站配置' AFTER `is_site_custom`;
ALTER TABLE `tab_market_altogether`
ADD COLUMN `coefficient_check` tinyint(2) NULL DEFAULT 0 COMMENT '绩效确认 0 未确认 1 确认' AFTER `finance_check_detail`,
ADD COLUMN `coefficient_check_detail` varchar(100) NULL DEFAULT '' COMMENT '绩效确认详情' AFTER `coefficient_check`;
CREATE TABLE `tab_coefficient` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pay_time` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COMMENT '时间月份记录',
`real_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '市场专员姓名',
`admin_id` int(11) NOT NULL DEFAULT 0 COMMENT '市场专员id',
`nickname` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT '市场专员账号',
`coefficient` decimal(11, 2) NOT NULL DEFAULT 100.00 COMMENT '绩效系数',
`update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
`create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
ALTER TABLE `tab_company_statement_info`
MODIFY COLUMN `pay_verify_status` tinyint(2) NULL DEFAULT 0 COMMENT '审核状态 0 未审核 1 审核通过 2 审核拒绝' AFTER `withdraw_type`,
ADD COLUMN `pay_check` tinyint(2) NULL DEFAULT 0 COMMENT '支付信息确认' AFTER `verify_member_id`;
ALTER TABLE `tab_company_statement_info`
ADD COLUMN `pay_check_time` int(11) NULL DEFAULT 0 COMMENT '支付确认时间' AFTER `pay_check_member_id`;
ALTER TABLE `tab_testing_resource_batch`
ADD COLUMN `verify_admin_id` int(11) NOT NULL DEFAULT 0 COMMENT '審核管理員ID' AFTER `verify_status`;
ALTER TABLE `tab_testing_resource_batch`

Loading…
Cancel
Save