huangbin há 4 anos atrás
pai
commit
857eac1d16

+ 10 - 4
src/services/socket/protobuf/buildReq.ts

@@ -189,7 +189,10 @@ function parseSoleProtoRsp(rspPackage: any, funCodeName: string): ParseRsp {
         } if (RetCode === -1) { // 管理端错误消息
             return { isSuccess: false, result: RetDesc };
         } else {    // 数据库获取的错误信息
-            const errMsg = getErrorInfoByCode(String(RetCode));
+            // sb服务   定义好的错误规则信息又修改了
+            // 原本一开始 RetCode -1 代表着管理端错误信息,现在管理端 RetCode 不为 -1 也包括管理端错误信息,
+            // 数据库中存放的错误信息枚举,只包含http请求的,不包含管理端proto的。所有又要添加一层判断
+            const errMsg = RetDesc ? RetDesc : getErrorInfoByCode(String(RetCode));
             const result = errMsg ? errMsg : `未知错误:${RetCode}`;
             return { isSuccess: false, result };
         }
@@ -262,7 +265,7 @@ function lower(value: string): string {
  * @param headerEnum 自定义的proto参数枚举值,减小重复抒写 默认0
  * @param reqFuncodeName proto 发送请求定义的头名字,特别需要注意,自已的funCodeName要与这个一致
  * @param rspFuncodeName proto 响应请求定义的头名字
- * @returns 
+ * @returns
  */
 export function protoMiddleware<T>(param: T, reqName: string, rspName: string, headerEnum: HeadEnum = 0): Promise<any> {
     return new Promise((resolve, reject) => {
@@ -282,7 +285,10 @@ export function protoMiddleware<T>(param: T, reqName: string, rspName: string, h
                     reject(result);
                 }
             },
-            onFail: (err) => reject(err.message),
+            onFail: (err) => {
+                console.log(`proto:${reqName}错误消息:${err}`)
+                reject(err.message)
+            },
         } as Callback);
     });
 }
@@ -293,7 +299,7 @@ export function protoMiddleware<T>(param: T, reqName: string, rspName: string, h
  * @param headParam IMessageHead
  * @param reqFuncodeName proto 发送请求定义的头名字,特别需要注意,自已的funCodeName要与这个一致
  * @param rspFuncodeName proto 响应请求定义的头名字
- * @returns 
+ * @returns
  */
 export function protoMiddleware_manager<T>(param: T, reqName: string, rspName: string, headParam: IMessageHead): Promise<any> {
     return new Promise((resolve, reject) => {

+ 1 - 1
src/views/information/spot-contract/components/common-detail/index.vue

@@ -89,7 +89,7 @@ export default defineComponent({
                 const price = [
                     { label: '定价类型', value: getPriceTypeName(data.pricetype) },
                     { label: '数量', value: formatValue(data.qty) },
-                    { label: '点价合约', value: formatValue(data.goodscode) },
+                    { label: '点价合约', value: formatValue(data.goodsname) },
                     { label: '升贴水', value: formatValue(data.pricemove) },
                     { label: '点价期', value: formatValue(formatTime(data.startdate, 'd') + '--' + formatTime(data.enddate, 'd')) },
                     { label: '交收期', value: formatValue(formatTime(data.deliverystartdate, 'd') + '--' + formatTime(data.deliveryenddate, 'd')) },