ecshop会员注册推荐送现金插件开发

2016-06-13 13:05 来源:www.chinab4c.com 作者:ecshop专家

ecshop注册推荐送现金插件开发,ecshop模板屋提供该ecshop插件教程 1:模板user_clips.dwt增加以下代码。用来显示推荐的会员列表 {if $action=='list_fuwu'}  

                                                                           
会员ID会员名称注册时间
{$val.user_id}{$val.user_name}{$val.reg_time}
      {/if} 2:user.php中增加以下代码 elseif($action == 'list_fuwu'){ $rankid = intval($_REQUEST['rank_id']); $parent_id = intval($_REQUEST['parent_id']); if($parent_id && $rankid){      function get_comments($num,$start,$pid,$uk)    {       global $ecs;       global $db;       $sql ="  select  * from ".$ecs->table('users')." where parent_id = '$pid' and uk = '$uk' limit $start, $num";            $res = $db->getAll($sql);           return $res;    }    $sql = "SELECT COUNT(*) FROM ".$ecs->table('users')." where parent_id = '$parent_id' and uk = '$rankid'";    $record_count = $GLOBALS['db']->getOne($sql);    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;        $pager = get_pager("user.php?act=list_fuwu&parent_id=$parent_id&rank_id=$rankid", array(), $record_count, $page, 10);    $msg_lists = get_comments(10, $pager['start'],$parent_id, $rankid);       if($msg_lists){     foreach($msg_lists as $k => $v){      $msg_lists[$k][reg_time] = date("Y-m-d",$v[reg_time]);     }    }    $GLOBALS['smarty']->assign('rand',      mt_rand());        $GLOBALS['smarty']->assign('pager', $pager);    $GLOBALS['smarty']->assign('my_comments',$msg_lists);    $smarty->display('user_clips.dwt'); } } 3:user.php中增以下代码。用来计算服务费用 // 服务费用 elseif ($action == 'fuwu') {     //#################### //统计推荐 //#################### $result = array();//推荐会员返回统计信息 $re = $db -> getAll("select rank_id,rank_name from ".$ecs->table('user_rank')." order by rank_id asc"); if($re){   foreach($re as $k => $v){    if($v['rank_name']){     $n = $v['rank_name'];     $result[$n]['money'] = 0;     //取得会员数量     $con = $db -> getOne("select count(*) c from ".$ecs->table('users')." where user_rank = ".$v[rank_id]." and parent_id =".$_SESSION['user_id']." and user_rank = uk");     //统计金额     //$string = '推荐'..'注册提成'     $ua = $db -> getAll("select user_name from ".$ecs->table('users')." where user_rank = ".$v[rank_id]." and parent_id =".$_SESSION['user_id']." and user_rank = uk");     if($ua){      foreach($ua as $k => $v){       $string = '推荐'.$v[user_name].'注册提成';       $money = $db -> getOne("select user_money from ".$ecs->table('account_log')." where change_desc = '$string'");       $result[$n]['money']+= $money;//计算推荐金额      }     }     $result[$n]['num']  = $con;     $result[$n]['rank_id']  = $v['rank_id'];    }   } }   //################# //格式化金额 //################# if($result){   foreach($result as $k => $v){    $result[$k]['money'] =  price_format($v['money'], false);   } } $smarty -> assign('affdb',$result);     $smarty->assign('shopname', $_CFG['shop_name']);     $smarty->assign('userid', $user_id);     $smarty->assign('shopurl', $ecs->url());     $smarty->assign('logosrc', 'themes/' . $_CFG['template'] . '/images/logo.gif');     $smarty->display('user_clips.dwt'); } 4:admin/affliliate.php中的list中增加以下代码 //################## //推荐VIP会员送现金 //################## $re = $db -> getAll("select * from ".$ecs->table('user_rank')." order by rank_id"); $smarty -> assign('rank',$re); //################## //推荐VIP会员送现金 //##################   5:admin/affliliate.php中的updata增以下代码 if($_POST['rank']){      $ar = array_combine($_POST['rn'],$_POST['rank']);   if($ar){    foreach($ar as $k => $v){     $sql = " update ".$ecs->table('user_rank')." set qian = ".$v." where rank_id = $k";     $db -> query($sql);    }   }    } 5:affliate.htm中增加以下代码                     推荐VIP会员送现金:                          {foreach from = $rank item = item}        {$item.rank_name}:                                {/foreach}                       6:user_clips.dwt中增加以下代码。用来列表推荐信息                                                                            
{$lang.affiliate_lever}{$lang.affiliate_num}提成金额
{$level}{$val.num}{$val.money}
完毕!