智盟项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.7 KiB

  1. package zhimeng_platform
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. sms2 "applet/app/lib/sms"
  6. "applet/app/svc/platform"
  7. "applet/app/utils"
  8. "encoding/json"
  9. "fmt"
  10. "github.com/gin-gonic/gin"
  11. "github.com/syyongx/php2go"
  12. "math/rand"
  13. "time"
  14. )
  15. func WithdrawalIncome(c *gin.Context) {
  16. platform.WithdrawalIncome(c)
  17. }
  18. func WithdrawalList(c *gin.Context) {
  19. platform.WithdrawalList(c)
  20. }
  21. func WithdrawalDoing(c *gin.Context) {
  22. platform.WithdrawalDoing(c)
  23. }
  24. func WithdrawalOutput(c *gin.Context) {
  25. platform.WithdrawalOutput(c)
  26. }
  27. func WithdrawalInvoiceImg(c *gin.Context) {
  28. platform.WithdrawalInvoiceImg(c)
  29. }
  30. func WithdrawalBindAlipay(c *gin.Context) {
  31. platform.WithdrawalBindAlipay(c)
  32. }
  33. func Sms(c *gin.Context) {
  34. if c.GetString("is_system") == "" {
  35. e.OutErr(c, 400, e.NewErr(400, "请重新在后台进入聚合联盟"))
  36. return
  37. }
  38. if c.GetString("is_system") != "1" {
  39. e.OutErr(c, 400, e.NewErr(400, "请使用超管账号设置"))
  40. return
  41. }
  42. appName := db.SysCfgGet(c, "sms_push_sign")
  43. captcha := createCaptcha()
  44. content := fmt.Sprintf("【%s】验证码:%s", appName, captcha)
  45. templateCode := ""
  46. marshal, _ := json.Marshal(c.Request.Header)
  47. waykeys := "zhimeng_" + c.ClientIP() + "_" + utils.IntToStr(utils.GetApiVersion(c)) + "_" + c.Request.RequestURI + "_" + string(marshal)
  48. postData := map[string]interface{}{
  49. "content": content,
  50. "mobile": c.GetString("phone"),
  51. "templateCode": templateCode,
  52. "way": php2go.Base64Encode(waykeys),
  53. }
  54. err := sms2.GetSmsConfig(c, "86", postData)
  55. if err != nil {
  56. e.OutErr(c, 400, err.Error())
  57. return
  58. }
  59. e.OutSuc(c, "success", nil)
  60. return
  61. }
  62. func createCaptcha() string {
  63. return fmt.Sprintf("%05v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000))
  64. }