Пример #1
0
 private function sendOneMsg($item)
 {
     $ecid_cache = 'company_info' . $item['ecid'];
     if (!($companyInfo = S($ecid_cache))) {
         $companyInfo = $this->getCompanyInfo($item['ecid']);
     }
     if (!$companyInfo) {
         return false;
     }
     $options = array('token' => 'tokenaccesskey', 'appid' => $companyInfo['weixin_AppId'], 'appsecret' => $companyInfo['weixin_AppSecret']);
     $weObj = new Wechat($options);
     $msg = json_decode($item['content'], true);
     switch ($item['type']) {
         case '':
         case 'custom':
             if ($weObj->sendCustomMessage($msg)) {
                 $item['sendTime'] = date('Y-m-d H:i:s');
             }
             break;
         case 'templete':
             if ($weObj->sendTemplateMessage($msg)) {
                 $item['sendTime'] = date('Y-m-d H:i:s');
             }
             break;
         default:
             break;
     }
     $item['times']++;
     $m = M('Send_crontab');
     return $m->save($item);
 }
Пример #2
0
 private function sendOrderMsg($payQrcodeId, $openid, $logId)
 {
     $m = M('Company_pay_qrcode');
     $result = $m->find($payQrcodeId);
     $title = "您好,你的订单【{$result['name']}】已成功支付,请到工作人员处领取。";
     $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' => $openid, 'template_id' => '9vrZ54E2usz08SVYjManqdUlHlI--x3eMqWdXKBMwpI', 'url' => "http://www.icalex.com/Mobile/Exchange/payQrcode/openid/{$openid}/id/{$logId}", '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' => $result['price'] . '元', "color" => "#173177"), 'keyword3' => array('value' => '', "color" => "#173177"), 'keyword4' => array('value' => '', "color" => "#173177"), 'remark' => array('value' => "如有疑问,请拨打客服电话4009908355或在微信留言。!", "color" => "#173177")));
     $wechat = new \Org\Weixin\Wechat($options);
     $wechat->sendTemplateMessage($data);
 }
Пример #3
0
 private function sendMessage($option)
 {
     $options = array('appid' => 'wx043fe26d7171dc76', 'appsecret' => '9075a78a413ea5f12999e0fddcc2a60c');
     $data = array('touser' => $option['openId'], 'template_id' => 'MH6Vd2GxT_qG2VHhAduBMSDb-JNTp_GxkefrGt36-Wc', 'url' => "", 'topcolor' => '#000000', 'data' => array('first' => array('value' => "恭喜您成功获得 蒂罗尔微信商城{$option['ticket']}元代金券 一张。", "color" => "#173177"), 'keyword1' => array('value' => '代金券', "color" => "#173177"), 'keyword2' => array('value' => $option['exchangeCode'], "color" => "#173177"), 'keyword3' => array('value' => '2015-06-14', "color" => "#173177"), 'keyword4' => array('value' => '2015-08-14', "color" => "#173177"), 'remark' => array('value' => "", "color" => "#173177")));
     $wechat = new \Org\Weixin\Wechat($options);
     $wechat->sendTemplateMessage($data);
 }