diff --git a/Application/Base/Tool/GameResource/YjzxClient.class.php b/Application/Base/Tool/GameResource/YjzxClient.class.php index 648d58351..f2e3e4d01 100644 --- a/Application/Base/Tool/GameResource/YjzxClient.class.php +++ b/Application/Base/Tool/GameResource/YjzxClient.class.php @@ -106,18 +106,6 @@ class YjzxClient $params['time'] . static::SIGN_KEY ); - } elseif ($name == 'send-props') { - $signStr = ''; - ksort($params); - foreach ($params as $key => $value) { - if ($key == 'prop') { - $value = json_encode($value); - } - $signStr .= $key . '='. trim(urlencode($value)) . '&'; - } - $signStr .= 'key=' . static::SIGN_KEY; - $signStr = md5($signStr); - return $signStr; } else { return ''; } @@ -173,6 +161,39 @@ class YjzxClient } } + public function sendProps($order) + { + $result = $this->api('send-gold', [ + 'role_id' => $order['role_id'], + 'amount' => $order['amount'], + 'serverid' => $order['server_id'], + 'uid' => $order['user_id'], + 'orderid' => $this->generateOrderNumber($order), + 'rebate' => $order['times'], + ]); + + if ($result['code'] == 1) { + return [ + 'status' => true, + 'message' => $result['msg'], + 'result' => $result + ]; + } else { + return [ + 'status' => false, + 'message' => $result['msg'], + 'result' => $result ?? [] + ]; + } + } + + protected function generateOrderNumber($order, $index = 0) + { + $length = 8 - strlen(strval($order['id'])); + $indexLength = 3 - strlen(strval($index)); + return date('Ymd') . str_repeat('0', $length) . $order['id'] . str_repeat('0', $indexLength) . $index; + } + public function sendEmail($giftItem, $order) { $result = $this->api('send-email', [