コード例 #1
0
ファイル: DuotwFactory.class.php プロジェクト: fedkey/amango
 public function run()
 {
     //快捷回复生成
     if (strtolower($_POST['replytype']) == 'basic') {
         $new_articles = self::basicrun();
         $nums = count($new_articles);
         $data['response_static'] = 0;
         $data['response_compos'] = serialize(array('type' => 'fastarticles', 'num' => $nums, 'neiron' => $_POST['cateid'] . ',' . $_POST['id'], 'replace' => ''));
     } else {
         //多条图文生成
         $msgitem = $_POST['msgitem'];
         //图文替换流程
         $new_articles = array();
         $nums = count($msgitem);
         foreach ($msgitem as $key => $value) {
             $order = $value['tzid'];
             $picurl = get_cover_pic($value['conurl']);
             //判断是否是随机  最新
             if (in_array(strtolower($order), array('news', 'rand'))) {
                 $type = strtoupper($order) . $key;
                 $lmid = explode(',', $value['lmid']);
                 $newinfo[0] = empty($value['title']) ? $type . '0' : $value['title'];
                 $newinfo[1] = empty($value['conurl']) ? $type . '1' : $picurl;
                 $newinfo[3] = empty($value['url']) ? $type . '3' : $value['url'];
                 $replace[$key] = $lmid[1] . ',' . $value['tzid'];
             } else {
                 $item[0] = $value['title'];
                 $item[1] = $picurl;
                 $item[3] = $value['url'];
                 $info = get_tiezi_info($value['lmid'], $value['tzid']);
                 $newinfo = array_to_array($item, $info);
             }
             //判断是否为纯静态XML
             if (!is_numeric($value['tzid']) || !is_numeric($value['lmid'])) {
                 $is_statick = false;
             }
             $new_articles[] = array('Title' => $newinfo[0], 'Description' => $newinfo[0], 'PicUrl' => $newinfo[1], 'Url' => $newinfo[3]);
             unset($lmid);
             unset($newinfo);
         }
         //判断是否为纯静态
         $data['response_static'] = false === $is_statick ? 0 : 1;
         $data['response_compos'] = serialize(array('type' => 'articles', 'num' => $nums, 'neiron' => $msgitem, 'replace' => $replace));
     }
     $data['response_reply'] = 'Duotw';
     //$data['response_name']    = '多图文:'.$_POST['replytype'].'|时间:'.date("Y-m-d");
     $data['response_name'] = empty($_POST['response_name']) ? '多图文:' . $_POST['replytype'] . '|时间:' . date("Y-m-d") : $_POST['response_name'];
     $data['response_xml'] = addslashes(Factory('Duotw')->load($new_articles)->select());
     return empty($data['response_xml']) ? false : $data;
 }
コード例 #2
0
ファイル: DantwFactory.class.php プロジェクト: fedkey/amango
 public function run()
 {
     $draw = $_POST['yireply'];
     $replace = $_POST['replace'];
     //分解 引用内容
     $yinyong = explode(',', $draw);
     //分解 替换内容
     $replaceinfo = explode(',', $replace);
     $replaceinfo[1] = empty($replaceinfo[1]) ? '' : get_cover_pic($replaceinfo[1]);
     if ($yinyong[0] == 'null' || $yinyong[1] == 'null') {
         $new_articles[0]['Title'] = $replaceinfo[0];
         $new_articles[0]['Description'] = $replaceinfo[2];
         $new_articles[0]['PicUrl'] = $replaceinfo[1];
         $new_articles[0]['Url'] = $replaceinfo[3];
         $data['response_static'] = 1;
     } else {
         //判断是否为最新或者随机
         if (in_array(strtolower($yinyong[1]), array('rand', 'news'))) {
             $order = $yinyong[1];
             $info[0] = strtoupper($order) . '0';
             $info[2] = strtoupper($order) . '2';
             $info[1] = strtoupper($order) . '1';
             $info[3] = strtoupper($order) . '3';
             $data['response_static'] = 0;
         } else {
             //原始帖子内容
             $info = get_tiezi_info($yinyong[0], $yinyong[1]);
             $data['response_static'] = 1;
         }
         //资源替换
         $newinfo = array_to_array($replaceinfo, $info);
         $new_articles[0]['Title'] = $newinfo[0];
         $new_articles[0]['Description'] = $newinfo[2];
         $new_articles[0]['PicUrl'] = $newinfo[1];
         $new_articles[0]['Url'] = $newinfo[3];
     }
     $data['response_xml'] = addslashes(Factory('Dantw')->load($new_articles)->select());
     $data['response_compos'] = serialize(array('type' => 'articles', 'num' => 1, 'neiron' => $draw, 'replace' => $replace));
     $data['response_reply'] = 'Dantw';
     $data['status'] = 1;
     //标识
     //$data['response_name']    = '分类ID:'.$yinyong[0].'|类型:'.$yinyong[1];
     $data['response_name'] = empty($_POST['response_name']) ? '分类ID:' . $yinyong[0] . '|类型:' . $yinyong[1] : $_POST['response_name'];
     return empty($data['response_xml']) ? false : $data;
 }