多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
#### 1.分销员推广链接 会员在店铺中的消费金额满足分销员申请条件后发起申请,当店铺审核通过后,会员才能成为分销员有推广链接。 ![](https://box.kancloud.cn/28079b8fc8f256984b0f27df0e9d6112_1234x595.png) ![](https://box.kancloud.cn/dbb22fafbeb6aa84e9f592ec02e019ea_1303x770.jpg) ![](https://box.kancloud.cn/f320ccf63182e60dfea965f8377e39b9_1268x653.jpg) 分销推广链接:index.php?ctl=Goods_Goods&met=goods&type=goods&gid=153&rec=u10081s2c106 rec:推广分销员的信息 #### 2.打开分销推广链接 文件地址:shop/controllers/Goods/GoodsCtl.php 方法:goods() ~~~ //判断是否开启分销插件 if (Web_ConfigModel::value('Plugin_Directseller')) { $goods_detail['recImages'] = ''; //推荐者上传的图片 $PluginManager = Yf_Plugin_Manager::getInstance(); $data = $PluginManager->trigger('rec_goods'); $goods_detail['recImages'] = isset($data['Plugin_Directseller_recGoods']) ? $data['Plugin_Directseller_recGoods'] : ''; //--END } ~~~ #### 4.新用户通过分销推广链接注册 文件地址:shop/controllers/LoginCtl.php 方法:check() sass中规定只有新注册的用户才能发展为推广员,所以此处sass与shop的check()方法中可能有一点区别。sass中已注册会员发展推广员的代码注释了。 ~~~ if (Web_ConfigModel::value('Plugin_Directseller')) { if ($_COOKIE['yf_recserialize']) { //regDone $PluginManager = Yf_Plugin_Manager::getInstance(); $PluginManager->trigger('regDone', $user_id); } } ~~~ #### 5.$PluginManager = Yf_Plugin_Manager::getInstance(); 文件地址:shop/controllers/Plugin/Directseller.php ~~~ public function recGoods() { $data = array(); $rec = request_string('rec'); if($rec) { $cond_row = array(); $cond_row['shop_directseller_goods_common_code'] = $rec; $Distribution_ShopDirectsellerGoodsCommonModel = new Distribution_ShopDirectsellerGoodsCommonModel(); $recImages = $Distribution_ShopDirectsellerGoodsCommonModel->getOne($cond_row); setcookie('yf_recserialize',$rec,time()+60*60*24*3); if(!empty($recImages['directseller_images_image'])) { $data = explode(',',$recImages['directseller_images_image']); } } return $data; } ~~~ ~~~ /** * 注册完成后,判断是否需要建立分佣关系 * * @return mixed */ public function regDone($user_id) { $rec = $_COOKIE['yf_recserialize']; $b= (strpos($rec,"u")); $e= (strpos($rec,"s")); $data['user_parent_id'] = substr($rec,$b+1,$e-1); /* $User_BaseModel = new User_BaseModel(); $User_BaseModel->editBase($userid,$data); */ $User_InfoModel = new User_InfoModel(); $User_InfoModel->editInfo($user_id,$data); return true; } ~~~