1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace refill\jc;
- require_once(BASE_HELPER_PATH . '/refill/jc/config.php');
- use refill;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- $sign = $this->sign($params);
- if ($params['sgn'] == $sign) {
- return true;
- } else {
- return false;
- }
- }
- private function sign($params)
- {
- $content = $params['result'] . $params['msg'] . $params['order_no'] . $params['phone_no'] . $params['amount'] . $params['op_no'] . config::APP_SECRET;
- return md5($content);
- }
- public function notify($params)
- {
- $status = intval($params['result']);
- $order_sn = $params['op_no'];
- $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
- if (empty($order_info)) {
- return [false, false, false,false];
- }
- $order_id = $order_info['order_id'];
- $data['official_sn'] = $params['order'];
- Model('refill_order')->edit($order_id, $data);
- if ($status === 'success') {
- return [$order_id, true, false,true];
- } elseif ($status === 'fail') {
- return [$order_id, false, true,true];
- }
- }
- }
|