コード例 #1
0
} elseif (submitcheck('addsubmit')) {
    $group_id = intval($_GET['group_id']);
    $massmessage = trim($_GET['massmessage']);
    if (empty($massmessage)) {
        cpmsg_error('wechat:mass_no_text');
    }
    if (preg_match("/^\\[resource=(\\d+)\\]/", $massmessage, $r)) {
        $resource_id = $r[1];
        $res = C::t('#wechat#mobile_wechat_resource')->fetch($resource_id);
        if (!$res) {
            cpmsg('wechat:mass_no_found');
        }
        $news = array();
        if ($res['type'] == 0) {
            if ($res['data']['pic']) {
                $thumb_media_id = $wechat_client->upload('image', $_G['setting']['attachdir'] . 'common/' . $res['data']['local']);
                if (!$thumb_media_id) {
                    cpmsg_error($wechat_client->error());
                }
                $res['data']['thumb_media_id'] = $thumb_media_id;
                $res['data']['author'] = '';
            } else {
                cpmsg('wechat:mass_no_pic');
            }
            array_push($news, $res['data']);
        } else {
            if ($res['type'] == 1) {
                $news = array();
                foreach (array_keys($res['data']['mergeids']) as $resource_id) {
                    $res = C::t('#wechat#mobile_wechat_resource')->fetch($resource_id);
                    if (!$res) {