zoukankan      html  css  js  c++  java
  • ECSHOP邮件验证后送积分

    lib_common.php 的 log_account_change方法
    /**
    * 记录帐户变动
    * @param int     $user_id       用户id
    * @param float $user_money     可用余额变动
    * @param float $frozen_money 冻结余额变动
    * @param int     $rank_points 等级积分变动
    * @param int     $pay_points     消费积分变动
    * @param string   $change_desc 变动说明
    * @param int     $change_type 变动类型:参见常量文件
    * @return   void
    */
    function log_account_change($user_id, $user_money = 0, $frozen_money = 0, $rank_points = 0, $pay_points = 0, $change_desc = '', $change_type = ACT_OTHER)

    它会执行两个动作,一个是调整注册会员积分调整记录日志,一个就是修改个人帐户的积分了。

    在user.php验证邮件方法下加入如下代码
    /* 验证用户注册邮件 */
    elseif ($action == 'validate_email')
    {
    $hash = empty($_GET['hash']) ? '' : trim($_GET['hash']);
    if ($hash)
    {
           include_once(ROOT_PATH . 'includes/lib_passport.php');
           $id = register_hash('decode', $hash);
           if ($id > 0)
           {
             $sql = 'SELECT is_validated FROM '.$ecs->table('users')." WHERE user_id='$id'";
                         $row = $db->getRow($sql);
                         if($row['is_validated'] == 0)
                         {
                                   $sql = "UPDATE " . $ecs->table('users') . " SET is_validated = 1 WHERE user_id='$id'";
                                   $db->query($sql);
                                   $sql = 'SELECT user_name, email FROM ' . $ecs->table('users') . " WHERE user_id = '$id'";
                                   $row = $db->getRow($sql);
                                   //验证完成 送积分 by gaojin 201003300850
                                   include_once(ROOT_PATH .'includes/lib_common.php');
                                   log_account_change($id, 0, 0, 0, 500,$GLOBALS['_LANG']['register_points']);
                                   show_message(sprintf($_LANG['validate_ok'], $row['user_name'], $row['email']),$_LANG['profile_lnk'], 'user.php');
                                 
                         }
                         else
                         {
                                   show_message(sprintf('请不要重复验证', $row['user_name'], $row['email']),$_LANG['profile_lnk'], 'user.php');
                         }
           }
    }
    show_message($_LANG['validate_fail']);
    }
    希望对大家有所帮助

    修改了重复点击验证邮件未验证的bug,会导致重复送积分的问题

    ------------------------------------------华丽丽的分割线--------------------- ------------------------------------

    源厂制造10-10000级洁净无尘车间防静电防尘用品!网址:http://www.lgfjd.com 微信号:614412
  • 相关阅读:
    进程与线程
    the art of seo(chapter seven)
    the art of seo(chapter six)
    the art of seo(chapter five)
    the art of seo(chapter four)
    the art of seo(chapter three)
    the art of seo(chapter two)
    the art of seo(chapter one)
    Sentinel Cluster流程分析
    Sentinel Core流程分析
  • 原文地址:https://www.cnblogs.com/wangblognet/p/2728034.html
Copyright © 2011-2022 走看看