<?php

namespace wstmart\app\controller;

use wstmart\common\model\Ectwallet;

/**

 * ============================================================================

 * 用户电子钱包控制器

 */



class Ectwallets extends Base{



     protected $beforeActionList = ['checkAuth'];// 访问这些except下的方法不需要执行前置操作

    /**

    * 设置为默认地址

    */

    public function setDefault(){

        $rs = model('Ectwallet')->setDefault();

        exit(json_encode($rs));

        // return $rs;

    }

    /**

     * [index description]

     * @return [type] [description]

     */

	public function index(){

	   $data['ectNum'] = model('Ectwallet')->getEctNum();

       $data['eAddressInfo'] = model('Ectwallet')->getDefaultAddress();

       // return WSTReturn('',1,$data);

       exit(jsonReturn('',1,$data));

	}

    /**

     * [listQuery 钱包地址列表页]

     * @return [type] [description]

     */

	public function listQuery(){

        $data = model('Ectwallet')->listQuery();

        exit(jsonReturn('',1,$data));

    }

	/**

	* 跳去修改地址

	*/

	public function edit(){

        $id = input('post.eWalletId/d');

		$m = model('Ectwallet');

        $data = $m->infoById($id);

        // return WSTReturn('',1,$data);

        exit(jsonReturn('',1,$data));

	}

	/**

     * 新增

     */

    public function add(){

        $m = model('Ectwallet');

        $rs = $m->add();

        exit(json_encode($rs));

    }

	/**

    * 修改

    */

    public function toEdit(){

        $m = model('Ectwallet');

        $rs = $m->edit();

        exit(json_encode($rs));

    }

    /**

    * 删除

    */

    public function del(){

    	$m = model('Ectwallet');

        $rs = $m->del();

        exit(json_encode($rs));

    }

    /**

    * 获取ect变更记录

    */

   public function getEctLog(){

        $m = model('Ectwallet');

        $rs = $m->getEctLog();

        exit(jsonReturn('',1,$rs));

   }

    /**

    * 获取ect充值记录

    */

   public function getEctRechargeLog(){

        $m = model('Ectwallet');

        $rs = $m->getEctRechargeLog();

        exit(jsonReturn('',1,$rs));

   }

     /**

    * 获取ect提现记录

    */

   public function getUserEctCashLog(){

        $m = model('Ectwallet');

        $rs = $m->getUserEctCashLog();

        exit(jsonReturn('',1,$rs));

   }

   

    /**

    * 获取ect地址

    */

    public function getEctAddress(){

        $m = model('Ectwallet');

        $rs = $m->getEctAddress();

        exit(json_encode($rs));

    }

   /**

    * [withdraw 提现]

    * @return [type] [description]

    */

   public function withdraw(){

        $m = model('Ectwallet');

        $rs = $m->withdraw();

        exit(json_encode($rs));

   }

    

    

}