index.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {buildProtoReq50, parseProtoRsp50} from "@/services/socket/protobuf/buildReq";
  2. import APP from "@/services";
  3. import {Callback} from "@/utils/websocket";
  4. import {DeliveryGoodsApplyReq} from "@/services/proto/delivery/interface";
  5. /**
  6. * 现货品种申请请求
  7. * @param param DeliveryGoodsApplyReq
  8. */
  9. export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any> => {
  10. return new Promise((resolve, reject) => {
  11. const req = {
  12. version: "3.2",
  13. };
  14. const params = {
  15. protobufName: 'DeliveryGoodsApplyReq',
  16. funCodeName: 'DeliveryGoodsApplyReq',
  17. reqParams: Object.assign(req, param),
  18. msgHeadParams: {
  19. AccountID: param.accountid,
  20. MarketID: 18,
  21. GoodsID: 0,
  22. }
  23. };
  24. const package50 = buildProtoReq50(params);
  25. APP.sendTradingServer(package50, undefined, {
  26. onSuccess: (res) => {
  27. const { isSuccess, result } = parseProtoRsp50(res, 'DelUserReceiveInfoRsp');
  28. if (isSuccess) {
  29. resolve(result);
  30. } else {
  31. reject(result);
  32. }
  33. },
  34. onFail: (err) => reject(err.message),
  35. } as Callback);
  36. });
  37. }