| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import APP from "@/services";
- import { getSelectedAccountId, getUserId } from "@/services/bus/account";
- import { GldErmcpSpotContractOperateReq } from "@/services/proto/spotcontract/interface";
- import { buildProtoReq50, parseProtoRsp50 } from "@/services/socket/protobuf/buildReq";
- import { Callback } from "@/utils/websocket";
- import { v4 as uuidv4 } from 'uuid';
- /**(重点提醒 这里属于管理端接口,仅用于新增)以上来自android代码 回头需要确认
- * 新增 / 修改采购合同报文 (很多修改合同操作也在这)
- * @param
- * @param param
- */
- export const orderContract = (param: GldErmcpSpotContractOperateReq): Promise<any> => {
- const OperateSrc = 2; // uint32 操作来源-1:管理端2:终端
- const ClientTicket: string = uuidv4(); // 客户端流水号
- const UserID: number = getUserId(); // 用户id
- const reqParams = {
- ...param, OperateSrc, ClientTicket, UserID
- }
- return new Promise((resolve, reject) => {
- const params = {
- protobufName: 'GldErmcpSpotContractOperateReq',
- funCodeName: 'GldErmcpSpotContractOperateReq',
- reqParams: reqParams,
- msgHeadParams: {
- AccountID: getSelectedAccountId(),
- MarketID: 18,
- GoodsID: 0,
- }
- };
- const package50 = buildProtoReq50(params);
- APP.sendTradingServer(package50, undefined, {
- onSuccess: (res) => {
- const { isSuccess, result } = parseProtoRsp50(res, 'GldErmcpSpotContractOperateRsp');
- if (isSuccess) {
- resolve(result);
- } else {
- reject(result);
- }
- },
- onFail: (err) => reject(err.message),
- } as Callback);
- });
- }
|