Kaynağa Gözat

Merge remote-tracking branch 'origin/main'

samir 6 ay önce
ebeveyn
işleme
c079093295

+ 18 - 0
agent-ui/api/auth/index.ts

@@ -20,3 +20,21 @@ export function login(username: string, password: string) {
 export function logout() {
   return post<any, Result<any>>("/auth/logout", {});
 }
+
+
+/**
+ *  验证谷歌验证器
+ *
+ * @returns .
+ */
+export function createGoogleOtp() {
+  return get<any, Result<any>>("/auth/googleOtp/create", {});
+}
+/**
+ *  验证谷歌验证器
+ *
+ * @returns .
+ */
+export function save(data: any) {
+  return post<any, Result<any>>("/auth/googleOtp/save", data);
+}

+ 26 - 1
agent-ui/src/api/auth/index.ts

@@ -1,5 +1,5 @@
 import { RSA } from "@/utils/crypto";
-import { post, Result } from "../base";
+import {get, post, Result} from "../base";
 
 /**
  * 用户登录换取token
@@ -12,6 +12,31 @@ export function login(username: string, password: string) {
     password: RSA.encrypt(password)
   });
 }
+
+/**
+ *  是否有谷歌验证器
+ *
+ * @returns .
+ */
+export function hasGoogleOtp() {
+  return get<any, Result<any>>("/auth/hasGoogleOtp", {});
+}
+/**
+ *  验证谷歌验证器
+ *
+ * @returns .
+ */
+export function createGoogleOtp() {
+  return get<any, Result<any>>("/auth/googleOtp/create", {});
+}
+/**
+ *  验证谷歌验证器
+ *
+ * @returns .
+ */
+export function save(data: any) {
+  return post<any, Result<any>>("/auth/googleOtp/save", data);
+}
 /**
  *  登出
  *

+ 59 - 58
agent-ui/src/views/channel/modules/edit.vue

@@ -1,13 +1,13 @@
 <script setup lang="ts">
-import { reactive, ref } from "vue";
+import {reactive, ref} from "vue";
 import * as $api from "@/api/channel/index";
-import { message } from "@/utils/message";
-import type { FormInstance } from "element-plus";
-import { cloneDeep } from "@pureadmin/utils";
+import {message} from "@/utils/message";
+import type {FormInstance} from "element-plus";
+import {cloneDeep} from "@pureadmin/utils";
 import {enableOptions} from "@/constants/constants";
 
 const title = "";
-defineOptions({ name: "templateEdit" });
+defineOptions({name: "templateEdit"});
 const isDetail = ref(false);
 const formRef = ref<FormInstance>();
 // 初始化数据
@@ -19,19 +19,34 @@ const initData = {
 };
 
 // 表单校验规则
-const formRules = {};
+const formRules = {
+  sellerId: [{required: true, message: "商户ID不能为空", trigger: "blur"}],
+  dayMaxPayAmount: [
+    {required: true, message: "每日限额不能为空", trigger: "blur"}
+  ],
+  onePayMaxAmount: [
+    {required: true, message: "单笔限额不能为空", trigger: "blur"}
+  ],
+  name: [{required: true, message: "名称不能为空", trigger: "blur"}],
+  rate: [{required: true, message: "统一费率不能为空", trigger: "blur"}],
+  code: [{required: true, message: "编码不能为空", trigger: "blur"}]
+
+};
 
 // 页面数据
 const pageData: any = reactive({
-  name: false,
-  code: false,
-  appId: false,
-  privateKey: false,
-  publicKey: false,
-  astrictAmount: false,
-  astrictTrade: false,
-  rate: false,
-  status: false,
+  name: "",
+  code: "",
+  appId: "",
+  privateKey: "",
+  publicKey: "",
+  astrictAmount: 0,
+  sellerId: "",
+  dayMaxPayAmount: 0,
+  onePayMaxAmount: 0,
+  astrictTrade: 0,
+  rate: 0,
+  status: 1,
   title: "",
   formLoading: false,
   mode: "add",
@@ -68,14 +83,14 @@ const handleClose = () => {
 const handleConfirm = () => {
   formRef.value!.validate((isValid: boolean) => {
     if (isValid) {
-      const { id } = pageData.formData;
+      const {id} = pageData.formData;
       if (id) {
         _update();
       } else {
         _save();
       }
     } else {
-      message("表单校验失败", { type: "warning" });
+      message("表单校验失败", {type: "warning"});
     }
   });
 };
@@ -88,7 +103,7 @@ const _save = () => {
       if (res.success) {
         _confirm();
       } else {
-        message(res.message, { type: "warning" });
+        message(res.message, {type: "warning"});
       }
     })
     .finally(() => {
@@ -104,7 +119,7 @@ const _update = () => {
       if (res.success) {
         _confirm();
       } else {
-        message(res.message, { type: "warning" });
+        message(res.message, {type: "warning"});
       }
     })
     .finally(() => {
@@ -115,15 +130,16 @@ const _confirm = () => {
   pageData.dialogVisible = false;
   emits("ok");
 };
-defineExpose({ open });
+defineExpose({open});
 </script>
 
 <template>
   <el-dialog v-model="pageData.dialogVisible" destroy-on-close :width="500">
     <template #header>
       <el-text class="mx-1" type="primary" size="large">{{
-        pageData.title
-      }}</el-text>
+          pageData.title
+        }}
+      </el-text>
     </template>
     <div class="el-dialog-content">
       <el-form
@@ -134,7 +150,7 @@ defineExpose({ open });
         :rules="pageData.formRules"
         :loading="pageData.formLoading"
       >
-        <el-form-item label="名称" prop="userName">
+        <el-form-item label="名称" prop="name">
           <el-input
             v-model="pageData.formData.name"
             clearable
@@ -143,7 +159,7 @@ defineExpose({ open });
             :readonly="isDetail"
           />
         </el-form-item>
-        <el-form-item label="编码" prop="password">
+        <el-form-item label="编码" prop="code">
           <el-input
             v-model="pageData.formData.code"
             clearable
@@ -152,50 +168,34 @@ defineExpose({ open });
             :readonly="isDetail"
           />
         </el-form-item>
-        <el-form-item label="appId" prop="password">
-          <el-input
-            v-model="pageData.formData.appId"
-            clearable
-            placeholder="请输入appId"
-            size="small"
-            :readonly="isDetail"
-          />
-        </el-form-item>   <el-form-item label="密钥" prop="password">
+        <el-form-item label="商户ID" prop="sellerId">
           <el-input
-            v-model="pageData.formData.privateKey"
+            v-model="pageData.formData.sellerId"
             clearable
-            placeholder="请输入密钥"
+            placeholder="请输入商户ID"
             size="small"
             :readonly="isDetail"
           />
         </el-form-item>
-        <el-form-item label="公钥" prop="password">
+        <el-form-item label="每日限额" prop="dayMaxPayAmount">
           <el-input
-            v-model="pageData.formData.publicKey"
+            v-model="pageData.formData.dayMaxPayAmount"
             clearable
-            placeholder="请输入公钥"
-            size="small"
-            :readonly="isDetail"
-          />
-        </el-form-item>        <el-form-item label="单笔限制金额" prop="password">
-          <el-input
-            v-model="pageData.formData.astrictAmount"
-            clearable
-            placeholder="请输入单笔限制金额"
+            placeholder="请输入每日限额"
             size="small"
             :readonly="isDetail"
           />
         </el-form-item>
-        <el-form-item label="限制流水" prop="password">
+        <el-form-item label="单笔限额" prop="onePayMaxAmount">
           <el-input
-            v-model="pageData.formData.astrictTrade"
+            v-model="pageData.formData.onePayMaxAmount"
             clearable
-            placeholder="请输入限制流水"
+            placeholder="请输入单笔限额"
             size="small"
             :readonly="isDetail"
           />
         </el-form-item>
-        <el-form-item label="统一费率" prop="password">
+        <el-form-item label="统一费率" prop="rate">
           <el-input
             v-model="pageData.formData.rate"
             clearable
@@ -206,15 +206,15 @@ defineExpose({ open });
         </el-form-item>
         <el-form-item label="状态" prop="password">
           <el-select
-              v-model="pageData.formData.status"
-              clearable
-              placeholder="请选择状态"
+            v-model="pageData.formData.status"
+            clearable
+            placeholder="请选择状态"
           >
             <el-option
-                v-for="item in enableOptions"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value"
+              v-for="item in enableOptions"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
             />
           </el-select>
         </el-form-item>
@@ -223,7 +223,8 @@ defineExpose({ open });
     <template #footer>
       <el-button v-if="!isDetail" @click="handleClose">取消</el-button>
       <el-button v-if="!isDetail" type="primary" @click="handleConfirm"
-        >确认</el-button
+      >确认
+      </el-button
       >
     </template>
   </el-dialog>

+ 9 - 19
agent-ui/src/views/channel/modules/list.vue

@@ -115,29 +115,19 @@ const pageData: any = reactive({
         slot: "code"
       },
       {
-        label: "appId",
-        prop: "appId",
-        slot: "appId"
+        label: "商户Id",
+        prop: "sellerId",
+        slot: "sellerId"
       },
       {
-        label: "密钥",
-        prop: "privateKey",
-        slot: "privateKey"
+        label: "每日限额",
+        prop: "dayMaxPayAmount",
+        slot: "dayMaxPayAmount"
       },
       {
-        label: "公钥",
-        prop: "publicKey",
-        slot: "publicKey"
-      },
-      {
-        label: "单笔限制金额",
-        prop: "astrictAmount",
-        slot: "astrictAmount"
-      },
-      {
-        label: "限制流水",
-        prop: "astrictTrade",
-        slot: "astrictTrade"
+        label: "单笔限额",
+        prop: "onePayMaxAmount",
+        slot: "onePayMaxAmount"
       },
       {
         label: "统一费率",

+ 110 - 0
agent-ui/src/views/welcome/bind.vue

@@ -0,0 +1,110 @@
+<script setup lang="ts">
+import { reactive, ref } from "vue";
+import { message } from "@/utils/message";
+import type { FormInstance } from "element-plus";
+import { cloneDeep } from "@pureadmin/utils";
+import * as $api from "@/api/auth/index";
+
+defineOptions({ name: "templateEdit" });
+const isDetail = ref(false);
+const formRef = ref<FormInstance>();
+// 初始化数据
+const initData = {
+  code: undefined
+};
+
+// 表单校验规则
+const formRules = reactive({
+  code: [{ required : true, message: '验证码不能为空'}]
+});
+
+// 页面数据
+const pageData: any = reactive({
+  code: "",
+  // 表单数据
+  formData: initData,
+  formRules: {
+    code: [{ required: true, message: "请选择验证码", trigger: "blur" }]
+  }
+});
+// 暴露给父级调用
+const emits = defineEmits(["ok", "close"]);
+const qrcode = ref("");
+// 打开弹窗
+const open = (data: any, dataSource: any, mode: string) => {
+  $api.createGoogleOtp().then((res: any) => {
+    qrcode.value = res.message;
+  });
+  isDetail.value = false;
+  pageData.dialogVisible = true;
+};
+// 关闭弹窗
+const handleClose = () => {
+  pageData.dialogVisible = false;
+  emits("close");
+};
+// 确定并关闭弹窗
+const handleConfirm = () => {
+  formRef.value!.validate((isValid: boolean) => {
+    if (isValid) {
+      _save();
+    } else {
+      message("表单校验失败", { type: "warning" });
+    }
+  });
+};
+const _save = () => {
+  pageData.formLoading = true;
+  const _data = cloneDeep(pageData.formData);
+  $api
+    .save(_data)
+    .then((res: any) => {
+      if (res.success) {
+        _confirm();
+      } else {
+        message(res.message, { type: "warning" });
+      }
+    })
+    .finally(() => {
+      pageData.formLoading = false;
+    });
+};
+const _confirm = () => {
+  pageData.dialogVisible = false;
+  emits("ok");
+};
+defineExpose({ open });
+const showClose = ref(false);
+</script>
+
+<template>
+  <el-dialog
+    v-model="pageData.dialogVisible"
+    :show-close="showClose"
+    :width="500"
+  >
+    <template #header>
+      <el-text class="mx-1" type="primary" size="large">绑定谷歌验证器</el-text>
+    </template>
+
+    <div class="el-dialog-content">
+      <el-form
+        :model="pageData.formData"
+        ref="formRef"
+        style="width: 90%; margin: 20px auto 0"
+        label-width="auto"
+        :rules="pageData.formRules"
+      >
+        <el-form-item label="二维码">
+          <img :src="qrcode" />
+        </el-form-item>
+        <el-form-item label="验证码" prop="code">
+          <el-input v-model="pageData.formData.code" />
+        </el-form-item>
+      </el-form>
+    </div>
+    <template #footer>
+      <el-button type="primary" @click="handleConfirm">确认</el-button>
+    </template>
+  </el-dialog>
+</template>

+ 18 - 4
agent-ui/src/views/welcome/index.vue

@@ -1,14 +1,28 @@
 <script setup lang="ts">
+import * as $api from "@/api/auth/index";
+import { onMounted, ref } from "vue";
+import Bind from "@/views/welcome/bind.vue";
+const bindRef = ref();
 defineOptions({
   name: "Welcome"
 });
+onMounted(() => {
+  $api.hasGoogleOtp().then((res: any) => {
+    if (!res.result) {
+      bindRef.value!.open({}, {}, "add");
+    }
+  });
+});
 </script>
 
 <template>
-  <div class="max-w-full">
-    <el-card style="width: 480px; border-radius: 8px" shadow="hover"
-      >Always</el-card
-    >
+  <div>
+    <div class="max-w-full">
+      <el-card style="width: 480px; border-radius: 8px" shadow="hover"
+        >Always</el-card
+      >
+    </div>
+<!--    <bind ref="bindRef" />-->
   </div>
 </template>
 

+ 0 - 10
agent-ui/views/order/index.vue

@@ -1,14 +1,4 @@
 <script setup lang="ts">
-import FormSearch from "@/components/opts/form-search.vue";
-import TableButtons from "@/components/opts/btns2.vue";
-import ConfigEdit from "./modules/config-edit.vue";
-import { PureTable } from "@pureadmin/table";
-import { reactive, ref } from "vue";
-import { configTypeOptions } from "@/constants/constants";
-import * as $configApi from "@/api/sys/config";
-import { onMounted } from "vue";
-import { hasAuth } from "@/router/utils";
-import message from "@/utils/message";
 </script>
 
 <template>

+ 106 - 0
agent-ui/views/welcome/bind.vue

@@ -0,0 +1,106 @@
+<script setup lang="ts">
+import { reactive, ref } from "vue";
+import { message } from "@/utils/message";
+import type { FormInstance } from "element-plus";
+import { cloneDeep } from "@pureadmin/utils";
+import * as $api from "@/api/auth/index";
+
+defineOptions({ name: "templateEdit" });
+const isDetail = ref(false);
+const formRef = ref<FormInstance>();
+// 初始化数据
+const initData = {
+  code: undefined
+};
+
+// 表单校验规则
+const formRules = reactive({
+  code: [{ required : true, message: '验证码不能为空'}]
+});
+
+// 页面数据
+const pageData: any = reactive({
+  code: "",
+  // 表单数据
+  formData: initData,
+  formRules: {
+    code: [{ required: true, message: "请选择验证码", trigger: "blur" }]
+  }
+});
+// 暴露给父级调用
+const emits = defineEmits(["ok", "close"]);
+const qrcode = ref("");
+// 打开弹窗
+const open = (data: any, dataSource: any, mode: string) => {
+  $api.createGoogleOtp().then((res: any) => {
+    qrcode.value = res.message;
+  });
+  isDetail.value = false;
+  pageData.dialogVisible = true;
+};
+// 关闭弹窗
+const handleClose = () => {
+  pageData.dialogVisible = false;
+  emits("close");
+};
+// 确定并关闭弹窗
+const handleConfirm = () => {
+  formRef.value!.validate((isValid: boolean) => {
+    if (isValid) {
+      _save();
+    } else {
+      message("表单校验失败", { type: "warning" });
+    }
+  });
+};
+const _save = () => {
+  pageData.formLoading = true;
+  const _data = cloneDeep(pageData.formData);
+  $api
+    .save(_data)
+    .then((res: any) => {
+      if (res.success) {
+        _confirm();
+      } else {
+        message(res.message, { type: "warning" });
+      }
+    })
+    .finally(() => {
+      pageData.formLoading = false;
+    });
+};
+const _confirm = () => {
+  pageData.dialogVisible = false;
+  emits("ok");
+};
+defineExpose({ open });
+const showClose = ref(false);
+</script>
+
+<template>
+  <el-dialog v-model="pageData.dialogVisible" :show-close="showClose" :width="500">
+    <template #header>
+      <el-text class="mx-1" type="primary" size="large">绑定谷歌验证器</el-text>
+    </template>
+
+    <div class="el-dialog-content">
+      <el-form
+        :model="pageData.formData"
+        ref="formRef"
+        style="width: 90%; margin: 20px auto 0"
+        label-width="auto"
+        :rules="pageData.formRules"
+      >
+        <el-form-item label="二维码">
+          <img :src="qrcode" />
+        </el-form-item>
+        <el-form-item label="验证码" prop="code">
+          <el-input v-model="pageData.formData.code"></el-input>
+        </el-form-item>
+      </el-form>
+    </div>
+    <template #footer>
+      <el-button type="primary" @click="handleConfirm">确认</el-button>
+    </template>
+  </el-dialog>
+</template>

+ 15 - 3
agent-ui/views/welcome/index.vue

@@ -1,15 +1,27 @@
 <script setup lang="ts">
+import * as $api from "@/api/auth/index";
+import { onMounted, ref } from "vue";
+import Bind from "@/views/welcome/bind.vue";
+const bindRef = ref();
 defineOptions({
   name: "Welcome"
 });
+onMounted(() => {
+  alert("sdfsf");
+  $api.hasGoogleOtp().then((res: any) => {
+    if (!res.result) {
+      bindRef.value!.open({}, {}, "add");
+
+    }
+  });
+});
 </script>
 
 <template>
   <div class="max-w-full">
-    <el-card style="width: 480px; border-radius: 8px" shadow="hover"
-      >Always</el-card
-    >
+    <el-card style="width: 480px; border-radius: 8px" shadow="hover" >Alway11s</el-card>
   </div>
+  <bind ref="bindRef" />
 </template>
 
 <style scoped>

+ 25 - 1
merchant-ui/src/api/auth/index.ts

@@ -1,5 +1,5 @@
 import { RSA } from "@/utils/crypto";
-import { post, Result } from "../base";
+import {get, post, Result} from "../base";
 
 /**
  * 用户登录换取token
@@ -12,6 +12,30 @@ export function login(username: string, password: string) {
     password: RSA.encrypt(password)
   });
 }
+/**
+ *  是否有谷歌验证器
+ *
+ * @returns .
+ */
+export function hasGoogleOtp() {
+  return get<any, Result<any>>("/auth/hasGoogleOtp", {});
+}
+/**
+ *  验证谷歌验证器
+ *
+ * @returns .
+ */
+export function createGoogleOtp() {
+  return get<any, Result<any>>("/auth/googleOtp/create", {});
+}
+/**
+ *  验证谷歌验证器
+ *
+ * @returns .
+ */
+export function save(data: any) {
+  return post<any, Result<any>>("/auth/googleOtp/save", data);
+}
 /**
  *  登出
  *

+ 11 - 0
merchant-ui/src/api/merchant/index.ts

@@ -0,0 +1,11 @@
+import { Result, get } from "../base";
+
+
+/**
+ * 列表查询
+ * @param query .
+ * @returns .
+ */
+export function info<T>(): Promise<Result<T>> {
+  return get("merchant/pay/app/key/info", {});
+}

+ 108 - 0
merchant-ui/src/views/welcome/bind.vue

@@ -0,0 +1,108 @@
+<script setup lang="ts">
+import { reactive, ref } from "vue";
+import { message } from "@/utils/message";
+import type { FormInstance } from "element-plus";
+import { cloneDeep } from "@pureadmin/utils";
+import * as $api from "@/api/auth/index";
+import ReQrcode from "@/components/ReQrcode/src";
+
+const title = "";
+defineOptions({ name: "templateEdit" });
+const isDetail = ref(false);
+const formRef = ref<FormInstance>();
+// 初始化数据
+const initData = {
+  code: undefined
+};
+
+// 表单校验规则
+const formRules = reactive({
+  code: [{ required : true, message: '验证码不能为空'}]
+});
+
+// 页面数据
+const pageData: any = reactive({
+  code: "",
+  // 表单数据
+  formData: initData,
+  formRules: {
+    code: [{ required: true, message: "请选择验证码", trigger: "blur" }]
+  }
+});
+// 暴露给父级调用
+const emits = defineEmits(["ok", "close"]);
+const qrcode = ref("");
+// 打开弹窗
+const open = (data: any, dataSource: any, mode: string) => {
+  $api.createGoogleOtp().then((res: any) => {
+    qrcode.value = res.message;
+  });
+  isDetail.value = false;
+  pageData.dialogVisible = true;
+};
+// 关闭弹窗
+const handleClose = () => {
+  pageData.dialogVisible = false;
+  emits("close");
+};
+// 确定并关闭弹窗
+const handleConfirm = () => {
+  formRef.value!.validate((isValid: boolean) => {
+    if (isValid) {
+      _save();
+    } else {
+      message("表单校验失败", { type: "warning" });
+    }
+  });
+};
+const _save = () => {
+  pageData.formLoading = true;
+  const _data = cloneDeep(pageData.formData);
+  $api
+    .save(_data)
+    .then((res: any) => {
+      if (res.success) {
+        _confirm();
+      } else {
+        message(res.message, { type: "warning" });
+      }
+    })
+    .finally(() => {
+      pageData.formLoading = false;
+    });
+};
+const _confirm = () => {
+  pageData.dialogVisible = false;
+  emits("ok");
+};
+defineExpose({ open });
+const showClose = ref(false);
+</script>
+
+<template>
+  <el-dialog v-model="pageData.dialogVisible" :show-close="showClose" :width="500">
+    <template #header>
+      <el-text class="mx-1" type="primary" size="large">绑定谷歌验证器</el-text>
+    </template>
+
+    <div class="el-dialog-content">
+      <el-form
+        :model="pageData.formData"
+        ref="formRef"
+        style="width: 90%; margin: 20px auto 0"
+        label-width="auto"
+        :rules="pageData.formRules"
+      >
+        <el-form-item label="二维码">
+          <img :src="qrcode" />
+        </el-form-item>
+        <el-form-item label="验证码" prop="code">
+          <el-input v-model="pageData.formData.code"></el-input>
+        </el-form-item>
+      </el-form>
+    </div>
+    <template #footer>
+      <el-button type="primary" @click="handleConfirm">确认</el-button>
+    </template>
+  </el-dialog>
+</template>

+ 40 - 3
merchant-ui/src/views/welcome/index.vue

@@ -1,15 +1,52 @@
 <script setup lang="ts">
+
+import * as $api from "@/api/auth/index";
+import * as $merchantApi from "@/api/merchant/index";
+import {onMounted, reactive, ref} from "vue";
+import Bind from "@/views/welcome/bind.vue";
+const bindRef = ref();
 defineOptions({
   name: "Welcome"
 });
+const merchantKeyInfo: any = {};
+onMounted(() => {
+  merchantKey();
+  $api.hasGoogleOtp().then((res: any) => {
+    if (!res.result) {
+      bindRef.value!.open({}, {}, "add");
+
+    }
+  });
+});
+const merchantKey = () => {
+  $merchantApi.info().then((res: any) => {
+    pageData.formData = res.result
+  });
+};
+const pageData: any = reactive({
+  formData: {
+    appId: "",
+    appKey: ""
+  }
+});
 </script>
 
 <template>
   <div class="max-w-full">
-    <el-card style="width: 480px; border-radius: 8px" shadow="hover"
-      >Always</el-card
-    >
+    <el-card style="width: 480px; border-radius: 8px" shadow="hover">
+      <template #default v-if="merchantKeyInfo">
+        <el-form :model="pageData.formData">
+          <el-form-item label="appId:">
+            <el-input v-model="pageData.formData.appId" />
+          </el-form-item>
+          <el-form-item label="appKey:">
+            <el-input v-model="pageData.formData.appKey" />
+          </el-form-item>
+        </el-form>
+      </template>
+    </el-card>
   </div>
+  <bind ref="bindRef"></bind>
 </template>
 
 <style scoped>