微信公众号开发(151)——图文消息中生成表格列表

微信公众号开发(151)——图文消息生成表格

 

 

    $rabbitfollow = "<p><img data-type='gif' data-src='https://mmbiz.qpic.cn/mmbiz_gif/BIZBsErRy2ibgbtkAF72c3AicWkRxDzXAjL0yk8DOnmzcxoticnibOeia05zHdEL6gjxXEGHV4b8aFpSW4W7gsWLC3g/0?wx_fmt=gif' data-ratio='0.11875' data-w='640'/></p><p><br/></p>";

    $replymethod = "<p style='text-align: center;'>关注 东购 公众号,回复数字编号获取</p><p style='text-align: center;'><img data-src='https://mmbiz.qpic.cn/mmbiz_png/BIZBsErRy28WK7t8ah9KruBrKhmkeqzibkDfr9u34LfCpdxELqMVLnAktibHW7BdHznlia9KuJqKK1PHr8nfXW3Jg/0?wx_fmt=png' data-type='png' style='width: 100%;height: auto;'/></p><p><br/></p>";

    $functionlist = "<p><br/></p><b><table border='1' cellspacing='1' cellpadding='1'>
    <caption style='color:#DAA520'><strong>资源分类列表(点击蓝字进入)<strong></caption>
    <tr align='center'>
      <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/wOQHzpAhSrbZJ8PK5ELI-A'>特异功能</a></td>
      <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/HgjPPmsjEaAogsbU3Nb92A'>红包口令</a></td>
      <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/GKXN7MtEglrec8Itrm5pyw'>嘀嘀打车</a></td>
    </tr>
    <tr align='center'>
      <td><a href='http://buy.fangbei.org/Yhqhome/goods/index'>京东爆款</a></td>
      <td><a href='http://buy.fangbei.org/yhqhome/coupon/index'>京东优惠</a></td>
      <td><a href='http://buy.fangbei.org/yhqhome/activity/index'>京东活动</a></td>
    </tr>
    <tr align='center'>
      <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/Lbb46cLtvxdXbycPe9Fg3Q'>免费小说</a></td>
      <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/NsYkhtvT7leCLqZUoRRFAw'>生活技能</a></td>
      <td>敬请期待</td>
      
    </tr>
    </table></b>";

 

 

    public function updateFiction(){
        Vendor('Weixin.wxyhq_class');
        $weixin = new \weixin();
        $resource = M('resource','tp_');
        $map['category'] = "FICTION";
        $arr = $resource->order('id asc')->where($map)->limit(200)->select();

        $content = "";
        // $content .= $this->rabbitfollow;

        $content .= $this->replymethod;

        $content .= "<table border='1' cellspacing='1' cellpadding='1'>
<tr align='center'>
  <td>编号</td>
  <td>小说名称</td>
  <td>积分</td>
</tr>";
        foreach($arr as $item){
            $content .= "
<tr >
  <td align='center' style='color:OrangeRed'>".$item["id"]."</td>
  <td>".$item["title"]."</td>
  <td align='center'>".($item["startscore"] + $item["consumescore"])."</td>
</tr>";
        }
        $content .= "</table>
";

        $content .= $this->functionlist;
        var_dump($content);
        
        $news = array( "media_id"=>"bntHjEN8oAlFVjW3oT2XNcnU7KFajPhNGxixMzj9TWI",
                        "index"=>"3",
                        "articles"=> array("title"=>"免费热门小说列表",
                                        "thumb_media_id"=>"bntHjEN8oAlFVjW3oT2XNa6PS1YZo31ClkDtFRMvTMo",
                                        "author"=>"",
                                        "digest" =>"关注 东购 公众号还有更多料",
                                        "show_cover_pic" =>"0",
                                        "content" =>$content,
                                        "content_source_url" =>"",
                                        )
                        );

        $result = $weixin->update_permanent_news($news);
        header('Location:http://mp.weixin.qq.com/s/Lbb46cLtvxdXbycPe9Fg3Q');

    }

 

posted @ 2019-07-11 23:18 方倍工作室 阅读(...) 评论(...) 编辑 收藏