ecshop二次开发

ecshop

2015-01-02 13:33

uc 调用接口是 uc_call( );  在include/cls_common.php

使用方法  uc_call($func, $params);

---------------------------------------------------------------------------------------------------

ecshop  utf8    ucenter gbk 怎么链接

用户登陆在
\includes\modules\integrates\ucenter.php
function login($username, $password)

$username=iconv("UTF-8", "GB2312//IGNORE", $username);  //增加转换
list($uid, $uname, $pwd, $email, $repeat) = uc_call("uc_user_login", array($username, $password));
$uname = addslashes($uname);
$uname=iconv("GB2312//IGNORE", "UTF-8", $uname);//反转字符

 -----------------------------------------------------------------------------------------------------------

红包同批次只能使用一次

修改文件include/lib_transaction.php  
function add_bonus($user_id, $bouns_sn) //此函数为用户中心添加(绑定)红包函数

在 $sql = "UPDATE " .$GLOBALS['ecs']->table('user_bonus') . " SET user_id = '$user_id' ". "WHERE bonus_id = '$row[bonus_id]'";  前面 增加 。。。

 

$sql = "SELECT count(*) as nid FROM " .$GLOBALS['ecs']->table('user_bonus') .
           " WHERE bonus_type_id = '".$row['bonus_type_id']."'  and user_id='".$user_id."'";
 $rs = $GLOBALS['db']->getRow($sql);
   //查询该红包的批次
    if ($rs[nid] > 0)
            {
                $GLOBALS['err']->add('同类型红包只能使用一次.');
                return false;
            }
-----------------------------------------------------------------------------------------------------------

同时手机版的也是如此


-----------------------------------------------------------------------------------------------------------

注册送红包

在后台设置一个 线下红包 

-------------------------------------------------------------------------------------------------------

include / lib_main.php

//给账号发送 类型的红包  帐号 红包id

function fahongfa($uid,$type){



    //查询

$bonus_id = $GLOBALS['db']->getOne("SELECT bonus_id  FROM " . $GLOBALS['ecs']->table('user_bonus') . " where bonus_type_id={$type} and user_id=0 and used_time=0 and emailed=0");

if($bonus_id){

    $GLOBALS['db']->query("update ".$GLOBALS['ecs']->table('user_bonus')." set emailed=1,user_id='{$uid}' where bonus_id='{$bonus_id}'");

    return true;

}


    return false;

}

在user.php

在成功注册后 加入  fahongfa($_SESSION['user_id'],25); 

$r=$GLOBALS['db']->getRow($sql);

if (time()>strtotime(HD_js_ks) and time()<strtotime(HD_js_js))

{

$r['custom_points']=$r['custom_points']*HD_x;

$r['rank_points']=$r['rank_points']*HD_x;


}

return $r;



--------------------------------------------------------------------------------------------------------------


双倍积分

---------------------------------------------------------------------------------------------

include/inc_constant.php 增加常量

/*双倍积分*/

define('HD_x', 2); //活动积分 翻倍

define('HD_js_ks', '2015-01-10'); //活动积分 开始时间

define('HD_js_js', '2015-01-30'); //活动积分 结束时间

define('HD_js', '活动期间积分2倍'); //活动提示


在include\lib_order.php    integral_to_give    根据订单计算积分

                            get_give_integral   根据购物车计算积分

在include\lib_common.php  log_account_change 给于积分


get_give_integral 修改如下

$num=intval($GLOBALS['db']->getOne($sql));

if (time()>strtotime(HD_js_ks) and time()<strtotime(HD_js_js)) $num=$num*HD_x; }

 return $num;


integral_to_give 修改如下 

$r=$GLOBALS['db']->getRow($sql);

if (time()>strtotime(HD_js_ks) and time()<strtotime(HD_js_js))

{   $r['custom_points']=$r['custom_points']*HD_x;

    $r['rank_points']=$r['rank_points']*HD_x;   

 }

return $r;

模板显示修改如下 

library/order_total.lbi

 <!-- {if $config.use_integral} 是否使用积分-->

 <font class="f4_b">{$total.will_get_integral}</font> {$points_name} <font class="f4_b">{$jf_js}</font> 黑色的后加入

 <!-- {/if} -->


include/lib_insert.php

function insert_jf_js(){

    if (time()>strtotime(HD_js_ks) and time()<strtotime(HD_js_js))

    { return HD_js; }

}

flpw.php 

select_shipping 方法后加入

$smarty->assign('jf_js',    insert_jf_js());