Browse Source

proto 接口问题

yu.jie 4 years ago
parent
commit
8734701997

+ 128 - 0
public/proto/mtp.proto

@@ -1163,3 +1163,131 @@ message DeliveryGoodsCancelRsp {
     optional uint64 deliverygoodsid = 5; // uint64 现货品种ID
 }
 
+// 期货账户新增修改请求 0 29 146
+message HedgeOutMainConfigReq {
+    optional MessageHead Header = 1; // MessageHead
+    optional uint64 marketid = 2; // uint64 内部市场ID(HedgeOutMainConfig)
+    optional string hedgeaccountcode = 3; // string 对冲账号ID(HedgeOutMainConfig)
+    optional int32 connectflag = 4; // int32 是否联接外部交易 - 0:不连接 1:连接(HedgeOutMainConfig)
+    optional string hedgeaccountpwd = 5; // string 对冲账号密码(HedgeOutMainConfig)
+    optional string appid = 6; // string AppID(HedgeOutMainConfig)
+    optional string authcode = 7; // string 授权码(HedgeOutMainConfig)
+    optional uint64 limitnumber = 8; // uint64 挂单笔数限额默认0(HedgeOutMainConfig)
+    optional int32 status = 9; // int32 渠道账号状态 1-可买入可卖出 2-可卖出不可买入默认1(HedgeOutMainConfig)
+    optional string accountname = 10; // string 账户名称accountname1(Taaccount)
+    optional uint64 accountid = 11; // uint64 资金账户ID(Taaccount)
+    optional int32 taaccounttype = 12; // int32 账号类型 - 1:外部账号 2:内部账号 3:内部做市自营账号 4:内部做市接单账号(Taaccount)
+    optional int32 currencyid = 13; // int32 货币ID默认为1(Taaccount)
+    optional double outthreshold = 14; // double 出金阈值默认为0(Taaccount)
+    optional int32 ismain = 15; // int32 是否母账号 0:不是母账户 1:是母账户(Taaccount)
+    optional uint64 parentaccountid = 16; // uint64 所属根账号(Taaccount)
+    optional uint64 relateduserid = 17; // uint64 关联用户(Taaccount)
+    optional uint64 fromaccountid = 18; // uint64 所属上级账户(Taaccount)
+    optional uint64 trademargintmpid = 19; // uint64 保证金模板id(TAACCOUNTCONFIG)
+    optional uint64 tradefeetmpid = 20; // uint64 手续费模板ID(TAACCOUNTCONFIG)
+    optional uint64 maxsubaccouts = 21; // uint64 最大子账户数[最大99999][外部母账户用 默认0(TAACCOUNTCONFIG)
+    optional uint64 fcid = 22; // uint64 期货公司
+    optional uint64 creatorid = 23; // uint64 创建人
+    optional uint64 modifierid = 24; // uint64 修改人
+    optional uint64 areauserid = 25; // uint64 机构用户ID
+}
+// 期货账户新增修改响应 0 29 157
+message HedgeOutMainConfigRsp {
+    optional MessageHead Header = 1; // MessageHead 消息头
+    optional int32 RetCode = 2; // int32 返回码
+    optional string RetDesc = 3; // string 描述信息
+    optional uint64 accountid = 4; // uint64 资金账户ID(Taaccount)
+}
+// 期货账户注销 0 29 158
+message TaaccountOperateReq {
+    optional MessageHead Header = 1; // MessageHead
+    optional uint64 accountid = 2; // uint64 期货账户ID
+    optional uint32 tradestatus = 3; // uint32 7注销
+    optional uint64 modifierid = 4; // uint64 修改人
+    optional uint64 areauserid = 5; // uint64 机构用户ID
+}
+// 期货账户注销操作响应 0 29 159
+message TaaccountOperateRsp {
+    optional MessageHead Header = 1; // MessageHead 消息头
+    optional int32 RetCode = 2; // int32 返回码
+    optional string RetDesc = 3; // string 描述信息
+    optional uint64 accountid = 4; // uint64 期货账户ID
+}
+// 期货账户授信 0 29 160
+message TaaccountTransfersxmoneyReq {
+    optional MessageHead Header = 1; // MessageHead
+    optional uint64 accountid = 2; // uint64 期货账户ID
+    optional double sxmoney = 3; // double 授信金额正为加负为减
+    optional uint64 modifierid = 4; // uint64 修改人
+    optional uint64 areauserid = 5; // uint64 机构用户ID
+}
+// 期货账户授信操作响应 0 29 161
+message TaaccountTransfersxmoneyRsp {
+    optional MessageHead Header = 1; // MessageHead 消息头
+    optional int32 RetCode = 2; // int32 返回码
+    optional string RetDesc = 3; // string 描述信息
+    optional uint64 accountid = 4; // uint64 期货账户ID
+}
+
+// 机构菜单数据 0 29 152
+message MemberFuncMenu {
+    optional string resourcecode = 1; // string 菜单代码
+}
+// 期货账户分组商品 0 29 147
+message ErmcpBizGroupSpotGoods {
+    optional int32 BizType = 1; // int32 业务类型 - 1:套保 2:套利
+    optional uint64 DeliveryGoodsID = 2; // uint64 品种ID
+}
+// 期货账户分组账户 0 29 148
+message ErmcpBizGroupTAAccount {
+    optional uint64 AccountID = 1; // uint64 账户ID
+}
+// 登录账户操作请求 0 29 160
+message LoginaccountOperateReq {
+    optional MessageHead Header = 1; // MessageHead
+    optional uint32 operatetype = 2; // uint32 操作类型-1:新增 2:修改 3:新增管理员 4:修改管理员 5:锁定 6:解锁 7:注销 8:恢复 9:重置密码 10:新增登录帐号 11:停用用户 12:恢复用户 13:修改用户信息
+    optional uint64 userid = 3; // uint64 用户ID(新增成功接口返回的userid)
+    optional uint64 loginid = 4; // uint64 登录ID(新增成功接口返回的loginid)
+    optional uint64 areauserid = 5; // uint64 所属机构(当前登录userid 必填)
+    optional string logincode = 6; // string 登录账号
+    optional string accountname = 7; // string 账户名称
+    optional string password = 8; // string 登录密码(明文)
+    optional string mobile = 9; // string 手机号码(明文)
+    repeated uint64 roleids = 10; // uint64 账号角色
+    repeated LoginTaaccount logintaaccounts = 11; // LoginTaaccount 期货账户(勾选交易员必填)
+    optional uint64 modifierid = 12; // uint64 修改人ID(当前登录loginid 必填)
+}
+
+// 登录账户操作响应 0 29 156
+message LoginaccountOperateRsp {
+    optional MessageHead Header = 1; // MessageHead 消息头
+    optional int32 RetCode = 2; // int32 返回码
+    optional string RetDesc = 3; // string 描述信息
+    optional uint64 userid = 4; // uint64 用户ID
+    optional uint64 loginid = 5; // uint64 登录ID
+}
+// 期货账户数据 0 29 155
+message LoginTaaccount {
+    optional uint64 accountid = 1; // uint64 期货账户ID
+}
+// 期货账户设置请求 0 29 149
+message ErmcpBizGroupReq {
+    optional MessageHead Header = 1; // MessageHead
+    optional uint64 BizGroupID = 2; // uint64 分组ID(修改/删除必填)
+    optional int32 BizType = 3; // int32 业务类型 - 1:套保 2:套利
+    optional string Remark = 4; // string 新增/修改备注
+    optional int32 ApplySrc = 5; // int32 新增/修改来源 - 1:管理端 2:终端
+    optional uint64 ApplyId = 6; // uint64 新增/修改人
+    repeated ErmcpBizGroupSpotGoods SpotGoods = 7; // ErmcpBizGroupSpotGoods 期货账户分组商品
+    repeated ErmcpBizGroupTAAccount TAAccount = 8; // ErmcpBizGroupTAAccount 期货账户分组账户
+    optional int32 OptType = 9; // int32 操作类型 - 1:新增 2:修改 3:删除
+    optional uint64 AreaUserID = 10; // uint64 所属机构
+}
+// 期货账户设置响应 0 29 150
+message ErmcpBizGroupRsp {
+    optional MessageHead Header = 1; // MessageHead 消息头
+    optional int32 RetCode = 2; // int32 返回码
+    optional string RetDesc = 3; // string 描述信息
+    optional uint64 BizGroupID = 4; // uint64 分组ID
+}
+

+ 19 - 2
src/services/funcode/index.ts

@@ -114,6 +114,23 @@ export const funCode: Code = {
     ErmsMiddelGoodsEditReq: 1900677, // 套保品种修改请求
     ErmsMiddelGoodsEditRsp: 1900678, // 套保品种修改响应
 
-    //
-
+    // --------  账户操作相关接口 -----------
+    // 信息 - 账户管理 - 期货账户 - 新增/修改
+    HedgeOutMainConfigReq: 1900694,///      期货账户新增修改请求
+    HedgeOutMainConfigRsp: 1900695,///      期货账户新增修改响应
+    // 信息 - 账户管理 - 期货账户 - 设置
+    ErmcpBizGroupReq: 1900696,///          期货账户设置请求
+    ErmcpBizGroupRsp: 1900697,///          期货账户设置响应
+    // 信息 - 账户管理 - 期货账户 - 注销
+    TaaccountOperateReq: 1900700, ///      期货账户注销
+    TaaccountOperateRsp: 1900701, ///      期货账户注销操作响应
+    // 信息 - 账户管理 - 期货账户 - 授信
+    TaaccountTransfersxmoneyReq: 1900702,   /// 期货账户授信
+    TaaccountTransfersxmoneyRsp: 1900703,   /// 期货账户授信操作响应
+
+    ManagerRoleOperateReq: 1900698,///     角色设置操作请求
+    ManagerRoleOperateRsp: 1900699,///     角色设置操作响应
+
+    LoginaccountOperateReq: 1900704,   /// 登录账户操作请求
+    LoginaccountOperateRsp: 1900705,   /// 登录账户操作响应
 };

+ 2 - 28
src/services/proto/accountinfo/index.ts

@@ -1,36 +1,10 @@
-import APP from "@/services";
-import { getSelectedAccountId } from "@/services/bus/account";
 import { UserInfoCheckMangeReq, UserInfoCheckMangeRsp } from "@/services/proto/accountinfo/interface";
-import { buildProtoReq50, parseProtoRsp50 } from "@/services/socket/protobuf/buildReq";
-import { Callback } from "@/utils/websocket";
+import { protoMiddleware} from "@/services/socket/protobuf/buildReq";
 
 /**
  * 客户资料审核
  * @param param
  */
 export const userInfoCheck = (param: UserInfoCheckMangeReq): Promise<UserInfoCheckMangeRsp> => {
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'UserInfoCheckMangeReq',
-            funCodeName: 'UserInfoCheckMangeReq',
-            reqParams: param,
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'UserInfoCheckMangeRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<UserInfoCheckMangeReq>(param , 'UserInfoCheckMangeReq', 'UserInfoCheckMangeRsp', 2)
 }

+ 10 - 59
src/services/proto/contract/index.ts

@@ -1,44 +1,20 @@
 import APP from "@/services";
 import { getSelectedAccountId, getUserId } from "@/services/bus/account";
 import {ContractOperateApplyReq, ErmcpContractOperateApplyReq} from "@/services/proto/contract/interface";
-import { buildProtoReq50, parseProtoRsp50 } from "@/services/socket/protobuf/buildReq";
+import {buildProtoReq50, parseProtoRsp50, protoMiddleware} from "@/services/socket/protobuf/buildReq";
 import { getUUID } from "@/utils/qt/common";
 import { Callback } from "@/utils/websocket";
+import {DeliveryGoodsCancelReq} from "@/services/proto/delivery/interface";
 
 /**
  * 合同
  * @param param
  */
 export const operationContractReq = (param: ErmcpContractOperateApplyReq): Promise<any> => {
-
-    const OperateSrc = 2;
-    const UserID = getUserId()
-    const ClientTicket = getUUID()
-
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'ErmcpContractOperateApplyReq',
-            funCodeName: 'ErmcpContractOperateApplyReq',
-            reqParams: { OperateSrc, UserID, ClientTicket, ...param },
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'ErmcpContractOperateApplyRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message)
-        } as Callback);
-    });
+    param.OperateSrc = 2
+    param.UserID = getUserId()
+    param.ClientTicket = getUUID()
+    return protoMiddleware<ErmcpContractOperateApplyReq>(param , 'ErmcpContractOperateApplyReq', 'ErmcpContractOperateApplyRsp', 2)
 }
 
 /**
@@ -46,33 +22,8 @@ export const operationContractReq = (param: ErmcpContractOperateApplyReq): Promi
  * @param param 2、通过 3、拒绝 4、撤销
  */
 export const contractOperateApply = (param: ContractOperateApplyReq): Promise<any> => {
-
-    const ClientTicket = getUUID()
-    const OperateSrc = 2;
-    const UserID = getUserId()
-
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'ContractOperateApplyReq',
-            funCodeName: 'ContractOperateApplyReq',
-            reqParams: { OperateSrc, UserID, ClientTicket, ...param },
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'ContractOperateApplyRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message)
-        } as Callback);
-    });
+    param.OperateSrc = 2
+    param.UserID = getUserId()
+    param.ClientTicket = getUUID()
+    return protoMiddleware<ContractOperateApplyReq>(param , 'ContractOperateApplyReq', 'ContractOperateApplyRsp', 2)
 }

+ 9 - 0
src/services/proto/contract/interface.ts

@@ -4,6 +4,11 @@ export interface ErmcpContractOperateApplyReq {
     OperateType: number // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
     Remark?: string // string 备注
     Info: ErmcpContractOperateApplyInfo // ErmcpContractOperateApplyInfo 合同操作信息
+
+    OperateSrc?: number
+    UserID?: number
+    ClientTicket?: string
+
 }
 // 合同操作响应 0 29 171
 export interface ErmcpContractOperateApplyRsp {
@@ -29,6 +34,10 @@ export interface ContractOperateApplyReq {
     OperateType: number; // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
     Remark?: string; // string 备注
     Info?: ContractOperateApplyInfo; // ContractOperateApplyInfo 合同操作信息
+
+    OperateSrc?: number
+    UserID?: number
+    ClientTicket?: string
 }
 
 // 合同操作响应 0 18 9

+ 10 - 86
src/services/proto/delivery/index.ts

@@ -6,43 +6,21 @@ import {
     DeliveryGoodsCancelReq,
     ErmsMiddelGoodsEditReq
 } from "@/services/proto/delivery/interface";
-import { buildProtoReq50, parseProtoRsp50 } from "@/services/socket/protobuf/buildReq";
+import {buildProtoReq50, parseProtoRsp50, protoMiddleware} from "@/services/socket/protobuf/buildReq";
 import { Callback } from "@/utils/websocket";
+import {ErmcpHedgePlanReq} from "@/services/proto/hedgeplan/interface";
 
 /**
  * 现货品种申请请求
  * @param param DeliveryGoodsApplyReq
  */
 export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any> => {
-    return new Promise((resolve, reject) => {
-        const req = {
-            version: "3.2",
-            userid: getUserId(),
-            loginid: getLongTypeLoginID(),
-        };
-        const params = {
-            protobufName: 'DeliveryGoodsApplyReq',
-            funCodeName: 'DeliveryGoodsApplyReq',
-            reqParams: Object.assign(req, param),
-            msgHeadParams: {
-                AccountID: getSelectedAccountId() === null ? 0 : getSelectedAccountId(),
-                MarketID: 18,   // 目前写死
-                GoodsID: 0, // 目前写死
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'DeliveryGoodsApplyRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    const req = {
+        version: "3.2",
+        userid: getUserId(),
+    };
+    Object.assign(req, param)
+    return protoMiddleware<DeliveryGoodsApplyReq>(param, 'DeliveryGoodsApplyReq', 'DeliveryGoodsApplyRsp', 2)
 }
 
 /**
@@ -50,66 +28,12 @@ export const addDeliveryGoodsApply = (param: DeliveryGoodsApplyReq): Promise<any
  */
 export const ermsMiddelGoodsEdit = (param: ErmsMiddelGoodsEditReq): Promise<any> => {
     param.areauserid = APP.get('userAccount').memberuserid // 机构用户id
-    return new Promise((resolve, reject) => {
-        const userid = getUserId()
-        const req = {
-            version: "3.2",
-            userid,
-            loginid: getLongTypeLoginID(),
-        };
-        param.modifierid = userid
-        const params = {
-            protobufName: 'ErmsMiddelGoodsEditReq',
-            funCodeName: 'ErmsMiddelGoodsEditReq',
-            reqParams: Object.assign(req, param),
-            msgHeadParams: {
-                AccountID: getSelectedAccountId() === null ? 0 : getSelectedAccountId(),
-                MarketID: 18,   // 目前写死
-                GoodsID: 0, // 目前写死
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'ErmsMiddelGoodsEditRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<ErmsMiddelGoodsEditReq>(param, 'ErmsMiddelGoodsEditReq', 'ErmsMiddelGoodsEditRsp', 2)
 }
 
 /**
  * 现货品种停用请求
  */
 export const deliveryGoodsCancel = (param: DeliveryGoodsCancelReq): Promise<any> => {
-
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'DeliveryGoodsCancelReq',
-            funCodeName: 'DeliveryGoodsCancelReq',
-            reqParams: param,
-            msgHeadParams: {
-                AccountID: getSelectedAccountId() === null ? 0 : getSelectedAccountId(),
-                MarketID: 18,   // 目前写死
-                GoodsID: 0, // 目前写死
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'DeliveryGoodsCancelRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<DeliveryGoodsCancelReq>(param, 'DeliveryGoodsCancelReq', 'DeliveryGoodsCancelRsp', 2)
 }

+ 4 - 50
src/services/proto/hedgeplan/index.ts

@@ -2,10 +2,11 @@
 import APP from "@/services";
 import { getSelectedAccountId, getUserId } from "@/services/bus/account";
 import {ErmcpHedgePlanReq, HedgePlanOperateReq} from "@/services/proto/hedgeplan/interface";
-import { buildProtoReq50, parseProtoRsp50 } from "@/services/socket/protobuf/buildReq";
+import {buildProtoReq50, parseProtoRsp50, protoMiddleware} from "@/services/socket/protobuf/buildReq";
 import { Callback } from "@/utils/websocket";
 import moment from "moment";
 import { v4 as uuidv4 } from "uuid";
+import {GldErmcpSpotContractOperateReq} from "@/services/proto/spotcontract/interface";
 
 /**
  * 套保计划操作请求
@@ -15,31 +16,7 @@ import { v4 as uuidv4 } from "uuid";
 export const hedgePlanReq = (param: ErmcpHedgePlanReq): Promise<any> => {
     param.ApplySrc = 2; // 申请来源 - 1:管理端 2:终端
     param.TradeDate = moment().format("YYMMDD");
-
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'ErmcpHedgePlanReq',
-            funCodeName: 'ErmcpHedgePlanReq',
-            reqParams: param,
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'ErmcpHedgePlanRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<ErmcpHedgePlanReq>(param, 'ErmcpHedgePlanReq', 'ErmcpHedgePlanRsp', 2)
 }
 
 /**
@@ -51,28 +28,5 @@ export const oldHedgePlanReq = (param: HedgePlanOperateReq): Promise<any> => {
     param.ClientTicket = uuidv4(); // 流水号
     param.Remark = ''
     param.UserID = getUserId()
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'HedgePlanOperateReq',
-            funCodeName: 'HedgePlanOperateReq',
-            reqParams: param,
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'HedgePlanOperateRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<HedgePlanOperateReq>(param, 'HedgePlanOperateReq', 'HedgePlanOperateRsp', 2)
 }

+ 6 - 59
src/services/proto/spotcontract/index.ts

@@ -1,48 +1,20 @@
-import APP from "@/services";
-import { getSelectedAccountId, getUserId } from "@/services/bus/account";
-import { GldErmcpSpotContractOperateReq, SpotContractOperateReq } from "@/services/proto/spotcontract/interface";
-import { buildProtoReq50, parseProtoRsp50 } from "@/services/socket/protobuf/buildReq";
-import { Callback } from "@/utils/websocket";
-import { v4 as uuidv4 } from 'uuid';
+import {getUserId} from "@/services/bus/account";
+import {GldErmcpSpotContractOperateReq, SpotContractOperateReq} from "@/services/proto/spotcontract/interface";
+import {protoMiddleware} from "@/services/socket/protobuf/buildReq";
+import {v4 as uuidv4} from 'uuid';
 
 /**(重点提醒 这里属于管理端接口,仅用于新增)以上来自android代码  回头需要确认
  * 新增 / 修改采购合同报文 (很多修改合同操作也在这)
  * @param param 1:保存草稿2:提交申请3:删除4:审核通过
  */
 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);
-    });
+    return protoMiddleware<GldErmcpSpotContractOperateReq>(reqParams, 'GldErmcpSpotContractOperateReq', 'GldErmcpSpotContractOperateRsp', 2)
 }
 
 /**
@@ -50,36 +22,11 @@ export const orderContract = (param: GldErmcpSpotContractOperateReq): Promise<an
  * @param param 2 操作类型-1:保存草稿2:提交申请3:审核通过4:审核拒绝5:撤回6:正常完结7:异常终止
  */
 export const spotContractStatus = (param: SpotContractOperateReq): 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: 'SpotContractOperateReq',
-            funCodeName: 'SpotContractOperateReq',
-            reqParams: reqParams,
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'SpotContractOperateRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<SpotContractOperateReq>(reqParams, 'SpotContractOperateReq', 'SpotContractOperateRsp', 2)
 }

+ 4 - 132
src/services/proto/warehouse/index.ts

@@ -19,39 +19,8 @@ import { Callback } from "@/utils/websocket";
  */
 export const addWarehouseApply = (param: WarehouseApplyReq): Promise<any> => {
     const userid = getUserId();
-    // const accountid = getSelectedAccountId()
-
     Object.assign(param, { userid },)
-
-    debugger
     return protoMiddleware<WarehouseApplyReq>(param, 'WarehouseApplyReq', 'WarehouseApplyRsp', 2)
-    // return new Promise((resolve, reject) => {
-    //     const userid = getUserId();
-    //     const accountid = getSelectedAccountId()
-
-    //     const params = {
-    //         protobufName: 'WarehouseApplyReq',
-    //         funCodeName: 'WarehouseApplyReq',
-    //         reqParams: Object.assign(param, { userid, accountid }),
-    //         msgHeadParams: {
-    //             AccountID: accountid,
-    //             MarketID: 18,
-    //             GoodsID: 0,
-    //         }
-    //     };
-    //     const package50 = buildProtoReq50(params);
-    //     APP.sendTradingServer(package50, undefined, {
-    //         onSuccess: (res) => {
-    //             const { isSuccess, result } = parseProtoRsp50(res, 'WarehouseApplyRsp');
-    //             if (isSuccess) {
-    //                 resolve(result);
-    //             } else {
-    //                 reject(result);
-    //             }
-    //         },
-    //         onFail: (err) => reject(err.message),
-    //     } as Callback);
-    // });
 }
 
 /**
@@ -60,30 +29,7 @@ export const addWarehouseApply = (param: WarehouseApplyReq): Promise<any> => {
  * @param param.warehousestatus 仓库状态 - 1:正常 2:注销 3:待审核 4:审核拒绝
  */
 export const warehouseStateChangeReq = (param: WarehouseStateChangeReq): Promise<any> => {
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'WarehouseStateChangeReq',
-            funCodeName: 'WarehouseStateChangeReq',
-            reqParams: param,
-            msgHeadParams: {
-                AccountID: param.accountid,
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'WarehouseStateChangeRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<WarehouseStateChangeReq>(param, 'WarehouseStateChangeReq', 'WarehouseStateChangeRsp', 2)
 }
 
 /**
@@ -91,34 +37,9 @@ export const warehouseStateChangeReq = (param: WarehouseStateChangeReq): Promise
  * @param param
  */
 export const inOutStockApplyReq = (param: AreaInOutApplyAuditPassReq): Promise<any> => {
-
     param.ClientTicket = getUUID()
     param.AuditSrc = 2
-
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'AreaInOutApplyAuditPassReq',
-            funCodeName: 'AreaInOutApplyAuditPassReq',
-            reqParams: param,
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'AreaInOutApplyAuditPassRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<AreaInOutApplyAuditPassReq>(param, 'AreaInOutApplyAuditPassReq', 'AreaInOutApplyAuditPassRsp', 2)
 }
 
 /**
@@ -126,34 +47,9 @@ export const inOutStockApplyReq = (param: AreaInOutApplyAuditPassReq): Promise<a
  * @param param
  */
 export const refuseStockApplyReq = (param: AuditERMCPAreaInOutStockApplyReq): Promise<any> => {
-
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'AuditERMCPAreaInOutStockApplyReq',
-            funCodeName: 'AuditERMCPAreaInOutStockApplyReq',
-            reqParams: param,
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'AuditERMCPAreaInOutStockApplyRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<AuditERMCPAreaInOutStockApplyReq>(param, 'AuditERMCPAreaInOutStockApplyReq', 'AuditERMCPAreaInOutStockApplyRsp', 2)
 }
 
-
 /**
  * 出入库申请
  * @param param
@@ -162,29 +58,5 @@ export const ermcpInOutStockApplyReq = (param: ERMCPAreaInOutStockApplyReq): Pro
     param.UserID = getUserId()
     param.ApplySrc = 2
     param.ApplyId = Number(getLongTypeLoginID())
-
-    return new Promise((resolve, reject) => {
-        const params = {
-            protobufName: 'ERMCPAreaInOutStockApplyReq',
-            funCodeName: 'ERMCPAreaInOutStockApplyReq',
-            reqParams: param,
-            msgHeadParams: {
-                AccountID: getSelectedAccountId(),
-                MarketID: 18,
-                GoodsID: 0,
-            }
-        };
-        const package50 = buildProtoReq50(params);
-        APP.sendTradingServer(package50, undefined, {
-            onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'ERMCPAreaInOutStockApplyRsp');
-                if (isSuccess) {
-                    resolve(result);
-                } else {
-                    reject(result);
-                }
-            },
-            onFail: (err) => reject(err.message),
-        } as Callback);
-    });
+    return protoMiddleware<ERMCPAreaInOutStockApplyReq>(param, 'ERMCPAreaInOutStockApplyReq', 'ERMCPAreaInOutStockApplyRsp', 2)
 }

+ 1 - 1
src/views/information/account_info/compoments/add-business/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <!-- 新增账户 -->
+  <!-- 业务账户 - 新增登陆账户 -->
   <a-modal class="commonModal add-business-info"
            title="新增登录账户"
            v-model:visible="visible"