<?php
/**
 * 商品分类管理
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author xiaogg <xiaogg@sina.cn>
 */
 
namespace Admin\Controller;
class GuestController extends BaseController{
    public function index(){
		$memmber_num = M('Member')->count();
		$memmber_order_info = M('OrderInfo')->where('uid>0')->field('uid')->select();
		foreach($memmber_order_info as $v){
			$uid[]=$v['uid'];
		}
		$memmber_order_num = count(array_unique($uid));
		$memmber_order_all = M('OrderInfo')->where('uid>0')->count();
		$buy_lv = round(($memmber_order_num/$memmber_num),2);
		$memmber_order_money = M('OrderInfo')->where('uid>0')->sum('goods_amount');
		$per_m_order_num = 	round(($memmber_order_all/$memmber_num),2);	
		$per_order_money =  round(($memmber_order_money/$memmber_num),2);
		$no_memmber_order_money = M('OrderInfo')->where('uid=0')->sum('order_amount');
		$no_memmber_order_num = M('OrderInfo')->where('uid=0')->count();
		$no_member_avg = round(($no_memmber_order_money/$no_memmber_order_num),2);	
		$this->assign('memmber_num',$memmber_num);
		$this->assign('memmber_order_num',$memmber_order_num);
		$this->assign('memmber_order_all',$memmber_order_all);
		$this->assign('buy_lv',$buy_lv);
		$this->assign('memmber_order_money',$memmber_order_money);
		$this->assign('per_m_order_num',$per_m_order_num);
		$this->assign('per_order_money',$per_order_money);
		$this->assign('no_memmber_order_money',$no_memmber_order_money);
		$this->assign('no_memmber_order_num',$no_memmber_order_num);
		$this->assign('no_member_avg',$no_member_avg);
		//print_r($memmber_order_money);exit;
		$this->display();
	}
}