分销升级表
ewei_shopv2/plugin/commission/core/model.php
等级条件 | 等级字段 |
---|---|
分销订单总额(完成的订单) | 0 |
一级分销订单金额(完成的订单) | 1 |
一级分销订单总数(完成的订单) | 3 |
自购订单金额(完成的订单) | 4 |
自购订单数量(完成的订单) | 5 |
下线总人数(分销商+非分销商) | 6 |
一级下线人数(分销商+非分销商) | 7 |
下级分销商总人数 | 8 |
一级分销商人数 | 9 |
已提现佣金总金额 | 10 |
购买指定产品 | 11 |
①计算订单商品的佣金,及下单时候上级分晓商登记
public function calculate($orderid = 0, $update = true, $order_agentid = NULL)
②
1. 获取本级别的无限上级
//本级别的id
$this->getSup($member['id']);
public function getSup($id,$n = 0)
{
global $_W;
global $_GPC;
$res = pdo_get('ewei_shop_member', array('id' => $id));
//有上级
if ($res['agentid']!=0) {
if($n){
$ids .= "," . $res['agentid'];
}else{
$ids =$res['agentid'];
}
$n++;
$ids .= $this->getSup($res['agentid'],$n);
}
return $ids;
}
2.查询所有下级
SELECT * FROM `ims_ewei_shop_member` where (agentid =29 or agentid in (SELECT id FROM `ims_ewei_shop_member` where agentid IN (SELECT agentid as agentids FROM `ims_ewei_shop_member` where agentid =29))) 查询所有下级
3.查询所有上级
新增会员
INSERT INTO wx
.ims_ewei_shop_member
( uniacid
, uid
, agentid
, openid
, createtime
, agenttime
, status
, isagent
, nickname
, credit1
, credit2
, gender
, avatar
, childtime
) VALUES (2, 3463, 30, 'o8eQ3xJ9ptBg0DDICbxwC1sIxsZM', 1542245284, 1542245284, 1, 1,'Biu', 0.00, 0.00, 1, 'http://thirdwx.qlogo.cn/mmopen/CmTSWzyiao7VMDjqQxv5hqA7aDuhpdXibvrNrZ2iaZFibrQUT5yXUcrHnVuQpSiaiaVgbDTje8Bhz6mp7iaA7YxDYKrPqsyOTcOeblW/132', 1542245284);
DIY界面路径
ewei_shopv2/plugin/diypage/core/model.php
新用户进入界面路径
core/model/member.php
二维码扫描关注后php
plugin/poster/core/model.php
plugin/poster/core/processor.php
336行
人人商城小程序模板信息(通用)
$openid = str_replace('sns_wa_', '', $profile['openid']);
$formid = pdo_fetch("SELECT * FROM ".tablename('ewei_shop_formid')." WHERE count=0 and openid='".$profile['openid']."' order by createtime asc");
$accessToken = $this->getAccessToken();
$set = pdo_get('ewei_shop_sysset', array('uniacid' => $_W['uniacid']));
$sets=iunserializer($set['sets']);
$tmessid = pdo_get('ewei_shop_wxapp_tmessage', array('id' => $sets['app']['tmessage_recharge']));
$user1 = pdo_get('ewei_shop_member', array('openid' => $profile['openid']));
$data = array(//这里一定要按照微信给的格式
"touser"=>$openid,
"template_id"=>$tmessid['templateid'],
"page"=>'pages/index/index',
"form_id"=>$formid['formid'],
"data"=>array(
"keyword1"=>array(
"value"=>$num,
"color"=>"#173177"
),
"keyword2"=>array(
"value"=>date("Y-m-d H:i",time()),
"color"=>"#173177"
),
"keyword3"=>array(
"value"=>'后台充值',
"color"=>"#173177"
),
"keyword4"=>array(
"value"=>$user1['credit2'],
"color"=>"#173177"
)
),
"emphasis_keyword"=>"keyword1.DATA",//需要进行加大的消息
);
$obj = json_encode($data);
load()->func('communication');
$aa=ihttp_post("https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" . $accessToken, $obj);
pdo_update('ewei_shop_formid', array('count'=>1), array('id' => $formid['id']));
$accessToken = $this->getAccessToken();
if( is_error($accessToken) )
{
show_json(1, "accessToken获取失败");
}
$data = array(//这里一定要按照微信给的格式
"touser"=>'ouKyK5drOVXxcAhHKWSgO4C5pK90',
"template_id"=>'w5kKDQULYfeZcpNxmjQQP9pL4c4q7cpTV3-ZOAe2KZc',
"page"=>'pages/commission/register/index',
"form_id"=>'1544894194369',
"data"=>array(
"keyword1"=>array(
"value"=>'1111',
"color"=>"#173177"
),
"keyword2"=>array(
"value"=>'2222',
"color"=>"#173177"
),
"keyword3"=>array(
"value"=>'3333',
"color"=>"#173177"
),
"keyword4"=>array(
"value"=>'444',
"color"=>"#173177"
),
"keyword5"=>array(
"value"=>'5555',
"color"=>"#173177"
)
),
"emphasis_keyword"=>"keyword1.DATA",//需要进行加大的消息
);
$obj = json_encode($data);
load()->func('communication');
$result=ihttp_post("https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" . $accessToken, $obj);
show_json(1, $result);
// show_json(1, array( "url" => referer() ));
}
public function getAccessToken()
{
global $_W;
$appset = m("common")->getSysset("app");
$cacheKey = "eweishop:wxapp:accesstoken:" . $_W["uniacid"];
$accessToken = m("cache")->get($cacheKey, $_W["uniacid"]);
if( !empty($accessToken) && !empty($accessToken["token"]) && TIMESTAMP < $accessToken["expire"] )
{
return $accessToken["token"];
}
if( empty($appset["appid"]) || empty($appset["secret"]) )
{
return error(-1, "未填写小程序的 appid 或 appsecret!");
}
load()->func("communication");
$content = ihttp_get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appset["appid"] . "&secret=" . $appset["secret"]);
if( is_error($content) )
{
return error(-1, "获取微信公众号授权失败, 请稍后重试!错误详情: " . $content["message"]);
}
$result = @json_decode($content["content"], true);
if( empty($result) || !is_array($result) || empty($result["access_token"]) || empty($result["expires_in"]) )
{
$errorinfo = substr($content["meta"], strpos($content["meta"], "{"));
$errorinfo = @json_decode($errorinfo, true);
return error(-1, "获取微信公众号授权失败, 请稍后重试! 公众平台返回原始数据为: 错误代码-" . $errorinfo["errcode"] . ",错误信息-" . $errorinfo["errmsg"]);
}
$record["token"] = $result["access_token"];
$record["expire"] = (TIMESTAMP + $result["expires_in"]) - 200;
m("cache")->set($cacheKey, $record, $_W["uniacid"]);
return $result["access_token"];
}
分销升级代码
ewei_shopv2/core/model/member.php
订单分销ims_ewei_shop_order_goods
订单自动完成执行
分销
ewei_shopv2/plugin/commission/core/model.php
public function checkOrderFinish($orderid = "")
每次订单发生变化
/addons/ewei_shopv2/core/model/order.php
public function setStocksAndCredits($orderid = "", $type = 0)
if( !empty($isgoodspoint["isgoodspoint"]) && $isgoodspoint["isgoodspoint"] == 1 )
{
$gcredit = trim($g["credit"]);
if( $g["seckill"] != 1 && !empty($gcredit) )
{
if( strexists($gcredit, "%") )
{
$credits += intval(floatval(str_replace("%", "", $gcredit)) / 100 * $g["realprice"]);
}
else
{
$credits += intval($g["credit"]) * $g["total"];
}
}
}
购买时处理
public_html/addons/ewei_shopv2/core/mobile/order/create.php
public function main()
会员升级表
core/model/member.php
public function upgradeLevel($openid, $orderid = 0)
股东分销订单
plugin/globonus/core/model.php
订单创建
core/mobile/order/create.php
运费设置
if (!empty($allgoods) && !$nowsendfree&&!$isonlyverifygoods) {
//计算运费
$dispatch_array = m('order')->getOrderDispatchPrice($allgoods, $member, $address, $saleset, $merch_array, 1);
$dispatch_price = $dispatch_array['dispatch_price'] -$dispatch_array['seckill_dispatch_price'];
$nodispatch_array = $dispatch_array['nodispatch_array'];
$seckill_dispatchprice =$dispatch_array['seckill_dispatch_price'];
}
前端样式
![](https://img.haomeiwen.com/i7508328/4d25075422ee9c17.png)
ewei_shopv2/template/mobile/default/goods/picker.html
网友评论