```
<?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更新】