本文整理汇总了PHP中Wechat::tplmsg方法的典型用法代码示例。如果您正苦于以下问题:PHP Wechat::tplmsg方法的具体用法?PHP Wechat::tplmsg怎么用?PHP Wechat::tplmsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wechat
的用法示例。
在下文中一共展示了Wechat::tplmsg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
function send()
{
$u = M("user")->where(array(id => intval($_REQUEST['id'])))->find();
import("@.ORG.Weixin");
$wechatObj = new Wechat();
$data = " {\r\n \"touser\":\"" . $u['wxpas'] . "\",\r\n \"template_id\":\"SCFdz1m9pGOO6U-LXp6qv8CUJakT3_Zk-74tjdnK0ok\",\r\n \"url\":\"http://weixin.qq.com/download\",\r\n \"topcolor\":\"#FF0000\",\r\n \"data\":{\r\n \"first\": {\r\n \"value\":\"恭喜你购买成功!\",\r\n \"color\":\"#173177\"\r\n },\r\n \"keyword1\":{\r\n \"value\":\"" . $u['realname'] . "\",\r\n \"color\":\"#173177\"\r\n },\r\n \"keynote2\": {\r\n \"value\":\"" . $u['id'] . "产品名称\",\r\n \"color\":\"#173177\"\r\n },\r\n \"keynote3\": {\r\n \"value\":\"" . $u['id'] . "\",\r\n \"color\":\"#173177\"\r\n },\r\n \"remark\":{\r\n \"value\":\"此订单信息请点击这里查看!!\",\r\n \"color\":\"#173177\"\r\n }\r\n }\r\n }";
echo $wechatObj->tplmsg($data);
}
示例2: alarm
function alarm($id, $type)
{
//$id=$_REQUEST["id"];
// $type=$_REQUEST["type"];
if ($id > 0) {
$order = M($type . "order")->where("id=" . $id)->find();
if (empty($order)) {
$this->error("没有这个订单");
}
if (!empty($type)) {
$time = $order["fday"] . "日" . $order["foundtime"];
$addr = "广州长湴地铁口A出口";
} else {
$type = "";
$time = date("y-d-m H", $order['godate']);
$addr = "无";
}
if ($order['userid'] > 0) {
$u = M("user")->field("wxpas,id")->where("id=" . $order['userid'])->find();
}
if ($u["wxpas"] && $order['wxmsg'] < 2) {
import("@.ORG.Weixin");
$wechatObj = new Wechat();
$data = "{\r\n\t\t\t\t\t\t \"touser\":\"" . $u['wxpas'] . "\",\r\n\t\t\t\t\t\t \"template_id\":\"ucvAFM1zXILGaaovdwyy-VyMAfq7Ny9bFDrOBG5fuxc\",\r\n\t\t\t\t\t\t \"url\":\"http://www.gzsrex.com" . U('Api/Pay/wxpay', array('oid' => $order["id"], 'type' => $type)) . "\",\r\n\t\t\t\t\t\t \"topcolor\":\"#003cff\",\r\n\t\t\t\t\t\t \"data\":{\r\n\t\t\t\t\t\t\t\t \"first\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"恭喜你预订成功\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword1\":{\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order["id"] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword2\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order["title"] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword3\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $time . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword4\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $addr . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t\t\"keyword5\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order['amount'] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\t\t \r\n\t\t\t\t\t\t\t\t \"remark\":{\r\n\t\t\t\t\t\t\t\t\t \"value\":\"价格:" . $order['amount'] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }";
/*{{first.DATA}}
订单号:{{keyword1.DATA}}
项目:{{keyword2.DATA}}
时间:{{keyword3.DATA}}
地址:{{keyword4.DATA}}
总价:{{keyword5.DATA}}
{{remark.DATA}}*/
$json = $wechatObj->tplmsg($data);
$result = json_decode($json, true);
if ($result["errmsg"] == 'ok') {
return true;
//$this->success("催款成功");
} else {
return false;
//$this->success("催款失败");
}
} else {
return false;
//$this->success("非微信用户不能催单!");
}
}
}
示例3: import
function send_notice($data)
{
//wx:微信openid
//wx
if ($data["wx"]) {
import("@.ORG.Weixin");
$wechatObj = new Wechat();
$data = "{\r\n\t\t\t\t\t\t \"touser\":\"" . $data['wx'] . "\",\r\n\t\t\t\t\t\t \"template_id\":\"4QHv1Wt_mUuS5tlxkjAIABQOfWVhSJoxeHEdj7kNb4o\",\r\n\t\t\t\t\t\t \"url\":\"" . $this->Config['site_url'] . "" . U('Home/Product/chose', array('id' => $data["id"])) . "\",\r\n\t\t\t\t\t\t \"topcolor\":\"#003cff\",\r\n\t\t\t\t\t\t \"data\":{\r\n\t\t\t\t\t\t\t\t \"first\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"预约试驾成功通知!\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword1\":{\r\n\t\t\t\t\t\t\t\t\t \"value\":\"试驾:" . $data['title'] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword2\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"初步通知!\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"remark\":{\r\n\t\t\t\t\t\t\t\t\t \"value\":\"预约时间:" . $data['time'] . ",我们会尽快安排专员与您联系!\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }";
/*
{{first.DATA}}
任务名称:{{keyword1.DATA}}
通知类型:{{keyword2.DATA}}
{{remark.DATA}}*/
echo $wechatObj->tplmsg($data);
return true;
} else {
return false;
}
}