Example #1
0
 public function getNews($list)
 {
     $news = array();
     $count = 0;
     foreach ($list as $l) {
         $n = $this->where('id=' . $l)->find();
         $des = explode('</br>', $n['description']);
         $news[$count] = array('Title' => $n['title'], 'Description' => $des[0], 'PicUrl' => getWeChatImageUrl($n['picUrl']), 'Url' => $n['url'] == null ? getWeChatDetailUrl($n['id'], 'news') : $n['url']);
         $count = $count + 1;
     }
     return $news;
 }
 public function getProductNewsOfUser($openId)
 {
     $products = $this->getProductOfUser($openId);
     if ($products !== null) {
         $product_news = array();
         $count = 0;
         foreach ($products as $p) {
             $product_news[$count] = array('Title' => $p['id'] . ':' . $p['name'], 'Description' => $p['description'], 'PicUrl' => getWeChatImageUrl($p['picUrl']), 'Url' => $p['url'] == null ? getWeChatDetailUrl($p['id'], 'product') : $p['url']);
             $count = $count + 1;
         }
         return $product_news;
     }
     return null;
 }