ecshop会员中心资金管理

2010-05-27 23:02 来源:www.chinab4c.com 作者:admin

     ecshop会员中心,我们不但给ecshop会员中心订单搜索功能。而且我们还给ecshop会员中心资金管理增加每次资金流动时候的总金额.让不同的ecshop会员等级享受不同的权益.下面我们谈谈ecshop会员中心资金管理.

    1:alter table  ecs_account_log add column sub_total decimal(10,2);增加该字段
    

    2:includes/lib_common.php
function log_account_change
  $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('account_log'), $account_log, 'INSERT');
 $id = $GLOBALS['db'] -> insert_id();
   // $sql2 = "select sum(user_money) from ".$GLOBALS['ecs']->table('account_log')." where user_id = '$user_id'";
 //$sum = $GLOBALS['db']->getOne($sql2);
 
    /* 更新用户信息 */
    $sql = "UPDATE " . $GLOBALS['ecs']->table('users') .
            " SET user_money = user_money + ('$user_money')," .
            " frozen_money = frozen_money + ('$frozen_money')," .
            " rank_points = rank_points + ('$rank_points')," .
            " pay_points = pay_points + ('$pay_points')" .
            " WHERE user_id = '$user_id' LIMIT 1";
    $GLOBALS['db']->query($sql);
 $sql2 = " select user_money from ".$GLOBALS['ecs']->table('users')." where user_id = '$user_id'";
 $sum = $GLOBALS['db']->getOne($sql2);
    $sql = " update ".$GLOBALS['ecs']->table('account_log')." set sub_total = '$sum' where log_id = '$id' and user_id = '$user_id'";
 $GLOBALS['db']->query($sql);

      3:user.php
elseif ($action == 'account_detail')

$row['sub_total'] = price_format(abs($row['sub_total']), false);

      4:user_transaction.dwt

 <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#dddddd">
          <tr align="center">
            <td bgcolor="#ffffff">{$lang.process_time}</td>
            <td bgcolor="#ffffff">{$lang.surplus_pro_type}</td>
            <td bgcolor="#ffffff">{$lang.money}</td>
     <td bgcolor="#ffffff">余额</td>
            <td bgcolor="#ffffff">{$lang.change_desc}</td>
          </tr>
          <!--{foreach from=$account_log item=item}-->
          <tr>
            <td align="center" bgcolor="#ffffff">{$item.change_time}</td>
            <td align="center" bgcolor="#ffffff">{$item.type}</td>
            <td align="right" bgcolor="#ffffff">{$item.amount}</td>
     <td align="right" bgcolor="#ffffff">{$item.sub_total}</td>
            <td bgcolor="#ffffff" title="{$item.change_desc}">&nbsp;&nbsp;{$item.short_change_desc}</td>
          </tr>
          <!--{/foreach}-->
          <tr>
            <td colspan="4" align="center" bgcolor="#ffffff"><div align="right">{$lang.current_surplus}{$surplus_amount}</div></td>
          </tr>
        </table>

           以上就完成了ecshop会员中心每次资金流动时候,剩余的会员可用金额.

          来源:http://www.chinab4c.com