```
ALTER TABLE `ims_ewei_shop_commission_level`
ADD COLUMN `fhbi` decimal(11,2) NULL DEFAULT 0 ,
ADD COLUMN `tmshopprice` decimal(11,2) NULL DEFAULT 0 ,
ADD COLUMN `tmshopprices` decimal(11,2) NULL DEFAULT 0 AFTER `tmshopprice`,
ADD COLUMN `fftime` int(11) NULL DEFAULT 0 AFTER `tmshopprices`;
//页面设置
$dataset = m("common")->getPluginset("commission");
<div class="form-group">
<label class="col-lg control-label">全球业绩分红比例</label>
<div class="col-sm-9 col-xs-12">
<div class="input-group fixmore-input-group">
<input type="text" name="data[fhbi]" class="form-control" value="{$data['fhbi']}" />
<div class="input-group-addon">%</div>
</div>
<span class="help-block">按全部业绩的N%分红</span>
</div>
</div>
//agent.html
<a class="btn-default btn-sm btn-op " style="color:balck;" type="button" data-toggle='batch-batch' data-confirm="昨日商城总销售额为{php echo empty($totalprice) ? 0 : $totalprice}元,奖金池为{php echo $totalbouns}元,确认要发放分红?" data-href="{php echo webUrl('commission/agent/ffbouns')}">
<i class='icow icow-shenhetongguo'></i> 发放昨日分红
</a>
//列表操作
<a class="btn btn-op btn-operation" data-toggle='ajaxPost' href="{php echo webUrl('commission/agent/uptm',array('id' => $row['id']));}" target='_blank'>
<span data-toggle="tooltip" data-placement="top" title="" data-original-title="更新团队人数">
<i class='icow icow-bianji2'></i>
</span>
</a>
//level.heml
<div class="page-toolbar">
<a class="btn-primary btn-sm btn-op " type="button" data-toggle='batch-batch' data-confirm="确认要发放分红?" data-href="{php echo webUrl('commission/level/ffbouns')}">
<i class='icow icow-shenhetongguo'></i> 发放商城分红
</a>
当前平台可发放销售额为{$others[0]['tmshopprice']}元,上次发放时间为{php echo date("Y-m-d H:i", $others[0]["fftime"])}。
</div>
//团队分红
$tmprice = $agentuser['tmprice']+$orderprice;
pdo_update('ewei_shop_member', array('tmprice'=>$tmprice), array('id' => $member['id']));
public function ffbouns()
{
global $_W;
global $_GPC;
$members = pdo_fetchall("SELECT * FROM " . tablename("ewei_shop_member") . " WHERE status = 1 and isagent = 1 and agentlevel>0 and tmshopprice>0 and uniacid=" . $_W["uniacid"]);
if(empty($members)){
show_json(0, '暂无代理商需要分红!');
}
$bounsdata = array(
'addtime' => time(),
'status' => 1,
'type' => 1,
'note' => '团队分红',
);
foreach( $members as $member )
{
$bounsdata['totalprice'] = $member['tmshopprice'];
$bounsdata['memberid'] = $member['id'];
$level = $this->model->getLevel($member['openid']);
$bounsdata['mcommission'] = round($member['tmshopprice']*$level['tmbi']/100,2);
if($bounsdata['mcommission']>0){
pdo_insert("ewei_shop_agentbouns", $bounsdata);
pdo_update('ewei_shop_member', array('tmshopprice'=>0,'tmshopprices'=>$member['tmshopprices']+$member['tmshopprice']), array('id' => $member['id']));
}
}
show_json(1, '所有分红已成功发放!');
}
//奖金池分红
public function ffbouns()
{
global $_W;
global $_GPC;
global $_S;
$set = $_S['commission'];
$fhbi = (int)$set['fhbi'];
$level = pdo_fetch("select * from " . tablename("ewei_shop_commission_level") . " where id=1");
if($level['tmshopprice']<=0){
show_json(0, '可发放金额为空!');
}
$members = pdo_fetchall("SELECT id FROM " . tablename("ewei_shop_member") . " WHERE status = 1 and isagent = 1 and agentlevel=4 and uniacid=" . $_W["uniacid"]);
$mcount = count($members);
if($mcount>0){
$bounsdata = array(
'addtime' => time(),
'status' => 1,
'type' => 3,
'note' => '全球业绩分红',
);
$bounsdata['mcommission'] = round($level['tmshopprice']*$fhbi/$mcount/100,2);
if($bounsdata['mcommission']>0){
foreach( $members as $member )
{
$bounsdata['memberid'] = $member['id'];
pdo_insert("ewei_shop_agentbouns", $bounsdata);
}
}
}else{
show_json(0, '暂无分销商需要发放!');
}
pdo_update('ewei_shop_commission_level', array('tmshopprice'=>0,'fftime'=>time()), array('id' => 1));
show_json(1, '成功发放!本次发放人数为'.$mcount.'人');
}
```
- php调试
- php记录
- 常用循环
- 日期时间转换
- 时间格式
- mktime获取今日昨日本月时间戳
- http_build_query生成请求字符串
- PHP取整的几种方法
- 微擎记录
- W全局变量
- Http请求
- 人人商城二开记录
- 数据处理
- 常用查询
- 会员信息
- 确认收货处理
- 维权处理
- 设置读取和配置
- 报单商品类型属性
- 团队佣金
- 自动升级
- 业绩分红
- 前端html和js
- html按钮提交处理
- 引用js传参
- 表单
- 表单判断
- 任务执行
- 提示跳转页
- 全局变量
- 订单交易
- DIY设置
- 系统菜单
- mysql记录
- 创建表-14
- html和js
- 模板中使用js变量传参
- js表单处理
- 表单判断
- js页面跳转刷新
- thinkphp帮助
- 导入导出excel