ProfileAction::photo PHP Method

photo() public method

public photo ( )
    public function photo()
    {
        if ($this->uid != $this->mid) {
            // $this->error ( '无权限查看' );
        }
        $this->_top();
        $this->_assignUserInfo($this->uid);
        // 晒物
        $map['uid'] = $this->uid;
        $products = M('shop_product_share')->where($map)->order('cTime desc')->findPage();
        $ids = getSubByKey($products['data'], 'product_id');
        $map['product_id'] = array('in', $ids);
        $goods = M('shop_product')->where($map)->findAll();
        foreach ($goods as $g) {
            $goodArr[$g['product_id']] = $g;
        }
        foreach ($products['data'] as $k => &$p) {
            if (isset($goodArr[$p['product_id']])) {
                $p = array_merge($p, (array) $goodArr[$p['product_id']]);
            } else {
                $arr = model('Shop')->GetGoodsInfo($p['product_id']);
                $p = array_merge($p, (array) $arr['result']);
            }
        }
        $this->assign('products', $products);
        // dump($products);exit;
        $this->display();
    }