Example #1
0
 private function projects_open($xml)
 {
     $from = $xml->FromUserName;
     $to = $xml->ToUserName;
     $prjs = Project::get_valid_project(0, 8, Project::STATUS_OPEN);
     if (!$prjs || $prjs['total'] == 0) {
         $url = _url('project');
         $this->wx_reply->imm_reply_news($to, $from, array(array('title' => '暂无募集项目,敬请期待', 'img_url' => 'http://s1.axelahome.com/img/prj/wechat/no_open.jpg', 'link' => $url)));
         return;
     }
     $news_arr = array();
     foreach ($prjs['items'] as $key => $prj) {
         $url = EncryptID::get_prj_url($prj->id);
         if (ENV == 'dev') {
             $url = preg_replace('/^https/', 'http', $url);
         }
         array_push($news_arr, array('title' => $prj->title, 'desc' => $prj->title, 'img_url' => $prj->img, 'link' => $url));
     }
     $this->wx_reply->imm_reply_news($to, $from, $news_arr);
 }