index.ts 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. import service from '@/services'
  2. import http from '@/services/http'
  3. import { RequestConfig } from '@/services/http/types'
  4. import { useGlobalStore, useLoginStore,useAccountStore } from '@/stores'
  5. const globalStore = useGlobalStore()
  6. const loginStore = useLoginStore()
  7. const accountStore = useAccountStore()
  8. /**
  9. * 账户登录
  10. */
  11. export function wsLogin(data: Proto.LoginReq) {
  12. return http.mqRequest<Proto.LoginRsp>({
  13. data,
  14. requestCode: 'LoginReq',
  15. responseCode: 'LoginRsp'
  16. })
  17. }
  18. /**
  19. * 账户登录
  20. */
  21. export function httpLogin(config: RequestConfig<Model.LoginReq> = {}) {
  22. return http.goRequest<Model.LoginRsp>({
  23. method: 'post',
  24. url: '/Account/Login',
  25. data: config.data,
  26. })
  27. }
  28. /**
  29. * 用户登出
  30. */
  31. export function logout(config: RequestConfig = {}) {
  32. return http.goRequest<Model.LoginRsp>({
  33. url: '/Account/Loginout',
  34. params: config.data,
  35. })
  36. }
  37. /**
  38. * Token校验
  39. */
  40. export function tokenCheck() {
  41. if (globalStore.getSystemInfo('tradeChannel') === 'ws') {
  42. return http.mqRequest<Proto.TokenCheckRsp>({
  43. data: <Proto.TokenCheckReq>{
  44. LoginID: loginStore.loginId,
  45. Token: loginStore.token
  46. },
  47. requestCode: 'TokenCheckReq',
  48. responseCode: 'TokenCheckRsp'
  49. })
  50. }
  51. return http.goRequest({
  52. url: '/Account/TokenCheck'
  53. })
  54. }
  55. /**
  56. * 查询账户菜单
  57. */
  58. export function queryAccountMenu(config: RequestConfig = {}) {
  59. return http.request<Model.UserRoutes[]>({
  60. url: './config/router.json',
  61. params: config.data,
  62. })
  63. }
  64. /**
  65. * 查询登录ID
  66. */
  67. export function queryLoginId(config: RequestConfig<{ username: string }> = {}) {
  68. return http.commonRequest<string>({
  69. url: '/User/GetLoginID',
  70. params: config.data,
  71. }, 'GetLoginID')
  72. }
  73. /**
  74. * 查询登录账户配置信息
  75. */
  76. export function queryLoginData(config: RequestConfig<Model.LoginQueryReq> = {}) {
  77. return http.commonRequest<Model.LoginQueryRsp>({
  78. url: '/User/LoginQuery',
  79. params: config.data,
  80. }, 'LoginQuery')
  81. }
  82. /**
  83. * 获取用户账号信息
  84. */
  85. export function queryUserAccount(config: RequestConfig<{ userID: number }> = {}) {
  86. return http.commonRequest<Model.UserAccount>({
  87. url: '/User/GetUserAccount',
  88. params: {
  89. userID: loginStore.userId,
  90. ...config.data
  91. },
  92. }, 'GetUserAccount')
  93. }
  94. /**
  95. * 获取资金账户今日配置信息
  96. */
  97. export function getTodayAccountConfigInfo(config: RequestConfig<Model.TodayAccountConfigInfoReq> = {}) {
  98. return http.commonRequest<Model.TodayAccountConfigInfoRsp>({
  99. url: '/User/GetTodayAccountConfigInfo',
  100. params: {
  101. accountid: accountStore.currentAccountId,
  102. ...config.data
  103. },
  104. })
  105. }
  106. /**
  107. * 查询资金账户信息
  108. */
  109. export function queryTaAccounts(config: RequestConfig<Model.TaAccountsReq> = {}) {
  110. return http.commonRequest<Model.TaAccountsRsp[]>({
  111. url: '/TaAccount/GetTaAccounts',
  112. params: config.data,
  113. }, 'GetTaAccounts')
  114. }
  115. /**
  116. * 查询账户角色
  117. */
  118. export function queryAccountRole(config: RequestConfig = {}) {
  119. return http.commonRequest<Model.UserRole[]>({
  120. url: '/account/role',
  121. params: config.data,
  122. })
  123. }
  124. /**
  125. * 查询实名认证信息
  126. */
  127. export function queryWrDraftUserInfo(config: RequestConfig<Model.WrDraftUserInfoReq> = {}) {
  128. return http.commonRequest<Model.UserInfo[]>({
  129. url: '/WrTrade2/QueryWrDraftUserInfo',
  130. params: config.data,
  131. })
  132. }
  133. /**
  134. * 实名认证请求
  135. */
  136. export function requestAddAuth(config: RequestConfig<Model.AddAuthReq> = {}) {
  137. return http.request<Model.AddAuthRsp>({
  138. method: 'post',
  139. url: service.getConfig('openApiUrl') + '/onlineopen/userInfo/addAuth',
  140. data: config.data,
  141. })
  142. }
  143. /**
  144. * 投资者销户申请
  145. */
  146. export function investorDel(config: RequestConfig<Proto.InvestorDelReq>) {
  147. return http.mqRequest<Proto.InvestorDelRsp>({
  148. data: config.data,
  149. requestCode: 'InvestorDelReq',
  150. responseCode: 'InvestorDelRsp',
  151. })
  152. }
  153. /**
  154. * 修改密码
  155. */
  156. export function modifyPassword(config: RequestConfig<Proto.ModifyPwdReq>) {
  157. return http.mqRequest<Proto.ModifyPwdRsp>({
  158. data: config.data,
  159. requestCode: 'ModifyPwdReq',
  160. responseCode: 'ModifyPwdRsp',
  161. })
  162. }
  163. /**
  164. * 实名认证添加用户
  165. */
  166. export function requestAddUser(config: RequestConfig<Model.AddUserReq> = {}) {
  167. return http.goRequest<Model.AddUserRsp>({
  168. method: 'post',
  169. url: '/Account/AddUser',
  170. data: config.data,
  171. })
  172. }
  173. /**
  174. * 查询用户电子签记录表
  175. */
  176. export function queryUserESignRecord(config: RequestConfig<Model.UserESignRecordReq> = {}) {
  177. return http.goRequest<Model.UserESignRecordRsq[]>({
  178. method: 'get',
  179. url: '/Account/QueryUserESignRecord',
  180. params: config.data,
  181. })
  182. }
  183. /**
  184. * 上传待签署文件和添加签署方
  185. */
  186. export function requestCreateContractAndAddSigner(config: RequestConfig<Model.ContractAndAddSignerReq> = {}) {
  187. return http.goRequest<Model.ContractAndAddSignerRsq>({
  188. method: 'post',
  189. url: '/Account/CreateContractAndAddSigner',
  190. data: config.data,
  191. })
  192. }
  193. /**
  194. * 提交实名认证
  195. */
  196. export function requestSignCompleted(config: RequestConfig<Model.ContractAndAddSignerReq> = {}) {
  197. return http.goRequest<Model.ContractAndAddSignerRsq>({
  198. method: 'post',
  199. url: '/Account/SignCompleted',
  200. data: config.data,
  201. })
  202. }
  203. /**
  204. * 个人意愿核身认证
  205. */
  206. export function requestWillFace(config: RequestConfig<Model.WillFaceReq> = {}) {
  207. return http.goRequest<Model.WillFaceRsq>({
  208. method: 'post',
  209. url: '/Account/WillFace',
  210. data: config.data,
  211. })
  212. }
  213. /**
  214. * 证件号重复校验
  215. */
  216. export function requestCheckCardNum(config: RequestConfig<Model.CheckCardNumReq> = {}) {
  217. return http.request<Model.CheckCardNumRsp>({
  218. method: 'get',
  219. url: service.getConfig('openApiUrl') + '/onlineopen/userInfo/checkCardNum',
  220. params: {
  221. userid: loginStore.userId,
  222. ...config.data
  223. },
  224. })
  225. }
  226. /**
  227. * 查询用户电子签记录表
  228. */
  229. export function queryTencentUsereSignRecords(config: RequestConfig<Model.TencentUsereSignRecordsReq> = {}) {
  230. return http.commonRequest<Model.TencentUsereSignRecordsRsq[]>({
  231. method: 'get',
  232. url: '/Tencent/QueryUsereSignRecords',
  233. params: config.data,
  234. }, 'QueryUsereSignRecords')
  235. }
  236. /**
  237. * 通过合同名和模板 id 直接发起签署流程
  238. */
  239. export function requestCreateFlowByTemplateDirectly(config: RequestConfig<Model.CreateFlowByTemplateDirectlyReq> = {}) {
  240. return http.commonRequest<Model.CreateFlowByTemplateDirectlyRsq>({
  241. method: 'post',
  242. url: '/Tencent/CreateFlowByTemplateDirectly',
  243. data: config.data,
  244. }, 'CreateFlowByTemplateDirectly')
  245. }
  246. /**
  247. * 按用户 ID 和机构 ID 创建腾讯电子签业务信息
  248. */
  249. export function requestInitTencentESS(config: RequestConfig<Model.InitTencentESSReq> = {}) {
  250. return http.commonRequest<Model.InitTencentESSRsp>({
  251. method: 'post',
  252. url: '/Tencent/InitTencentESS',
  253. data: config.data,
  254. })
  255. }
  256. /**
  257. * 银行卡四要素认证
  258. */
  259. export function requestBankCard4(config: RequestConfig<Model.BankCard4Req> = {}) {
  260. return http.commonRequest<Model.BankCard4Rsp>({
  261. method: 'post',
  262. url: '/Asign/BankCard4',
  263. data: config.data,
  264. })
  265. }
  266. /**
  267. * 重新发送认证验证码
  268. * 在实名认证的过程中,因用户手机原因未收到短信验证码或原验证码超过15分钟有效期而过期时,可以调用此接口重新发送短信验证码。若1分钟内多次调用此接口,则仅会发送一次短信验证码,15分钟内重新发送短信验证码不会变化。
  269. */
  270. export function requestCaptcaResend(config: RequestConfig<Model.CaptcaResendReq> = {}) {
  271. return http.commonRequest<string>({
  272. method: 'post',
  273. url: '/Asign/CaptcaResend',
  274. data: config.data,
  275. })
  276. }
  277. /**
  278. * 认证验证码校验
  279. * 验证码认证成功后会调用爱签添加用户接口,同时调用交易系统JAVA实名认证接口
  280. */
  281. export function requestCaptchaVerify(config: RequestConfig<Model.CaptchaVerifyReq> = {}) {
  282. return http.commonRequest<string>({
  283. method: 'post',
  284. url: '/Asign/CaptchaVerify',
  285. data: config.data,
  286. })
  287. }