~~~
<?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;
}
}
?>
~~~
- 目录
- 人人商城二开
- 人人商城接入第三方支付
- 登录微擎跳转人人商城
- 获取无限级团队总人数
- 多商户定位不准
- 人人商城超级海报生成二维码导致用户名为空
- 人人商城excel导出不了
- 人人商城操作员权限不生效
- 人人详细二开
- 统计伞下客户所有业绩
- 获取无限下级
- 分销走的升级逻辑
- 获取无限上级
- 后修改菜单修改路径
- 人人商城帮助文档
- 人人分销的使用帮助
- 人人商城二开笔记
- 生成访问地址
- JavaScript Eval 在线加密/解密, 编码/解码工具
- 人人商城文档
- 点点G二开
- xml文件操作
- 银联(威富通)对账单处理
- 临时笔记
- 新增数据库
- ims_ewei_shop_unionpay_agent(银联机构信息表)
- 微擎手册
- 微擎框架
- 目录结构
- 配置选项
- 数据库配置($config[db])
- 系统COOKIE配置项($config[cookie])
- 系统设置($config[setting])
- 预定义常量
- 全局变量
- 全局配置
- 系统配置
- 公众号相关
- Web 端可见
- App 端可见
- 网页授权
- URL 路由
- url生成助手
- createMobileUrl
- createWebUrl
- 文件加载器
- func(加载公共函数)
- class(加载公共类)
- model(加载系统model函数)
- web(加载web端公共函数)
- app(加载app端公共函数)
- library(库文件加载)
- object(实例化加载)
- singleton(单例加载)
- 缓存机制
- cache_write
- cache_load
- cache_delete
- cache_clean
- cache_system_key
- 错误处理
- 日志记录
- 自定义分享
- 数据库操作
- SQL注入安全
- 连接其它数据库
- 函数列表
- 查询
- pdo_get
- pdo_getcolumn
- pdo_getall
- pdo_getslice
- pdo_fetch
- pdo_fetchcolumn
- pdo_fetchall
- 变更
- pdo_insert
- pdo_update
- pdo_delete
- 运行SQL
- pdo_query
- pdo_run
- 辅助函数
- pdo_fieldexists
- pdo_indexexists
- pdo_tableexists
- pdo_fieldmatch
- pdo_debug
- 链式查询
- from
- select
- where
- whereor
- having
- groupby
- orderby
- leftjoin
- innerjoin
- on
- limit
- page
- get
- getall
- getcolumn
- count
- exists
- getLastQueryTotal
- getLastQuery
- 模板引擎
- 模板标签
- 输出变量
- 判断语句
- 循环语句
- php语句
- 引用模板
- 创建URL
- 转义附件URL
- 输出花括号
- 数据调用
- 调用微站导航
- 调用幻灯片
- 调用文章列表
- 调用分类列表
- 调用快捷菜单
- 常用变量
- 数据库字典