12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace refill\lihui_fs;
- require_once(BASE_HELPER_RAPI_PATH . '/lihui_fs/config.php');
- use refill;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- $sign = $this->sign($params);
- if ($params['szVerifyString'] == $sign) {
- return true;
- } else {
- return false;
- }
- }
- private function sign($params)
- {
- $userid = config::USER_ID;
- $key = config::KEY;
- $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nDemo={$params['nDemo']}&fSalePrice={$params['fSalePrice']}";
- $content .= "&nFlag={$params['nFlag']}&szKey={$key}";
- return md5($content);
- }
- public function notify($params)
- {
- $status = intval($params['nFlag']);
- $order_sn = $params['szOrderId'];
- $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
- if (empty($order_info)) {
- return [false, false, false, false, ''];
- }
- $order_id = $order_info['order_id'];
- if ($status === 2) {
- $official_sn = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
- $data['official_sn'] = $official_sn;
- Model('refill_order')->edit($order_id, $data);
- return [$order_id, true, false, true, $official_sn];
- }
- elseif ($status === 3) {
- return [$order_id, false, true, true, ''];
- }
- else {
- return [$order_id, false, false, false, ''];
- }
- }
- }
|