コード例 #1
0
ファイル: tpl.func.php プロジェクト: nsoff/wdlcms
function tpl_form_field_wechat_video($name, $value = '', $options = array())
{
    global $_W;
    $account = uni_accounts();
    $data = array();
    if (!empty($account)) {
        foreach ($account as $li) {
            if ($li['level'] < 3) {
                continue;
            }
            $data['item'][] = $li;
        }
        $data['total'] = count($data['item']);
        unset($account);
    }
    if (empty($options['acid']) && $data['total'] == 1) {
        $options['acid'] = $data['item'][0]['acid'];
    }
    if (empty($data['total'])) {
        $options['error'] = 1;
    }
    if (!empty($value)) {
        $media_data = (array) media2local($value, true);
        $val = $media_data['attachment'];
    }
    if (!is_array($options)) {
        $options = array();
    }
    if (empty($options['tabs'])) {
        $options['tabs'] = array('video' => 'active', 'browser' => '');
    }
    $options = array_elements(array('tabs', 'global', 'dest_dir', 'acid', 'error'), $options);
    $options['direct'] = true;
    $options['multi'] = false;
    $options['type'] = 'video';
    $s = '';
    if (!defined('TPL_INIT_WECHAT_VIDEO')) {
        $s = '
<script type="text/javascript">
	function showWechatVideoDialog(elm, options) {
		require(["util"], function(util){
			var btn = $(elm);
			var ipt = btn.parent().prev();
			var val = ipt.val();
			util.wechat_audio(val, function(url){
				if(url && url.media_id && url.url){
					btn.prev().show();
					ipt.val(url.media_id);
					ipt.attr("media_id",url.media_id);
					ipt.attr("url",url.url);
				}
				if(url && url.media_id){
					ipt.val(url.media_id);
				}
			}, ' . json_encode($options) . ');
		});
	}

</script>';
        echo $s;
        define('TPL_INIT_WECHAT_VIDEO', true);
    }
    $s .= '
	<div class="input-group">
		<input type="text" value="' . $value . '" name="' . $name . '" class="form-control" autocomplete="off" ' . ($options['extras']['text'] ? $options['extras']['text'] : '') . '>
		<span class="input-group-btn">
			<button class="btn btn-default" type="button" onclick="showWechatVideoDialog(this,' . str_replace('"', '\'', json_encode($options)) . ');">选择媒体文件</button>
		</span>
	</div>
	<div class="input-group audio-player">
	</div>';
    if (!empty($media_data) && $media_data['model'] == 'temp' && time() - $media_data['createtime'] > 259200) {
        $s .= '<span class="help-block"><b class="text-danger">该素材已过期 [有效期为3天],请及时更新素材</b></span>';
    }
    return $s;
}
コード例 #2
0
ファイル: coupon.mod.php プロジェクト: eduNeusoft/weixin
function coupon_fetch($id, $format = true)
{
    global $_W;
    $id = intval($id);
    $item = pdo_fetch('SELECT * FROM ' . tablename('coupon') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $id));
    if (empty($item)) {
        return error(-1, '卡券不存在或已删除');
    }
    if (!$format) {
        return $item;
    } else {
        $item['location-select'] = '';
        $item['location_count'] = 0;
        if (!empty($item['location_id_list'])) {
            $item['location_id_list'] = @iunserializer($item['location_id_list']);
            foreach ($item['location_id_list'] as $lic) {
                $item['location_data'][] = pdo_fetch('SELECT business_name, address, location_id FROM ' . tablename('coupon_location') . ' WHERE uniacid = :aid AND location_id = :lid', array(':aid' => $_W['uniacid'], ':lid' => $lic), 'location_id');
            }
            $item['location_count'] = count($item['location_id_list']);
            if (!empty($item['location_id_list'])) {
                $item['location-select'] = implode('-', $item['location_id_list']);
            }
        }
        $item['date_info'] = iunserializer($item['date_info']);
        $item['logo_url'] = media2local($item['logo_url']);
        $item['discount_f'] = (100 - $item['discount']) / 10;
        if ($item['type'] == 'cash') {
            $item['extra'] = iunserializer($item['extra']);
            $item['least_cost'] = $item['extra']['least_cost'];
            $item['reduce_cost'] = $item['extra']['reduce_cost'];
        }
        if ($item['type'] == 'discount' || $item['type'] == 'cash') {
            $item['modules'] = pdo_fetchall('SELECT a.*, b.title FROM ' . tablename('coupon_modules') . ' AS a LEFT JOIN ' . tablename('modules') . ' AS b ON a.module = b.name WHERE a.cid = :id', array(':id' => $id));
        }
    }
    return $item;
}
コード例 #3
0
ファイル: notice.ctrl.php プロジェクト: nsoff/wdlcms
     $image = media2local($da['content']['media_id']);
     $content = '<a href="' . $image . '" target="_blank"><img src="' . $image . '" width="200"></a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
 } elseif ($da['msgtype'] == 'voice') {
     $image = media2local($da['content']['media_id']);
     $content = '<a href="' . $image . '" target="_blank"><i class="fa fa-bullhorn"></i> 语音消息</a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
 } elseif ($da['msgtype'] == 'music') {
     $music = tomedia($da['content']['hqmusicurl']);
     if (empty($music)) {
         $music = tomedia($da['content']['musicurl']);
     }
     $content = '<a href="' . $music . '" target="_blank"><i class="fa fa-music"></i> 音乐消息</a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
 } elseif ($da['msgtype'] == 'video') {
     $video = media2local($da['content']['media_id']);
     $content = '<a href="' . $video . '" target="_blank"><i class="fa fa-video-camera"></i> 视频消息</a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
 } elseif ($da['msgtype'] == 'news') {
     if ($da['content']['module'] == 'news') {
         $url = url('platform/reply/post', array('m' => 'news', 'rid' => $da['content']['rid']));
     } elseif ($da['content']['module'] == 'cover') {
         if (in_array($da['content']['cmodule'], array('mc', 'site', 'card'))) {
             $url = url('platform/cover/' . $da['content']['cmodule']);
         } else {
             $eid = pdo_fetchcolumn('SELECT eid FROM ' . tablename('modules_bindings') . ' WHERE module = :m AND do = :do AND entry = :entry', array(':m' => $da['content']['cmodule'], ':do' => $da['content']['do'], ':entry' => 'cover'));
             $li['url'] = url('platform/cover/', array('eid' => $eid));
         }
     }
     $content = '<a href="' . $url . '" target="_blank"><i class="fa fa-file-image-o"></i> 图文消息:' . $da['content']['name'] . '</a>';
     $str .= tpl_chats_log($content, $da['createtime'], 1);
コード例 #4
0
ファイル: mass.ctrl.php プロジェクト: aspnmy/weizan
    $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('mc_mass_record') . $condition, $pars);
    $list = pdo_fetchall("SELECT * FROM " . tablename('mc_mass_record') . $condition . " ORDER BY `id` DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $pars);
    $types = array('text' => '文本消息', 'image' => '图片消息', 'voice' => '语音消息', 'video' => '视频消息', 'news' => '图文消息');
    if (!empty($list)) {
        foreach ($list as &$li) {
            if ($li['msgtype'] == 'news') {
                $rid = intval($li['content']);
                if ($rid > 0) {
                    $li['rid'] = $rid;
                    $li['rule_name'] = pdo_fetchcolumn('SELECT name FROM ' . tablename('rule') . ' WHERE id = :id', array(':id' => $rid));
                } else {
                    $li['content'] = iunserializer($li['content']);
                    $li['content'] = iurldecode($li['content']);
                }
            } elseif (in_array($li['msgtype'], array('image', 'voice', 'video'))) {
                $li['content'] = media2local($li['content']);
            }
        }
    }
    $pager = pagination($total, $pindex, $psize);
    template('mc/send');
}
function iurldecode($str)
{
    if (!is_array($str)) {
        return urldecode($str);
    }
    foreach ($str as $key => $val) {
        $str[$key] = iurldecode($val);
    }
    return $str;
コード例 #5
0
ファイル: mass.ctrl.php プロジェクト: eduNeusoft/weixin
												</div>
											</a>
									  </div>
								  </div>
								</div>
							</div>';
                        }
                    }
                    $i++;
                }
            } elseif ($data['msgtype'] == 'text') {
                $html = '<div class="panel panel-default" style="margin-bottom:0">
							<div class="panel panel-body">' . emotion($data['content']) . '</div>
						</div>';
            } elseif ($data['msgtype'] == 'image') {
                $data['content'] = media2local($data['content']);
                $html = '<div class="panel panel-default" style="margin-bottom:0">
							<div class="panel panel-body"><img src="' . $data['content'] . '" style="width:365px;"></div>
						</div>';
            }
            exit($html);
        }
    }
}
function iurldecode($str)
{
    if (!is_array($str)) {
        return urldecode($str);
    }
    foreach ($str as $key => $val) {
        $str[$key] = iurldecode($val);
コード例 #6
0
ファイル: card.ctrl.php プロジェクト: 6662680/qday_wx
    $status = $acc->GetColors();
    if (is_error($status)) {
        message($status['message'], referer(), 'error');
    }
    foreach ($status['colors'] as $val) {
        $colors[$val['name']] = $val;
    }
    $colors = base64_encode(iserializer($colors));
    isetcookie('__color', $colors, 86400 * 7);
}
$colors = iunserializer(base64_decode($_GPC['__color']));
load()->func('tpl');
load()->model('coupon');
load()->classs('coupon');
$setting = pdo_fetch('SELECT * FROM  ' . tablename('coupon_setting') . ' WHERE uniacid = :aid AND acid = :cid', array(':aid' => $_W['uniacid'], ':cid' => $acid));
$setting['logourl_'] = media2local($setting['logourl']);
$types = array('discount' => '折扣券', 'cash' => '代金券', 'gift' => '礼品券', 'groupon' => '团购券', 'general_coupon' => '优惠券');
if ($do == 'display') {
    $condition = ' WHERE uniacid = :aid AND acid = :cid';
    $parma[':aid'] = $_W['uniacid'];
    $parma[':cid'] = $acid;
    if (!empty($_GPC['type'])) {
        $condition .= ' AND type = :type';
        $parma[':type'] = $_GPC['type'];
    }
    if (!empty($_GPC['title'])) {
        $title = trim($_GPC['title']);
        $condition .= " AND title LIKE '%{$title}%'";
    }
    if (!empty($_GPC['status'])) {
        $status = intval($_GPC['status']);
コード例 #7
0
ファイル: mass.ctrl.php プロジェクト: zhang19960118/html11
     $mass_old[$time_key] = array('msgtype' => 'news', 'group' => -1, 'time' => $time_key, 'status' => 1, 'clock' => '20:00', 'media' => array('items' => array(array('title' => '请选择素材'))));
 }
 $mass_new = array();
 if (!empty($record)) {
     foreach ($record as &$li) {
         $time_key = date('Y-m-d', $li['sendtime']);
         $li['time'] = $time_key;
         $li['clock'] = date('H:i', $li['sendtime']);
         $li['media'] = pdo_get('wechat_attachment', array('id' => $li['attach_id']));
         $li['media']['attach'] = tomedia($li['media']['attachment']);
         if ($li['msgtype'] == 'video') {
             $li['media']['attach']['tag'] = iunserializer($li['media']['tag']);
         } elseif ($li['msgtype'] == 'news') {
             $li['media']['items'] = pdo_getall('wechat_news', array('attach_id' => $li['attach_id']));
             foreach ($li['media']['items'] as &$row) {
                 $row['thumb'] = media2local($row['thumb_media_id']);
             }
         } elseif ($li['msgtype'] == 'wxcard') {
             $li['media'] = pdo_get('coupon', array('id' => $li['attach_id']));
             $li['media']['media_id'] = $li['media']['card_id'];
             $li['media']['logo_url'] = url('utility/wxcode/image', array('attach' => $li['media']['logo_url']));
             $li['media']['type'] = 'wxcard';
         }
         $li['media']['createtime_cn'] = date('Y-m-d H:i', $li['media']['createtime']);
         $li['media_id'] = $li['media']['media_id'];
         $mass_new[$time_key] = $li;
     }
     unset($record);
 }
 $mass = array_values(array_merge($mass_old, $mass_new));
 template('material/mass');
コード例 #8
0
    $psize = 10;
    if ($type == 'image') {
        $psize = 50;
    }
    $limit = " ORDER BY createtime DESC LIMIT " . ($pindex - 1) * $psize . ", {$psize}";
    $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('wechat_attachment') . $condition, $params);
    $lists = pdo_fetchall('SELECT * FROM ' . tablename('wechat_attachment') . $condition . $limit, $params, 'id');
    if (!empty($lists)) {
        foreach ($lists as &$row) {
            if ($type == 'video') {
                $row['tag'] = iunserializer($row['tag']);
                $row['attach'] = tomedia($row['attachment'], true);
            } elseif ($type == 'news') {
                $row['items'] = pdo_getall('wechat_news', array('uniacid' => $_W['uniacid'], 'attach_id' => $row['id']));
                if (!empty($row['items'])) {
                    foreach ($row['items'] as &$li) {
                        $li['thumb'] = media2local($li['thumb_media_id']);
                    }
                }
            } elseif ($type == 'image') {
                $row['attach'] = tomedia($row['attachment'], true);
                $row['url'] = "url({$row['attach']})";
            } elseif ($type == 'voice') {
                $row['attach'] = tomedia($row['attachment'], true);
            }
            $row['createtime_cn'] = date('Y-m-d H:i', $row['createtime']);
        }
    }
    $result = array('items' => $lists, 'pager' => pagination($total, $pindex, $psize, '', array('before' => '2', 'after' => '3', 'ajaxcallback' => 'null')));
    message($result, '', 'ajax');
}