市场专员结算代码上传

master
zhengyongxing 4 years ago
parent 379716298a
commit cd0d9e295f

@ -2448,7 +2448,7 @@ function getAvailableBalance($promote_id=0,$game_id=0,$server_id='') {
*/
function getMarketAdmin() {
// $map['group_id'] = ['in','11,12,21'];
$map['group_id'] = ['in','11,12,21'];
$data = M("auth_group_access")
->field("real_name,menber.uid,nickname")

@ -21,9 +21,10 @@ class MarketPercentageController extends ThinkController
$_REQUEST['sdk_version']?($map['sdk_version'] = $_REQUEST['sdk_version']):'';
$data = M("settleup_marketorder","tab_")
->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name,
->field("pay_time,promote_account,company_belong,member.real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount,
sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit");
sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit")
->join("left join sys_member member on access.uid=admin_id");
if ($_REQUEST['export']) {
$data = $data->where($map)
@ -126,10 +127,11 @@ class MarketPercentageController extends ThinkController
// dump(getMarketAdmin());die();
$data = M("settleup_marketorder","tab_")
->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name,
->field("pay_time,promote_account,company_belong,member.real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage")
->join("left join sys_auth_group_access access on admin_id=access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id");
->join("left join sys_auth_group auth on access.group_id=auth.id")
->join("left join sys_member member on access.uid=member.uid");
if ($_REQUEST['export']) {
$data = $data->where($map)
@ -225,10 +227,10 @@ class MarketPercentageController extends ThinkController
$_REQUEST['group_id']?($map['group_id'] = $_REQUEST['group_id']):'';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
// $map['admin_id'] = $admin_id;
$data = M("settleup_marketorder","tab_")
->field("tab_settleup_marketorder.id,pay_time,promote_account,company_belong,tab_settleup_marketorder.real_name,develop_type,game_name,
->field("tab_settleup_marketorder.id,pay_time,promote_account,company_belong,member.real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage,nickname,admin_id")
->join("left join sys_auth_group_access access on admin_id=access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")

@ -360,9 +360,20 @@ class TimingController extends AdminController {
}
}
//参数 time 2020-10
public function caculateMarketStream () {
echo date("Y-m-d H:i:s")."----------------------市场结算管理计算----------------------\n";
$map['pay_time'] = date("Y-m",strtotime('-1 month'));
if ($_REQUEST['time']) {
$map['pay_time'] = $_REQUEST['time'];
}
if($_REQUEST['time'] == 'all') {
$map = [];
}
$data = M("auth_group")
->where(['title'=>['like','%市场%']])
->select(false);
@ -386,6 +397,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")
->where($map)
->group("pay_time,promote_id,game_name,sdk_version,pay_way")
->select();
@ -432,6 +444,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")
->where($map)
->group("pay_time,promote_id,game_name,sdk_version")
->select(false);
@ -466,10 +479,11 @@ class TimingController extends AdminController {
$promote_data[$key]['company_profit'] = $value['pay_amount']-$promote_data[$key]['cp_amount']-$promote_data[$key]['promote_amount']-$promote_data[$key]['channel_amount']-$promote_data[$key]['company_tax'];
if ($value['promote_id'] == 0) {
$promote_data[$key]['promote_account']='官方渠道';
$promote_data[$key]['company_id']='0';
$promote_data[$key]['company_belong']='3';
$promote_data[$key]['develop_type']='0';
// $promote_data[$key]['promote_account']='官方渠道';
// $promote_data[$key]['company_id']='0';
// $promote_data[$key]['company_belong']='3';
// $promote_data[$key]['develop_type']='0';
continue;
}
unset($promote_data[$key]['market_percentage']);
@ -484,7 +498,7 @@ class TimingController extends AdminController {
->add($promote_data[$key]);
} else {
M("settleup_marketorder","tab_")
->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name']])
->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name'],'sdk_version'=>$value['sdk_version']])
->save($promote_data[$key]);
}

@ -1750,5 +1750,44 @@ ALTER TABLE `tab_deposit`
ADD COLUMN `old_change_promote_id` int(11) NULL DEFAULT 0 COMMENT '修改配置前渠道' ,
ADD COLUMN `old_change_promote_account` varchar(30) NULL COMMENT '修改配置前渠道账号' ;
-- zyx 20200629
ALTER TABLE `sys_member`
ADD COLUMN `real_name` varchar(255) NULL DEFAULT '' COMMENT '真实姓名' AFTER `status`;
CREATE TABLE `tab_settleup_marketorder` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pay_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '' COMMENT '月份时间',
`company_id` int(11) NULL DEFAULT 0 COMMENT '公司id',
`promote_id` int(11) NULL DEFAULT 0 COMMENT '推广员id',
`promote_account` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '' COMMENT '推广员账号',
`company_belong` tinyint(2) NULL DEFAULT 0 COMMENT '工会归属0-内团1-外团 2-分发联盟 3 无',
`develop_type` tinyint(2) NULL DEFAULT 0 COMMENT '开发类型 1 自主开发 2 自主开发及维护 3 只维护',
`game_id` int(11) NULL DEFAULT 0 COMMENT '游戏id',
`game_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '游戏名称',
`relation_game_id` int(11) NULL DEFAULT 0 COMMENT '关联游戏id',
`pay_amount` decimal(13, 2) NOT NULL DEFAULT 0.00 COMMENT '总流水',
`real_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '' COMMENT '市场专员姓名',
`admin_id` int(11) NULL DEFAULT 0 COMMENT '市场专员id',
`cp_amount` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '上游结算流水',
`promote_amount` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '下游结算流水',
`channel_amount` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '支付渠道费用',
`company_tax` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '公司税费',
`company_profit` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '毛利',
`sdk_version` tinyint(2) NULL DEFAULT 1 COMMENT '设备类型 1 安卓 2 ios',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
CREATE TABLE `tab_market_altogether` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pay_time` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '' COMMENT '时间月份记录',
`real_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '' COMMENT '管理员姓名',
`admin_id` int(11) NULL DEFAULT NULL COMMENT '管理员id',
`nickname` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '' COMMENT '管理员账号',
`level` tinyint(2) NULL DEFAULT 0 COMMENT '级别21:初级 11:中级 12:高级',
`pay_amount` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '总流水',
`extend_commission` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '已发放金额',
`wait_commission` decimal(13, 2) NULL DEFAULT 0.00 COMMENT '待发放金额',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '' COMMENT '备注',
`create_time` int(11) NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic;
Loading…
Cancel
Save