<?php
/** 账号中心
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author zhaoh <zhaoh@qq.com>
 */

namespace Shop\Model;
use Think\Model;
class AccountModel extends Model{
	protected $tableName = 'shopbalance_log';
	/**
	 * 店铺日志
	 * @param $postdata mixed
	 * @return  mixed  
	*/
    public function action_list($post){
		$shops_info=session('shops_info');
		$map['user_id']=$shops_info['shop_id'];
		$map['model']='Shop';
		$field=true;
		$page_num=$post['page_num']?$post['page_num']:20;
		
		//搜索条件
		if(!empty($post['time_form'])){$map['create_time'][]=array('egt',strtotime($post['time_form']));}
		if(!empty($post['time_to'])){$map['create_time'][]=array('elt',strtotime($post['time_to']));}
		if(!empty($post['action_id'])){$map['action_id']=$post['action_id'];}
		
		$list=page_list('ActionLog',$map,'id desc',$field,$page_num,'',1);
		return $list;
    }
	/**
	 * 结算信息列表
	 * @param $postdata mixed
	 * @return  mixed  
	*/
    public function account_list($post){
		$shops_info=session('shops_info');
		$map['shop_id']=$shops_info['shop_id'];
		$field=true;
		$page_num=$post['page_num']?$post['page_num']:20;
		
		//搜索条件
		if(!empty($post['time_form'])){$map['change_time'][]=array('egt',strtotime($post['time_form']));}
		if(!empty($post['time_to'])){$map['change_time'][]=array('elt',strtotime($post['time_to']));}
		if(!empty($post['order_sn'])){$map['order_id']=idtoname($post['order_sn'],'OrderInfo','id','order_sn');}
		if(!empty($post['type'])){$map['type']=$post['type'];}
		$list=page_list('ShopbalanceLog',$map,'id desc',$field,$page_num,'',1);
		return $list;
    }
}

?>