|
|
@@ -3,6 +3,8 @@ package com.ljsd.controller;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.ljsd.channel.Mock361YXSDK;
|
|
|
import com.ljsd.channel.MockQuickSDK;
|
|
|
+import com.ljsd.jieling.thrift.idl.RechargeResult;
|
|
|
+import com.ljsd.jieling.thrift.idl.Result;
|
|
|
import com.ljsd.jieling.thrift.pool.ThriftClient;
|
|
|
import com.ljsd.pojo.ResMsg;
|
|
|
import com.ljsd.redis.RedisKey;
|
|
|
@@ -69,9 +71,26 @@ public class PayCallbackController extends HttpServlet {
|
|
|
payInfo = MockQuickSDK.saveDB(nt_data);
|
|
|
}
|
|
|
} else if (!StringUtils.checkIsEmpty(request.getParameter("app_id"))) {
|
|
|
- ok = Mock361YXSDK.verifyCallback(request);
|
|
|
+ String appId = request.getParameter("app_id");
|
|
|
+ String cpOrderId = request.getParameter("cp_order_id");
|
|
|
+ String orderAmount = request.getParameter("order_amount");
|
|
|
+ String orderId = request.getParameter("order_id");
|
|
|
+ String roleId = request.getParameter("role_id");
|
|
|
+ String serverId = request.getParameter("server_id");
|
|
|
+ String timestamp = request.getParameter("timestamp");
|
|
|
+ String uid = request.getParameter("uid");
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("app_id",appId);
|
|
|
+ params.put("cp_order_id",cpOrderId);
|
|
|
+ params.put("order_amount",orderAmount);
|
|
|
+ params.put("order_id", orderId);
|
|
|
+ params.put("role_id", roleId);
|
|
|
+ params.put("server_id", serverId);
|
|
|
+ params.put("timestamp", timestamp);
|
|
|
+ params.put("uid", uid);
|
|
|
+ ok = Mock361YXSDK.verifyCallback(params, sign);
|
|
|
if (ok) {
|
|
|
- payInfo = Mock361YXSDK.saveDB(request);
|
|
|
+ payInfo = Mock361YXSDK.saveDB(params);
|
|
|
}
|
|
|
} else {
|
|
|
resMsg.setMsg("不支持该渠道");
|
|
|
@@ -101,31 +120,31 @@ public class PayCallbackController extends HttpServlet {
|
|
|
|
|
|
// todo 通知发货
|
|
|
// todo 各区服分配端口
|
|
|
-// ThriftClient.deliveryRecharge()
|
|
|
-
|
|
|
LOGGER.info("通知发货, payInfo = {}", payInfo);
|
|
|
- URIBuilder uriBuilder = new URIBuilder("http://127.0.0.1:7915/deliveryRecharge");
|
|
|
- uriBuilder.addParameter("uid", (String) payInfo.get("uid"));
|
|
|
- uriBuilder.addParameter("goodsId", (String) payInfo.get("pay_item"));
|
|
|
- uriBuilder.addParameter("openId", (String) payInfo.get("open_id"));
|
|
|
- uriBuilder.addParameter("orderId", (String) payInfo.get("cporderId"));
|
|
|
- uriBuilder.addParameter("orderTime", (String) payInfo.get("creattime"));
|
|
|
- uriBuilder.addParameter("amount", String.valueOf((int) payInfo.get("money")));
|
|
|
+ Result result = ThriftClient.deliveryRecharge((int) payInfo.get("uid"), (String) payInfo.get("pay_item"), (String) payInfo.get("open_id"),
|
|
|
+ (String) payInfo.get("billno"), Long.parseLong((String) payInfo.get("creattime")), (int) payInfo.get("money"));
|
|
|
|
|
|
- HttpGet httpGet = new HttpGet(uriBuilder.build().toString());
|
|
|
- CloseableHttpResponse resp = httpClient.execute(httpGet);
|
|
|
+// URIBuilder uriBuilder = new URIBuilder("http://127.0.0.1:7915/deliveryRecharge");
|
|
|
+// uriBuilder.addParameter("uid", (String) payInfo.get("uid"));
|
|
|
+// uriBuilder.addParameter("goodsId", (String) payInfo.get("pay_item"));
|
|
|
+// uriBuilder.addParameter("openId", (String) payInfo.get("open_id"));
|
|
|
+// uriBuilder.addParameter("orderId", (String) payInfo.get("cporderId"));
|
|
|
+// uriBuilder.addParameter("orderTime", (String) payInfo.get("creattime"));
|
|
|
+// uriBuilder.addParameter("amount", String.valueOf((int) payInfo.get("money")));
|
|
|
+//
|
|
|
+// HttpGet httpGet = new HttpGet(uriBuilder.build().toString());
|
|
|
+// CloseableHttpResponse resp = httpClient.execute(httpGet);
|
|
|
|
|
|
- String result = EntityUtils.toString(resp.getEntity());
|
|
|
- LOGGER.info("通知发货结果:{}", result);
|
|
|
+// String result = EntityUtils.toString(resp.getEntity());
|
|
|
+ LOGGER.info("deliveryRecharge result = {}", result);
|
|
|
|
|
|
- resp.close();
|
|
|
- if (!result.equals("1")){
|
|
|
+// resp.close();
|
|
|
+ if (result == null || result.resultCode != 1) {
|
|
|
resMsg.setCode(1);
|
|
|
resMsg.setMsg("发货失败");
|
|
|
return;
|
|
|
}
|
|
|
- resMsg.setCode(0);
|
|
|
- out.print(gson.toJson(resMsg));
|
|
|
+ out.print("SUCCESS");
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|