|
|
|
@ -124,7 +124,16 @@ class MiniprogramService implements MiniprogramServiceInterface |
|
|
|
'remark' => '感谢您的使用!' |
|
|
|
]; |
|
|
|
|
|
|
|
$ret_store = $this->sendTempMsg($store['openid'], 'lxVbC6PVpKbiO44bYqLmacl-BaME70D47Q0jn2Link0',$data_store); |
|
|
|
// $ret_store = $this->sendTempMsg($store['openid'], 'lxVbC6PVpKbiO44bYqLmacl-BaME70D47Q0jn2Link0',$data_store);
|
|
|
|
$ret_store = $this->sendTempMsg( |
|
|
|
$store['openid'], |
|
|
|
'b9SR_3j6GhJvVjuIoYlil4-m09plcjNnI5lls1wHfpo', |
|
|
|
$data_store, |
|
|
|
true, |
|
|
|
'/pages/orderDetail/orderDetail?global_order_id='.$globalOrderId, |
|
|
|
'1461', |
|
|
|
$item['money'] |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
@ -152,7 +161,7 @@ class MiniprogramService implements MiniprogramServiceInterface |
|
|
|
/** |
|
|
|
* @inheritDoc |
|
|
|
*/ |
|
|
|
public function sendTempMsg($openid, $template_id, $data, $redirect_url = '', $applet_config = ['appid' => '', 'pagepath' => '']) |
|
|
|
public function sendTempMsg($openid, $template_id, $data, $isApplet = false, $redirect_url = '', $appletFormId = '', $appletEmKeyword = '', $applet_config = ['appid' => '', 'pagepath' => '']) |
|
|
|
{ |
|
|
|
if (empty($openid) || empty($template_id) || empty($data)) { |
|
|
|
return ; |
|
|
|
@ -168,6 +177,15 @@ class MiniprogramService implements MiniprogramServiceInterface |
|
|
|
] |
|
|
|
]; |
|
|
|
|
|
|
|
if ($isApplet) { |
|
|
|
$template['weapp_template_msg'] = [ |
|
|
|
'template_id' => $template_id, |
|
|
|
'page' => $redirect_url, |
|
|
|
'form_id' => $appletFormId, |
|
|
|
'emphasis_keyword' => $appletEmKeyword, |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
// 看看有没有小程序跳转的要求
|
|
|
|
$template['mp_template_msg']['miniprogram'] = $applet_config; |
|
|
|
|
|
|
|
@ -176,32 +194,47 @@ class MiniprogramService implements MiniprogramServiceInterface |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if (is_array($data['first'])) { |
|
|
|
$template['mp_template_msg']['data']['first']['value'] = $data['first'][0] ?? ''; |
|
|
|
$template['mp_template_msg']['data']['first']['color'] = $data['first'][1] ?? ''; |
|
|
|
} else { |
|
|
|
$template['mp_template_msg']['data']['first']['value'] = $data['first']; |
|
|
|
} |
|
|
|
if ( !$isApplet ) { |
|
|
|
if (is_array($data['first'])) { |
|
|
|
$template['mp_template_msg']['data']['first']['value'] = $data['first'][0] ?? ''; |
|
|
|
$template['mp_template_msg']['data']['first']['color'] = $data['first'][1] ?? ''; |
|
|
|
} else { |
|
|
|
$template['mp_template_msg']['data']['first']['value'] = $data['first']; |
|
|
|
} |
|
|
|
|
|
|
|
if (isset($data['keyword'])&&is_array($data['keyword'])) { |
|
|
|
foreach ($data['keyword'] as $key => &$keyword) { |
|
|
|
$index = $key+1; |
|
|
|
if (isset($data['keyword'])&&is_array($data['keyword'])) { |
|
|
|
foreach ($data['keyword'] as $key => &$keyword) { |
|
|
|
$index = $key+1; |
|
|
|
|
|
|
|
if (is_array($keyword)) { |
|
|
|
$template['mp_template_msg']['data']['keyword'.$index]['value'] = $keyword[0] ?? ''; |
|
|
|
$template['mp_template_msg']['data']['keyword'.$index]['color'] = $keyword[1] ?? ''; |
|
|
|
} else { |
|
|
|
$template['mp_template_msg']['data']['keyword'.$index]['value'] = $keyword; |
|
|
|
} |
|
|
|
if (is_array($keyword)) { |
|
|
|
$template['mp_template_msg']['data']['keyword'.$index]['value'] = $keyword[0] ?? ''; |
|
|
|
$template['mp_template_msg']['data']['keyword'.$index]['color'] = $keyword[1] ?? ''; |
|
|
|
} else { |
|
|
|
$template['mp_template_msg']['data']['keyword'.$index]['value'] = $keyword; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (is_array($data['remark'])) { |
|
|
|
$template['mp_template_msg']['data']['remark']['value'] = $data['remark'][0] ?? ''; |
|
|
|
$template['mp_template_msg']['data']['remark']['color'] = $data['remark'][1] ?? ''; |
|
|
|
if (is_array($data['remark'])) { |
|
|
|
$template['mp_template_msg']['data']['remark']['value'] = $data['remark'][0] ?? ''; |
|
|
|
$template['mp_template_msg']['data']['remark']['color'] = $data['remark'][1] ?? ''; |
|
|
|
} else { |
|
|
|
$template['mp_template_msg']['data']['remark']['value'] = $data['remark']; |
|
|
|
} |
|
|
|
} else { |
|
|
|
$template['mp_template_msg']['data']['remark']['value'] = $data['remark']; |
|
|
|
if (isset($data['keyword'])&&is_array($data['keyword'])) { |
|
|
|
foreach ($data['keyword'] as $key => &$keyword) { |
|
|
|
$index = $key+1; |
|
|
|
|
|
|
|
if (is_array($keyword)) { |
|
|
|
$template['weapp_template_msg']['data']['keyword'.$index]['value'] = $keyword[0] ?? ''; |
|
|
|
} else { |
|
|
|
$template['weapp_template_msg']['data']['keyword'.$index]['value'] = $keyword; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$app = Factory::miniProgram(config('wechat.applet')); |
|
|
|
|