12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace refill\weishengy;
- require_once(BASE_HELPER_RAPI_PATH . '/weishengy/config.php');
- use refill;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- $sign = $this->sign($params);
- if ($params['sign'] == $sign) {
- return true;
- } else {
- return false;
- }
- }
- private function sign($params)
- {
- $masId = config::masId;
- $content = "masId={$masId}&oids={$params['oids']}&orderNo={$params['orderNo']}&orderPrice={$params['orderPrice']}&phone={$params['phone']}";
- $content .= "&status={$params['status']}&time={$params['time']}&type={$params['type']}";
- return strtoupper(md5($content));
- }
- public function notify($params)
- {
- $status = $params['status'];
- $order_sn = $params['orderNo'];
- $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'];
- if ($status == 1) {
- $data['official_sn'] = strtolower($params['oids']) == 'null' ? '' : $params['oids'];
- Model('refill_order')->edit($order_id, $data);
- return [$order_id, true, false,true];
- }
- // elseif ($status == 2) {
- // return [$order_id, false, false,true];
- // }
- else {
- return [$order_id, false, false,false];
- }
- }
- }
|