1 go applet platform, select an existing template or apply a custom template, there will be a template number
function temMsg public (the Request Request $) {
// order status. 1 2 3 Content Order Order No. 4 contact name
$ Data = $ request-> param ();
$ :: Field name = Db ( 'Order') -> WHERE ( 'id', $ data [ 'zjid']) -> find ();
Field n_type = $ $ // [ 'name_type'];
$ Field key1 = $ [ 'Nickname'] ?? 'Anonymous';
$ Field key2 = $ [ 'order_num'];
$ key3 = str_replace ( ',', " \ n-", $ Field [ 'Content']);
// $ $ = KEY4 Field [" Avatar "];
$ FormID Data = $ [ 'FormID'];
$ TEmID = ''; // template message number
$openid = Db::name('member')->where('id',$data['uid'])->value('wxopenid');
$access_token = $this->returnAssKey();
$url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token='.$access_token;
$data = array(
"touser"=>$openid,
"template_id"=>$temid,
// "page"=>$page,
"form_id"=>$formid,
"data"=>array(
"keyword1"=>array(
"value"=>$key1,
"color"=>"#173177"
),
"keyword2"=>array(
"value"=>$key2,
"color"=>"#173177"
),
"keyword3"=>array(
"value "=> $ key3, //" emphasis_keyword "=>" keyword1.DATA ", // a message needs to be increased ), )
" Color "=>" # 173 177 "
);
$ RES = $ this-> postCurl (URL $, $ data, 'json'); // data array to convert data json
? return $ res json ([ ' status' => 1, 'data' => $ res, 'msg' => ' success']): json ([ ' status' => 0, 'data' => '' , 'msg' => 'failed']);
}