分銷升級(jí)表
ewei_shopv2/plugin/commission/core/model.php
等級(jí)條件 | 等級(jí)字段 |
---|---|
分銷訂單總額(完成的訂單) | 0 |
一級(jí)分銷訂單金額(完成的訂單) | 1 |
一級(jí)分銷訂單總數(shù)(完成的訂單) | 3 |
自購訂單金額(完成的訂單) | 4 |
自購訂單數(shù)量(完成的訂單) | 5 |
下線總?cè)藬?shù)(分銷商+非分銷商) | 6 |
一級(jí)下線人數(shù)(分銷商+非分銷商) | 7 |
下級(jí)分銷商總?cè)藬?shù) | 8 |
一級(jí)分銷商人數(shù) | 9 |
已提現(xiàn)傭金總金額 | 10 |
購買指定產(chǎn)品 | 11 |
①計(jì)算訂單商品的傭金,及下單時(shí)候上級(jí)分曉商登記
public function calculate($orderid = 0, $update = true, $order_agentid = NULL)
②
1. 獲取本級(jí)別的無限上級(jí)
//本級(jí)別的id
$this->getSup($member['id']);
public function getSup($id,$n = 0)
{
global $_W;
global $_GPC;
$res = pdo_get('ewei_shop_member', array('id' => $id));
//有上級(jí)
if ($res['agentid']!=0) {
if($n){
$ids .= "," . $res['agentid'];
}else{
$ids =$res['agentid'];
}
$n++;
$ids .= $this->getSup($res['agentid'],$n);
}
return $ids;
}
2.查詢所有下級(jí)
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))) 查詢所有下級(jí)
3.查詢所有上級(jí)
新增會(huì)員
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
新用戶進(jìn)入界面路徑
core/model/member.php
二維碼掃描關(guān)注后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"=>'后臺(tái)充值',
"color"=>"#173177"
),
"keyword4"=>array(
"value"=>$user1['credit2'],
"color"=>"#173177"
)
),
"emphasis_keyword"=>"keyword1.DATA",//需要進(jìn)行加大的消息
);
$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",//需要進(jìn)行加大的消息
);
$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, "獲取微信公眾號(hào)授權(quán)失敗, 請(qǐng)稍后重試!錯(cuò)誤詳情: " . $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, "獲取微信公眾號(hào)授權(quán)失敗, 請(qǐng)稍后重試侥锦! 公眾平臺(tái)返回原始數(shù)據(jù)為: 錯(cuò)誤代碼-" . $errorinfo["errcode"] . ",錯(cuò)誤信息-" . $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"];
}
分銷升級(jí)代碼
ewei_shopv2/core/model/member.php
訂單分銷ims_ewei_shop_order_goods
訂單自動(dòng)完成執(zhí)行
分銷
ewei_shopv2/plugin/commission/core/model.php
public function checkOrderFinish($orderid = "")
每次訂單發(fā)生變化
/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"];
}
}
}
購買時(shí)處理
public_html/addons/ewei_shopv2/core/mobile/order/create.php
public function main()
會(huì)員升級(jí)表
core/model/member.php
public function upgradeLevel($openid, $orderid = 0)
股東分銷訂單
plugin/globonus/core/model.php
訂單創(chuàng)建
core/mobile/order/create.php
運(yùn)費(fèi)設(shè)置
if (!empty($allgoods) && !$nowsendfree&&!$isonlyverifygoods) {
//計(jì)算運(yùn)費(fèi)
$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'];
}
前端樣式
ewei_shopv2/template/mobile/default/goods/picker.html