<?php

namespace app\controller\Order;

use Overtrue\Pinyin\Pinyin;
use think\facade\Db;

class RechargeRecord
{
    public function RechargeRecord($openid){
        $area = Db::table('user')->where('openid',$openid)->value('area');
        $pinyin = new Pinyin();
        $s = $pinyin->sentence($area);
        $s = strtr($s,array(' '=>''));
        $table = 'recharge_'.$s;
        $list = Db::table($table)->where('openid',$openid)->order('id desc')->select()->toArray();
        $i = 0;
        foreach ($list as $l){
            $list[$i]['total'] /= 100;
            $list[$i]['payer_total']/= 100;
            $i+=1;
        }
        return json($list);
    }


}