Esempio n. 1
0
 public function sendCustomMsg()
 {
     $companyInfo = $this->getCompanyInfo();
     $options = array('appid' => $companyInfo['weixin_AppId'], 'appsecret' => $companyInfo['weixin_AppSecret'], 'partnerid' => $companyInfo['weixin_PartnerID'], 'partnerkey' => $companyInfo['weixin_PartnerKey'], 'paysignkey' => $companyInfo['weixin_PaySignKey']);
     $data = array('touser' => 'ooKmYt8VGB2V3l3ZXolpFbTukE58', 'template_id' => '9vrZ54E2usz08SVYjManqdUlHlI--x3eMqWdXKBMwpI', 'url' => 'http://www.icalex.com', 'topcolor' => '#000000', 'data' => array('first' => array('value' => "您好,你的订单已成功提交", "color" => "#173177"), 'keyword1' => array('value' => "2015-01-06 12:12:11", "color" => "#173177"), 'keyword2' => array('value' => '158元', "color" => "#173177"), 'keyword3' => array('value' => '香草口味*8', "color" => "#173177"), 'keyword4' => array('value' => 'XX街XX小区XX楼XX室', "color" => "#173177"), 'remark' => array('value' => "你的订单已成功支付,如有疑问,请拨打客服电话!", "color" => "#173177")));
     $wechat = new \Org\Weixin\Wechat($options);
     dump($wechat->sendTemplateMessage($data));
 }
 private function sendOrderMsg($orderInfo)
 {
     $userInfo = session('userInfo');
     $goods = unserialize($orderInfo['goods']);
     for ($i = 0; $i < count($goods); $i++) {
         if ($i > 0) {
             $goodsText .= ',';
         }
         $goodsText .= $goods[$i]['name'] . '*' . $goods[$i]['num'];
     }
     $address = unserialize($orderInfo['address']);
     if ($orderInfo['sign'] == 1) {
         $title = "您好,你的订单【{$orderInfo['orderNo']}】已成功提交,我们将尽快处理。";
     } else {
         $title = "您好,你的订单【{$orderInfo['orderNo']}】已成功提交,我们将尽快处理。";
     }
     if ($userInfo) {
         $companyInfo = $this->getCompanyInfo();
         $options = array('appid' => $companyInfo['weixin_AppId'], 'appsecret' => $companyInfo['weixin_AppSecret'], 'partnerid' => $companyInfo['weixin_PartnerID'], 'partnerkey' => $companyInfo['weixin_PartnerKey'], 'paysignkey' => $companyInfo['weixin_PaySignKey']);
         $data = array('touser' => $userInfo['openId'], 'template_id' => 'ffjlR69y7HeuQj1JsuGbZGDfNCOACC9q1LglPHLfduc', 'url' => '', 'topcolor' => '#000000', 'data' => array('first' => array('value' => $title, "color" => "#173177"), 'keyword1' => array('value' => date('Y-m-d H:i:s'), "color" => "#173177"), 'keyword2' => array('value' => $orderInfo['payPrice'] . '元', "color" => "#173177"), 'keyword3' => array('value' => $goodsText, "color" => "#173177"), 'keyword4' => array('value' => $address['tel'], "color" => "#173177"), 'keyword5' => array('value' => $address['address'], "color" => "#173177"), 'remark' => array('value' => "请确认收件人电话、地址是否正确,如有疑问请拨打客服电话4009908355或添加微信客服icalexsz。", "color" => "#173177")));
         $wechat = new \Org\Weixin\Wechat($options);
         $wechat->sendTemplateMessage($data);
     }
 }
Esempio n. 3
0
 private function sendCustomMsg($id)
 {
     $m = M('Company_order');
     $orderInfo = $m->find($id);
     $userInfo = $this->getUserInfo($orderInfo['uId']);
     $goods = unserialize($orderInfo['goods']);
     $sendUser = json_decode($orderInfo['allocationInfo'], true);
     for ($i = 0; $i < count($goods); $i++) {
         if ($i > 0) {
             $goodsText .= ',';
         }
         $goodsText .= $goods[$i]['name'] . '*' . $goods[$i]['num'];
     }
     $address = unserialize($orderInfo['address']);
     $title = "您好,你的订单【{$orderInfo['orderNo']}】已配送,请注意查收。";
     if ($userInfo) {
         $companyInfo = $this->getCompanyInfo();
         $options = array('appid' => $companyInfo['weixin_AppId'], 'appsecret' => $companyInfo['weixin_AppSecret'], 'partnerid' => $companyInfo['weixin_PartnerID'], 'partnerkey' => $companyInfo['weixin_PartnerKey'], 'paysignkey' => $companyInfo['weixin_PaySignKey']);
         $sendMsg = "配送人员:{$sendUser['name']};联系电话:{$sendUser['tel']}";
         $data = array('touser' => $userInfo['openId'], 'template_id' => 'vjn3tEx2CteT39U5fylZd4oZGr3y606bcm-q_HS02iY', 'url' => 'http://www.icalex.com', 'topcolor' => '#000000', 'data' => array('first' => array('value' => $title, "color" => "#173177"), 'keyword1' => array('value' => $orderInfo['orderNo'], "color" => "#173177"), 'keyword2' => array('value' => $orderInfo['addTime'], "color" => "#173177"), 'keyword3' => array('value' => $orderInfo['payPrice'] . '元', "color" => "#173177"), 'keyword4' => array('value' => $address['name'], "color" => "#173177"), 'keyword5' => array('value' => $address['address'], "color" => "#173177"), 'remark' => array('value' => $sendMsg, "color" => "#173177")));
         $wechat = new \Org\Weixin\Wechat($options);
         $wechat->sendTemplateMessage($data);
     }
 }