广告平台(站长下代理使用)
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

svc_qualification.go 6.7 KiB

2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
2 mesi fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. package svc
  2. import (
  3. "applet/app/e"
  4. "applet/app/md"
  5. "applet/app/utils"
  6. db "code.fnuoos.com/zhimeng/model.git/src"
  7. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  8. model2 "code.fnuoos.com/zhimeng/model.git/src/super/model"
  9. "github.com/gin-gonic/gin"
  10. "github.com/jinzhu/copier"
  11. "time"
  12. )
  13. func QualificationInfo(c *gin.Context) {
  14. admin := GetUser(c)
  15. AgentListDb := implement.NewAgentListDb(db.Db)
  16. Agent, _ := AgentListDb.GetAgentList(admin.AgentId)
  17. if Agent == nil {
  18. Agent = &model2.AgentList{Uuid: utils.StrToInt(c.GetString("mid")), AgentId: admin.AgentId}
  19. }
  20. var AgentNew md.AgentList
  21. copier.Copy(&AgentNew, &Agent)
  22. AgentNew.Id = utils.IntToStr(Agent.Id)
  23. AgentNew.Uuid = utils.IntToStr(Agent.Uuid)
  24. AgentNew.AgentId = utils.IntToStr(Agent.AgentId)
  25. AgentNew.Kind = utils.IntToStr(Agent.Kind)
  26. AgentNew.CertificateType = utils.IntToStr(Agent.CertificateType)
  27. AgentNew.CertificateFirstType = utils.IntToStr(Agent.CertificateFirstType)
  28. AgentNew.CountryRegionId = utils.IntToStr(Agent.CountryRegionId)
  29. AgentNew.RegisteredAddressCountryId = utils.IntToStr(Agent.RegisteredAddressCountryId)
  30. AgentNew.RegisteredAddressProvinceId = utils.IntToStr(Agent.RegisteredAddressProvinceId)
  31. AgentNew.RegisteredAddressCountyId = utils.IntToStr(Agent.RegisteredAddressCountyId)
  32. AgentNew.RegisteredAddressCityId = utils.IntToStr(Agent.RegisteredAddressCityId)
  33. AgentNew.State = utils.IntToStr(Agent.State)
  34. enterprise := map[string]interface{}{
  35. "state": AgentNew.State,
  36. "data": AgentNew,
  37. }
  38. NewAgentBankInfoDb := implement.NewAgentBankInfoDb(db.Db)
  39. bank, _ := NewAgentBankInfoDb.GetAgentBankInfoList(admin.AgentId)
  40. if bank == nil {
  41. bank = &model2.AgentBankInfo{Uuid: Agent.Uuid, AgentId: Agent.AgentId}
  42. }
  43. var bankNew md.AgentBankInfo
  44. copier.Copy(&bankNew, &bank)
  45. bankNew.State = utils.IntToStr(bank.State)
  46. bankNew.Id = utils.IntToStr(bank.Id)
  47. bankNew.Uuid = utils.IntToStr(bank.Uuid)
  48. bankNew.AgentId = utils.IntToStr(bank.AgentId)
  49. bankNew.CurrencyConf = utils.IntToStr(bank.CurrencyConf)
  50. bankInfo := map[string]interface{}{
  51. "state": bankNew.State,
  52. "data": bankNew,
  53. }
  54. NewAgentContactInfoDb := implement.NewAgentContactInfoDb(db.Db)
  55. contact, _ := NewAgentContactInfoDb.GetAgentContactInfoList(admin.AgentId)
  56. if contact == nil {
  57. contact = &model2.AgentContactInfo{Uuid: Agent.Uuid, AgentId: Agent.AgentId}
  58. }
  59. var contactNew md.AgentContactInfo
  60. copier.Copy(&contactNew, &contact)
  61. contactNew.State = utils.IntToStr(contact.State)
  62. contactNew.Id = utils.IntToStr(contact.Id)
  63. contactNew.Uuid = utils.IntToStr(contact.Uuid)
  64. contactNew.AgentId = utils.IntToStr(contact.AgentId)
  65. contactInfo := map[string]interface{}{
  66. "state": contactNew.State,
  67. "data": contactNew,
  68. }
  69. res := map[string]interface{}{
  70. "enterprise": enterprise,
  71. "bank_info": bankInfo,
  72. "contact_info": contactInfo,
  73. "state_list": []map[string]interface{}{
  74. {"value": "0", "name": "待提交"},
  75. {"value": "1", "name": "待审核"},
  76. {"value": "2", "name": "审核通过"},
  77. {"value": "3", "name": "审核拒绝"},
  78. },
  79. }
  80. e.OutSuc(c, res, nil)
  81. return
  82. }
  83. func QualificationSelectBase(c *gin.Context) {
  84. countryDb := implement.NewCountryDb(db.Db)
  85. country := countryDb.FindAll()
  86. IdcardTypeListDb := implement.NewIdcardTypeListDb(db.Db)
  87. IdcardTypeList := IdcardTypeListDb.FindAll()
  88. res := map[string]interface{}{
  89. "register_area": country,
  90. "idcard_type": IdcardTypeList,
  91. "country": []map[string]interface{}{
  92. {
  93. "value": "1", "name": "中国/国内",
  94. },
  95. },
  96. "user_type": []map[string]interface{}{
  97. {
  98. "value": "1", "name": "企业",
  99. },
  100. },
  101. "currency_conf": []map[string]interface{}{
  102. {
  103. "value": "0", "name": "人民币",
  104. },
  105. },
  106. }
  107. e.OutSuc(c, res, nil)
  108. return
  109. }
  110. func QualificationEnterpriseSave(c *gin.Context, req md.AgentList) error {
  111. req.State = "1"
  112. var data model2.AgentList
  113. copier.Copy(&data, &req)
  114. data.UpdateAt = time.Now().Format("2006-01-02 15:04:05")
  115. data.Id = utils.StrToInt(req.Id)
  116. data.Uuid = utils.StrToInt(req.Uuid)
  117. data.AgentId = utils.StrToInt(req.AgentId)
  118. data.Kind = utils.StrToInt(req.Kind)
  119. data.CertificateType = utils.StrToInt(req.CertificateType)
  120. data.CertificateFirstType = utils.StrToInt(req.CertificateFirstType)
  121. data.CountryRegionId = utils.StrToInt(req.CountryRegionId)
  122. data.RegisteredAddressCountryId = utils.StrToInt(req.RegisteredAddressCountryId)
  123. data.RegisteredAddressProvinceId = utils.StrToInt(req.RegisteredAddressProvinceId)
  124. data.RegisteredAddressCountyId = utils.StrToInt(req.RegisteredAddressCountyId)
  125. data.RegisteredAddressCityId = utils.StrToInt(req.RegisteredAddressCityId)
  126. data.State = utils.StrToInt(req.State)
  127. if utils.StrToInt(req.Id) > 0 {
  128. listDb := implement.NewAgentListDb(db.Db)
  129. list, _ := listDb.GetAgentList(utils.StrToInt(req.AgentId))
  130. if list.State == 1 {
  131. return e.NewErr(400, "该记录已提交审核")
  132. }
  133. if list.State == 2 {
  134. return e.NewErr(400, "该记录已审核通过")
  135. }
  136. db.Db.Where("id=?", req.Id).Update(&data)
  137. } else {
  138. data.CreateAt = time.Now().Format("2006-01-02 15:04:05")
  139. db.Db.InsertOne(&data)
  140. }
  141. return nil
  142. }
  143. func QualificationBankSave(c *gin.Context, req md.AgentBankInfo) error {
  144. req.State = "1"
  145. var data model2.AgentBankInfo
  146. copier.Copy(&data, &req)
  147. data.State = utils.StrToInt(req.State)
  148. data.Id = utils.StrToInt(req.Id)
  149. data.Uuid = utils.StrToInt(req.Uuid)
  150. data.AgentId = utils.StrToInt(req.AgentId)
  151. data.CurrencyConf = utils.StrToInt(req.CurrencyConf)
  152. data.UpdateAt = time.Now().Format("2006-01-02 15:04:05")
  153. if utils.StrToInt(req.Id) > 0 {
  154. listDb := implement.NewAgentBankInfoDb(db.Db)
  155. list, _ := listDb.GetAgentBankInfoList(utils.StrToInt(req.AgentId))
  156. if list.State == 1 {
  157. return e.NewErr(400, "该记录已提交审核")
  158. }
  159. if list.State == 2 {
  160. return e.NewErr(400, "该记录已审核通过")
  161. }
  162. db.Db.Where("id=?", req.Id).Update(&data)
  163. } else {
  164. data.CreateAt = time.Now().Format("2006-01-02 15:04:05")
  165. db.Db.InsertOne(&data)
  166. }
  167. return nil
  168. }
  169. func QualificationContactSave(c *gin.Context, req md.AgentContactInfo) error {
  170. req.State = "1"
  171. var data model2.AgentContactInfo
  172. copier.Copy(&data, &req)
  173. data.State = utils.StrToInt(req.State)
  174. data.Id = utils.StrToInt(req.Id)
  175. data.Uuid = utils.StrToInt(req.Uuid)
  176. data.AgentId = utils.StrToInt(req.AgentId)
  177. data.UpdateAt = time.Now().Format("2006-01-02 15:04:05")
  178. if utils.StrToInt(req.Id) > 0 {
  179. listDb := implement.NewAgentContactInfoDb(db.Db)
  180. list, _ := listDb.GetAgentContactInfoList(utils.StrToInt(req.AgentId))
  181. if list.State == 1 {
  182. return e.NewErr(400, "该记录已提交审核")
  183. }
  184. if list.State == 2 {
  185. return e.NewErr(400, "该记录已审核通过")
  186. }
  187. db.Db.Where("id=?", req.Id).Update(&data)
  188. } else {
  189. data.CreateAt = time.Now().Format("2006-01-02 15:04:05")
  190. db.Db.InsertOne(&data)
  191. }
  192. return nil
  193. }