$v) { $tpl = str_replace($k, $v, $tpl); } $result = Http::httpPost(self::SEND_SUBSCRIBE_URL.'?access_token=' .$accessToken, $tpl); if (empty($result)) { $data = json_decode($result, true); return $data; } else { return null; } } /** * @param $tplId * @return string */ static function getTpl($tplId) { if (self::NORMAL_ORDER == $tplId) { return self::normalOrderTpl(); } elseif (self::REFUND_ORDER == $tplId) { return self::refundTpl(); } return null; } /** * @return string */ static function normalOrderTpl() { $tpl = '{ "touser": "{touser}", "template_id": "{template_id}", "page": "{page}", "data": { "phrase3": { "value": "{phrase3}" }, "character_string2": { "value":"{character_string2}" }, "thing1": { "value": "{thing1}" }, "amount4": { "value": "{amount4}" }, "phrase7": { "value": "{phrase7}" } } }'; return $tpl; } /** * @return string */ static function refundTpl() { $tpl = '{ "touser": "{touser}", "template_id": "{template_id}", "page": "{page}", "data": { "character_string1": { "value": "{character_string1}" }, "thing8": { "value":"{thing8}" }, "amount5": { "value": "{amount5}" }, "date2": { "value": "{date2}" } } }'; return $tpl; } }