```
<?php
if (!defined('IN_IA')) {
exit('Access Denied');
}
require EWEI_SHOPV2_PLUGIN . 'commission/core/page_login_mobile.php';
class Index_EweiShopV2Page extends CommissionMobileLoginPage
{
public function main()
{
global $_W;
global $_GPC;
$this->diypage('commission');
$member = $this->model->getInfo($_W['openid'], array('total', 'ordercount0', 'ok', 'ordercount', 'wait', 'pay'));
//统计线下所有业绩
//我的所有下级
$ids=$this->getSub($member['id']);
$idss=explode(",",$ids);
$tuan_price=0;
foreach ($idss as $key => $value) {
$idss_member = m('member')->getMember($value);
$tuan_price += pdo_fetchcolumn("SELECT sum(price) FROM ".tablename('ewei_shop_order')." where openid=:openid order by id desc", array(":openid"=>$idss_member['openid']));
}
// var_dump($ids);
$cansettle = 1 <= $member['commission_ok'] && floatval($this->set['withdraw']) <= $member['commission_ok'];
$level1 = $level2 = $level3 = 0;
$level1 = pdo_fetchcolumn('select count(*) from ' . tablename('ewei_shop_member') . ' where agentid=:agentid and uniacid=:uniacid limit 1', array(':agentid' => $member['id'], ':uniacid' => $_W['uniacid']));
if (2 <= $this->set['level'] && 0 < count($member['level1_agentids'])) {
$level2 = pdo_fetchcolumn('select count(*) from ' . tablename('ewei_shop_member') . ' where agentid in( ' . implode(',', array_keys($member['level1_agentids'])) . ') and uniacid=:uniacid limit 1', array(':uniacid' => $_W['uniacid']));
}
if (3 <= $this->set['level'] && 0 < count($member['level2_agentids'])) {
$level3 = pdo_fetchcolumn('select count(*) from ' . tablename('ewei_shop_member') . ' where agentid in( ' . implode(',', array_keys($member['level2_agentids'])) . ') and uniacid=:uniacid limit 1', array(':uniacid' => $_W['uniacid']));
}
$member['downcount'] = $level1 + $level2 + $level3;
$member['applycount'] = pdo_fetchcolumn('select count(id) from ' . tablename('ewei_shop_commission_apply') . ' where mid=:mid and uniacid=:uniacid limit 1', array(':uniacid' => $_W['uniacid'], ':mid' => $member['id']));
$openselect = false;
if ($this->set['select_goods'] == '1') {
if (empty($member['agentselectgoods']) || $member['agentselectgoods'] == 2) {
$openselect = true;
}
}
else {
if ($member['agentselectgoods'] == 2) {
$openselect = true;
}
}
$this->set['openselect'] = $openselect;
$level = $this->model->getLevel($_W['openid']);
$up = false;
if (!empty($member['agentid'])) {
$up = m('member')->getMember($member['agentid']);
}
$hasglobonus = false;
$plugin_globonus = p('globonus');
if ($plugin_globonus) {
$plugin_globonus_set = $plugin_globonus->getSet();
$hasglobonus = !empty($plugin_globonus_set['open']) && empty($plugin_globonus_set['closecommissioncenter']);
}
$hasabonus = false;
$plugin_abonus = p('abonus');
if ($plugin_abonus) {
$plugin_abonus_set = $plugin_abonus->getSet();
$hasabonus = !empty($plugin_abonus_set['open']) && empty($plugin_abonus_set['closecommissioncenter']);
}
$hasauthor = false;
$plugin_author = p('author');
if ($plugin_author) {
$plugin_author_set = $plugin_author->getSet();
$hasauthor = !empty($plugin_author_set['open']) && empty($plugin_author_set['closecommissioncenter']);
if ($hasauthor) {
$team_money = $plugin_author->getTeamPay($member['id']);
}
}
$hasdividend = false;
$plugin_dividend = p('dividend');
if ($plugin_dividend) {
$plugin_dividend_set = $plugin_dividend->getSet();
if (!empty($plugin_dividend_set['open']) && !empty($plugin_dividend_set['commissionshow'])) {
$hasdividend = true;
}
}
include $this->template();
}
// 获取无限下级
public function getSub($id)
{
$isComma = strstr($id,',');
if($isComma){
$res = pdo_fetchall("SELECT * FROM ".tablename('ewei_shop_member')." where agentid in (".$id.")");
}else{
$res = pdo_fetchall("SELECT * FROM ".tablename('ewei_shop_member')." where agentid = ".$id);
}
if ($res) {
$id = '';
foreach ($res as $k=>$v) {
if($v['id']>0){
if($k == 0){
$id = $v['id'];
}else{
$id .= ','.$v['id'];
}
}
}
if($isComma){
$ids .= "," . $id;
}else{
$ids .= $id;
}
$ids .= $this->getSub($id);
}
return $ids;
}
}
?>
```
- 【11.18更新】人人商城弹出框
- 人人常用方法
- 人人分销【12.13更新】
- 分销走的升级逻辑
- 获取无限上级
- 【12.13更新】获取无限下级
- 统计伞下客户所有业绩
- 关于会员
- 注册走的逻辑
- 会员等级升级
- 关于商品
- 关于小程序
- 人人运费模板逻辑
- 订单创建
- 导入导出
- 导入
- 导出
- 人人快速导出
- 修改收货地址
- 人人客服消息
- 人人商城企业支付到零钱
- 人人商城DIY页面
- 订单【20201210更新】
- 支付逻辑【2020 12月10日更新】
- 订单创建1【20201210更新】
- 订单完成
- 人人权限修复
- 人人权限应用不出来修复
- 微信API
- 获取access_token
- 获取openid
- 修改公众号推送消息
- 问题修复
- 打印机开发
- 拼团
- 订单
- 拼团常用方法
- 余额详细不详细更改
- 修改菜单
- 关于微擎的事务处理逻辑
- 【11.20更新】余额记录不显示前端获得的余额
- BUG集合【2020年12月11日更新】
- 海报黑屏或者出不来
- 人人商城多商户无法上传图片解决办法
- 秒杀超卖解决方案【20210225更新】