Merge branch 'feature/group_type' into dev

# Conflicts:
#	Application/Admin/Controller/PromoteController.class.php
#	Data/update.sql
master
zhengchanglong 5 years ago
commit 10c0b3a18a

@ -105,6 +105,7 @@ class FinancePromoteController extends AdminController
);
foreach($senddata as $k=>$v){
$v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团';
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
if(empty($v['p_id'])) $v['p_id']= "0";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
@ -138,6 +139,24 @@ class FinancePromoteController extends AdminController
$this->assign('_page', $page);
}
$outBelong = 0;
$insideBelong = 0;
foreach ($data as $key => $value) {
if ($value['company_belong']) {
$outBelong+=$value['allcount'];
} else {
$insideBelong+=$value['allcount'];
}
}
//外团占比
$this->assign('outBelong',$outBelong/$count['all_count']*100);
//内团占比
$this->assign('insideBelong',$insideBelong/$count['all_count']*100);
$size = $row;
$data = array_slice($data, ($arraypage - 1) * $size, $size);
$this->assign('list_data', $data);
@ -176,7 +195,7 @@ class FinancePromoteController extends AdminController
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";
IFNULL(company_id,0) company_id,company_name,promote.company_belong";
return M()
->table("tab_spend s")
->field($field)
@ -193,7 +212,7 @@ class FinancePromoteController extends AdminController
$map['s.source_id']=0;
$field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,IFNULL(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='',
s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name";
IFNULL(company_id,0) company_id,company_name,promote.company_belong";
return M("promote_coin s","tab_")
->field($field)
->where($map)
@ -229,10 +248,12 @@ class FinancePromoteController extends AdminController
$senddata = [];
//获取各会长的现金充值
$cash = self::promoteUserData([],$istimeselect);
foreach($cash as $k=>$v){
$senddata[$v['promote_id']] = $v;
}
$inside = self::promoteUserData([],$istimeselect,"promote_coin");
foreach($inside as $k=>$v){
if(array_key_exists($v['promote_id'],$senddata)){
$senddata[$v['promote_id']]['inside_cash_count']= $v['pay_amount']-$v['back_amount'];
@ -276,6 +297,7 @@ class FinancePromoteController extends AdminController
);
foreach($senddata as $k=>$v){
$v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团';
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
if(empty($v['promote_account'])) $v['promote_account']= "官方渠道";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
@ -339,7 +361,7 @@ class FinancePromoteController extends AdminController
$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(company_id,0) company_id,company_name,promote_id,promote.account promote_account";
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,promote.company_belong";
return M()
->table("tab_spend s")
->field($field)
@ -355,7 +377,7 @@ class FinancePromoteController extends AdminController
$map['s.status']=1;
$map['s.source_id']=0;
$field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account";
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,promote.company_belong";
return M("promote_coin s","tab_")
->field($field)
->where($map)

@ -141,6 +141,7 @@ class PromoteController extends ThinkController
//为数据权限添加
setPowerPromoteIds($map, 'id');
$list_data = D(self::model_name)->where($map)->order('id DESC')->page($p, $row)->select();
$list_data = D(self::model_name)->parseListData($list_data);
$oa_data = [];
if (I('oa_associated', -1) == -1) {
foreach ($list_data as $k => $v) {
@ -220,14 +221,29 @@ class PromoteController extends ThinkController
if ($this->accountExist($account)) {
$this->error('该账号已存在');
}
$data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name,
'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card,
'admin_id'=>session('user_auth')['uid'],'status'=>$status,'ba_id'=>$ba_id, 'company_id' => $company_id);
$company_belong = $_REQUEST['company_belong'];
$company_relation = $_REQUEST['company_relation'];
$data = array(
'account'=>$account,
'password'=>$password,
'second_pwd'=>$second_pwd,
'real_name'=>$real_name,
'email'=>$email,
'mobile_phone'=>$mobile_phone,
'bank_name'=>$bank_name,
'bank_card'=>$bank_card,
'admin_id'=>session('user_auth')['uid'],
'status'=>$status,
'ba_id'=>$ba_id,
'company_id' => $company_id,
'company_belong' => $company_belong,
'company_relation' => $company_relation,
);
if (preg_match('/^[a-zA-Z0-9]{6,15}$/', $account)==false) {
$this->error('账号只能是6-15位字母或数字');
}
if (empty($company_id)) {
if ($company_id < 0) {
$this->error('请选择推广公司');
}
$promoteService = new PromoteService();
@ -277,12 +293,16 @@ class PromoteController extends ThinkController
if (preg_match('/^[a-zA-Z0-9]{6,15}$/', I('post.account'))==false) {
$this->error('账号只能是6-15位字母或数字');
}
$promote = M("promote", "tab_")->where(array("id" => $_POST['id']))->field('id, level')->find();
$promote = M("promote", "tab_")
->where(array("id" => $_POST['id']))
->field('id, level, company_belong, company_relation, company_id')
->find();
$data['account'] = I('post.account');
if ($this->accountExist($data['account'], $_POST['id'])) {
$this->error('该账号已存在');
}
if (empty(I('company_id')) && $promote['level'] ==1) {
$company_id = I('company_id');
if ($company_id <0 && $promote['level'] ==1) {
$this->error('请选择推广公司');
}
empty(I('post.id')) ? : $data['id'] =I('post.id');
@ -310,8 +330,14 @@ class PromoteController extends ThinkController
$ba = new \Admin\Model\BusinessAffairsModel();
$ba->update_child($ba_id['ba_id'], $_REQUEST['ba_id'], $id);
}
if (!empty(I('company_id')) && $promote['level'] ==1) {
$data['company_id'] = I('company_id');
if ($promote['level'] ==1) {//如果是会长才能修改的选项
if (!is_null($company_id)) {
$data['company_id'] = $company_id;//推广公司
}
$data['company_belong'] = I('company_belong');//工会归属
$data['company_relation'] = I('company_relation');//工会关系
}
$settlementType = intval(I('settlement_type', 1));
if (!empty(I('settlement_type')) && in_array($settlementType, [1, 2])) {
@ -319,10 +345,21 @@ class PromoteController extends ThinkController
}
$res = M("promote", "tab_")->where(array("id"=>$_POST['id']))->save($data);
if ($res !== false) {
if (!empty(I('company_id')) && $promote['level'] ==1) {//修改会长底下推广员的推广公司
M("promote", "tab_")->where("chain like '%/{$_POST['id']}/%'")->save([
'company_id' => I('company_id')
]);
if ($promote['level'] == 1) {//修改会长底下推广员的推广公司
$array = array();
if ($promote['company_id'] != $company_id) {
$array['company_id'] = I('company_id');
}
if ($promote['company_belong'] != I('company_belong')) {
$array['company_belong'] = I('company_belong');
}
if ($promote['company_relation'] != I('company_relation')) {
$array['company_relation'] = I('company_relation');
}
if ($array) {
$res = M("promote", "tab_")->where("chain like '%/{$_POST['id']}/%'")->save($array);
}
}
$this->success("修改成功", U('lists'));
} else {

@ -18,7 +18,8 @@ class SpendCountSetController extends \Think\Controller
//初始化
$this->beginThismonth = mktime(0,0,0,date('m')-1,1,date('Y'));
$this->endThismonth = mktime(0,0,0,date('m'),1,date('Y'))-1;
$this->date = date('Y')."-".((date('m')-1) > 9 ? (date('m')-1) : "0".(date('m')-1));
$temp = strtotime(date('Y-m-01 00:00:00',strtotime('-1 month')));
$this->date = date('Y',$temp)."-".date('m',$temp);
$this->nowdata =time();
$this->model =M();
$this->usermodel =M("spend_user_count",'tab_');

@ -407,4 +407,16 @@ class PromoteModel extends Model{
return $result;
}
public function parseListData($result)
{
$parseData = array();
foreach ($result as $key => $value) {
$parseData[$key] = $value;
$parseData[$key]['company_belong_str'] = $value['company_belong'] ? '外团' : '内团';
}
return $parseData;
}
}

@ -155,6 +155,7 @@
<tr>
<th>推广公司</th>
<th>会长渠道</th>
<th>内外团</th>
<th class="tooltip"><a class="paixu" data-order='cash_count'>
<if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'cash_count'">游戏现金金额▲
@ -204,6 +205,7 @@
<tr>
<td>{$data.company_name}</td>
<td>{$data['promote_account']}</td>
<td>{$data['company_belong']}</td>
<td>{$data.cash_count}</td>
<td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
@ -232,6 +234,7 @@
</empty>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">汇总:</td>
<td style="text-align: center;">---</td>
<td>{$all_count['cash_count']}</td>
<td>{$all_count['balance_coin_count']}</td>
<td>{$all_count['bind_coin_count']}</td>
@ -243,6 +246,10 @@
<a href="{:U('FinancePromote/promoteUser',array_merge(I('get.'),['p'=>1]))}">渠道查看</a>
</td>
</tr>
<tr class="data_summary">
<td style="text-align: center;">内外团占比:</td>
<td colspan="20" style="text-align: center;">内团充值金额占比:{$insideBelong}%&nbsp&nbsp&nbsp&nbsp外团充值金额占比:{$outBelong}%</td>
</tr>
</tbody>
</table>
</div>

@ -155,6 +155,7 @@
<tr>
<th>推广公司</th>
<th>推广员账号</th>
<th>内外团</th>
<th class="tooltip"><a class="paixu" data-order='cash_count'>
<if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'cash_count'">游戏现金金额▲
@ -203,6 +204,7 @@
<tr>
<td>{$data.company_name}</td>
<td>{$data['promote_account']}</td>
<td>{$data['company_belong']}</td>
<td>{$data.cash_count}</td>
<td>{$data.balance_coin_count}</td>
@ -219,6 +221,7 @@
</empty>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">汇总:</td>
<td style="text-align: center;">---</td>
<td>{$all_count['cash_count']}</td>
<td>{$all_count['balance_coin_count']}</td>
<td>{$all_count['bind_coin_count']}</td>

@ -43,7 +43,8 @@
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>所属推广公司</td>
<td class="r">
<select name="company_id" id="company_id">
<option value="0">请选择推广公司</option>
<option value="-1">请选择推广公司</option>
<option value="0">万盟天下科技</option>
<volist name="companys" id="vo">
<option value="{$vo.id}">{$vo.company_name}</option>
</volist>
@ -65,6 +66,37 @@
<span class="notice-text">锁定状态下,推广员账号则无法登录</span>
</td>
</tr>
<tr>
<td class="l">工会归属:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0" name="company_belong" checked="checked" class="company_belong"> 内团
</label >
<label >
<input type="radio" value="1" name="company_belong" class="company_belong"> 外团
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<tr style="display: none" id="company_relation">
<td class="l">工会关系:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0" name="company_relation" checked="checked"> 自主开发及维护
</label >
<label >
<input type="radio" value="1" name="company_relation" > 只维护
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<tr>
<td class="l">真实姓名:</td>
<td class="r">
@ -137,6 +169,15 @@ $(function(){
prov="{:substr($data['bank_area'],0,2)}";
city="{:substr($data['bank_area'],2,2)}";
ciarea="{:substr($data['bank_area'],4,2)}";
$("input[name=company_belong]").click(function () {
if ($(this).val() == 1) {
$('#company_relation').show();
} else {
$('#company_relation').hide();
}
});
});
//得到地区码
function getAreaID(){

@ -183,7 +183,8 @@
<select name="company_id" id="company_id"
<if condition="$data['level'] != 1">
disabled style="background:#CCCCCC" </if>>
<option value="0">请选择推广公司</option>
<option value="-1">请选择推广公司</option>
<option value="0" <?php echo (0 == $data['company_id'] ? 'selected':''); ?>>万盟天下科技</option>
<volist name="companys" id="vo">
<option value="{$vo.id}" <?php echo ($vo['id'] == $data['company_id'] ? 'selected':''); ?>
@ -193,6 +194,82 @@
<span class="notice-text">设置该推广员所属的推广公司</span>
</td>
</tr>
<!--如果是会长可编辑,其他人只能查看-->
<if condition="$data['level'] == 1">
<tr>
<td class="l">工会归属:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0"
<if condition="$data['company_belong'] == 0">
checked="checked"
</if>
name="company_belong" class="company_belong"> 内团
</label >
<label >
<input type="radio" value="1"
<if condition="$data['company_belong'] == 1">
checked="checked"
</if>
name="company_belong" class="company_belong"> 外团
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<tr <?php echo (0 == $data['company_belong'] ? 'style="display: none"':''); ?> id="company_relation">
<td class="l">工会关系:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0"
<?php echo (1 == $data['company_relation'] ? 'checked':''); ?>
name="company_relation" checked="checked"> 自主开发及维护
</label >
<label >
<input type="radio" value="1"
<?php echo (1 == $data['company_relation'] ? 'checked':''); ?>
name="company_relation" > 只维护
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<else/>
<!--非会长只能查看-->
<tr>
<td class="l">工会归属:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0" <?php echo (0 == $data['company_belong'] ? 'checked':''); ?> disabled="disabled" name="company_belong" checked="checked" class="company_belong"> 内团
</label >
<label >
<input type="radio" value="1" <?php echo (1 == $data['company_belong'] ? 'checked':''); ?> disabled="disabled" name="company_belong" class="company_belong"> 外团
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
<tr <?php echo (0 == $data['company_belong'] ? 'style="display: none"':''); ?> id="company_relation">
<td class="l">工会关系:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="0" <?php echo (0 == $data['company_relation'] ? 'checked':''); ?> disabled="disabled" name="company_relation" checked="checked"> 自主开发及维护
</label >
<label >
<input type="radio" value="1" <?php echo (1 == $data['company_relation'] ? 'checked':''); ?> disabled="disabled" name="company_relation" > 只维护
</label>
</span>
<!-- <span class="notice-text"></span>-->
</td>
</tr>
</if>
<tr>
<td class="l">注册时间:</td>
@ -369,6 +446,15 @@ $(function(){
city="{:substr($data['bank_area'],2,2)}";
ciarea="{:substr($data['bank_area'],4,2)}";
//initComplexArea('seachprov', 'seachcity', 'seachdistrict', area_array, sub_array, prov, city, ciarea);
$("input[name=company_belong]").click(function () {
if ($(this).val() == 1) {
$('#company_relation').show();
} else {
$('#company_relation').hide();
}
});
});
// //得到地区码
// function getAreaID(){

@ -184,6 +184,7 @@
<th ><a class="paixu" data-order='last_login_time'>最后登录时间</a></th>
<th>渠道类型</th>
<th>所属会长</th>
<th>工会归属</th>
<th>商务专员</th>
<th>状态</th>
<th>身份状态</th>
@ -231,6 +232,7 @@
{:encryptStr(getTopPromote($data['id'])['account'])}
</if>
</td>
<td>{$data['company_belong_str']}</td>
<td>{:get_business_affairs_account($data['ba_id'])}</td>
<td>
<?php $status_str = get_info_status($data['status'],3); $status_str = $status_str ?: '待审核';?>

@ -940,6 +940,8 @@ class PromoteService {
'company_id' => $params['company_id'] ?? 0,
'invite_code' => $params['invite_code'] ?? '',
'create_time' => time(),
'company_belong' => $params['company_belong'] ?? 0,
'company_relation' => $params['company_relation'] ?? 0,
];
if ($parent) {

@ -933,3 +933,7 @@ ADD COLUMN `last_op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '最后操作人
-- 推广员结算类型 cxj
ALTER TABLE `tab_promote`
ADD COLUMN `settlement_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '结算类型1-周结 2-月结';
ALTER TABLE tab_promote add `company_belong` tinyint(1) NOT NULL DEFAULT '0' COMMENT '工会归属0-内团1-外团';
ALTER TABLE tab_promote add `company_relation` tinyint(1) NOT NULL DEFAULT '0' COMMENT '工会关系0-自主开发及维护1-只维护';

Loading…
Cancel
Save