网站开发 · 2025年4月23日

修改ecshop让用户注册就发红包

 

1.首先在后台添加红包。如图:
 

修改ecshop让用户注册就发红包插图

2.修改文件。user.php

找到:228 行左右

  1.         if (register($username, $password, $email, $other) !== false)
  2.         {

复制代码

添加:

  1.         if (register($username, $password, $email, $other) !== false)
  2.         {
  3.                         /* 用户注册就发红包 */
  4.                 $bonus = $db->getRow(‘SELECT * FROM ‘ . $ecs->table(“bonus_type”) . ‘ WHERE send_type = 0’, true);
  5.                         if($bonus){
  6.                                 if(time()<($bonus[‘send_end_date’]+28800)){
  7.                                         $sql = “INSERT INTO ” . $ecs->table(‘user_bonus’) .
  8.                                                         “(bonus_type_id, bonus_sn, user_id, used_time, order_id, emailed) ” .
  9.                                                         “VALUES (‘$bonus[type_id]’, 0, ‘$_SESSION[user_id]’, 0, 0, 0)”;
  10.                                         $db->query($sql);
  11.                                 }
  12.                         }

复制代码