index.ts 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. import service from '@/services'
  2. import http from '@/services/http'
  3. import { RequestConfig } from '@/services/http/types'
  4. import { useGlobalStore, useLoginStore } from '@/stores'
  5. const globalStore = useGlobalStore()
  6. const loginStore = useLoginStore()
  7. /**
  8. * 账户登录
  9. */
  10. export function wsLogin(data: Proto.LoginReq) {
  11. return http.mqRequest<Proto.LoginRsp>({
  12. data,
  13. requestCode: 'LoginReq',
  14. responseCode: 'LoginRsp'
  15. })
  16. }
  17. /**
  18. * 账户登录
  19. */
  20. export function httpLogin(config: RequestConfig<Model.LoginReq> = {}) {
  21. return http.goRequest<Model.LoginRsp>({
  22. method: 'post',
  23. url: '/Account/Login',
  24. data: config.data,
  25. })
  26. }
  27. /**
  28. * 用户登出
  29. */
  30. export function logout(config: RequestConfig = {}) {
  31. return http.goRequest<Model.LoginRsp>({
  32. url: '/Account/Loginout',
  33. params: config.data,
  34. })
  35. }
  36. /**
  37. * Token校验
  38. */
  39. export function tokenCheck() {
  40. if (globalStore.getSystemInfo('tradeChannel') === 'ws') {
  41. return http.mqRequest<Proto.TokenCheckRsp>({
  42. data: <Proto.TokenCheckReq>{
  43. LoginID: loginStore.loginId,
  44. Token: loginStore.token
  45. },
  46. requestCode: 'TokenCheckReq',
  47. responseCode: 'TokenCheckRsp'
  48. })
  49. }
  50. return http.goRequest({
  51. url: '/Account/TokenCheck'
  52. })
  53. }
  54. /**
  55. * 查询账户菜单
  56. */
  57. export function queryAccountMenu(config: RequestConfig = {}) {
  58. return http.request<Model.UserRoutes[]>({
  59. url: './config/router.json',
  60. params: config.data,
  61. })
  62. }
  63. /**
  64. * 查询登录ID
  65. */
  66. export function queryLoginId(config: RequestConfig<{ username: string }> = {}) {
  67. return http.commonRequest<string>({
  68. url: '/User/GetLoginID',
  69. params: config.data,
  70. }, 'GetLoginID')
  71. }
  72. /**
  73. * 查询登录账户配置信息
  74. */
  75. export function queryLoginData(config: RequestConfig<Model.LoginQueryReq> = {}) {
  76. return http.commonRequest<Model.LoginQueryRsp>({
  77. url: '/User/LoginQuery',
  78. params: config.data,
  79. }, 'LoginQuery')
  80. }
  81. /**
  82. * 获取用户账号信息
  83. */
  84. export function queryUserAccount(config: RequestConfig<{ userID: number }> = {}) {
  85. return http.commonRequest<Model.UserAccount>({
  86. url: '/User/GetUserAccount',
  87. params: {
  88. userID: loginStore.userId,
  89. ...config.data
  90. },
  91. }, 'GetUserAccount')
  92. }
  93. /**
  94. * 查询资金账户信息
  95. */
  96. export function queryTaAccounts(config: RequestConfig<Model.TaAccountsReq> = {}) {
  97. return http.commonRequest<Model.TaAccountsRsp[]>({
  98. url: '/TaAccount/GetTaAccounts',
  99. params: config.data,
  100. }, 'GetTaAccounts')
  101. }
  102. /**
  103. * 查询账户角色
  104. */
  105. export function queryAccountRole(config: RequestConfig = {}) {
  106. return http.commonRequest<Model.UserRole[]>({
  107. url: '/account/role',
  108. params: config.data,
  109. })
  110. }
  111. /**
  112. * 查询实名认证信息
  113. */
  114. export function queryWrDraftUserInfo(config: RequestConfig<Model.WrDraftUserInfoReq> = {}) {
  115. return http.commonRequest<Model.UserInfo[]>({
  116. url: '/WrTrade2/QueryWrDraftUserInfo',
  117. params: config.data,
  118. })
  119. }
  120. /**
  121. * 实名认证请求
  122. */
  123. export function requestAddAuth(config: RequestConfig<Model.AddAuthReq> = {}) {
  124. return http.request<Model.AddAuthRsp>({
  125. method: 'post',
  126. url: service.getConfig('openApiUrl') + '/onlineopen/userInfo/addAuth',
  127. data: config.data,
  128. })
  129. }
  130. /**
  131. * 投资者销户申请
  132. */
  133. export function investorDel(config: RequestConfig<Proto.InvestorDelReq>) {
  134. return http.mqRequest<Proto.InvestorDelRsp>({
  135. data: config.data,
  136. requestCode: 'InvestorDelReq',
  137. responseCode: 'InvestorDelRsp',
  138. })
  139. }
  140. /**
  141. * 修改密码
  142. */
  143. export function modifyPassword(config: RequestConfig<Proto.ModifyPwdReq>) {
  144. return http.mqRequest<Proto.ModifyPwdRsp>({
  145. data: config.data,
  146. requestCode: 'ModifyPwdReq',
  147. responseCode: 'ModifyPwdRsp',
  148. })
  149. }
  150. /**
  151. * 实名认证添加用户
  152. */
  153. export function requestAddUser(config: RequestConfig<Model.AddUserReq> = {}) {
  154. return http.goRequest<Model.AddUserRsp>({
  155. method: 'post',
  156. url: '/Account/AddUser',
  157. data: config.data,
  158. })
  159. }
  160. /**
  161. * 查询用户电子签记录表
  162. */
  163. export function queryUserESignRecord(config: RequestConfig<Model.UserESignRecordReq> = {}) {
  164. return http.goRequest<Model.UserESignRecordRsq[]>({
  165. method: 'get',
  166. url: '/Account/QueryUserESignRecord',
  167. params: config.data,
  168. })
  169. }
  170. /**
  171. * 上传待签署文件和添加签署方
  172. */
  173. export function requestCreateContractAndAddSigner(config: RequestConfig<Model.ContractAndAddSignerReq> = {}) {
  174. return http.goRequest<Model.ContractAndAddSignerRsq>({
  175. method: 'post',
  176. url: '/Account/CreateContractAndAddSigner',
  177. data: config.data,
  178. })
  179. }
  180. /**
  181. * 提交实名认证
  182. */
  183. export function requestSignCompleted(config: RequestConfig<Model.ContractAndAddSignerReq> = {}) {
  184. return http.goRequest<Model.ContractAndAddSignerRsq>({
  185. method: 'post',
  186. url: '/Account/SignCompleted',
  187. data: config.data,
  188. })
  189. }
  190. /**
  191. * 个人意愿核身认证
  192. */
  193. export function requestWillFace(config: RequestConfig<Model.WillFaceReq> = {}) {
  194. return http.goRequest<Model.WillFaceRsq>({
  195. method: 'post',
  196. url: '/Account/WillFace',
  197. data: config.data,
  198. })
  199. }
  200. /**
  201. * 证件号重复校验
  202. */
  203. export function requestCheckCardNum(config: RequestConfig<Model.CheckCardNumReq> = {}) {
  204. return http.request<Model.CheckCardNumRsp>({
  205. method: 'get',
  206. url: service.getConfig('openApiUrl') + '/onlineopen/userInfo/checkCardNum',
  207. params: {
  208. userid: loginStore.userId,
  209. ...config.data
  210. },
  211. })
  212. }
  213. /**
  214. * 查询用户电子签记录表
  215. */
  216. export function queryTencentUsereSignRecords(config: RequestConfig<Model.TencentUsereSignRecordsReq> = {}) {
  217. return http.commonRequest<Model.TencentUsereSignRecordsRsq[]>({
  218. method: 'get',
  219. url: '/Tencent/QueryUsereSignRecords',
  220. params: config.data,
  221. }, 'QueryUsereSignRecords')
  222. }
  223. /**
  224. * 通过合同名和模板 id 直接发起签署流程
  225. */
  226. export function requestCreateFlowByTemplateDirectly(config: RequestConfig<Model.CreateFlowByTemplateDirectlyReq> = {}) {
  227. return http.commonRequest<Model.CreateFlowByTemplateDirectlyRsq>({
  228. method: 'post',
  229. url: '/Tencent/CreateFlowByTemplateDirectly',
  230. data: config.data,
  231. }, 'CreateFlowByTemplateDirectly')
  232. }
  233. /**
  234. * 按用户 ID 和机构 ID 创建腾讯电子签业务信息
  235. */
  236. export function requestInitTencentESS(config: RequestConfig<Model.InitTencentESSReq> = {}) {
  237. return http.commonRequest<Model.InitTencentESSRsp>({
  238. method: 'post',
  239. url: '/Tencent/InitTencentESS',
  240. data: config.data,
  241. })
  242. }