package api import ( butil "enterprise/base/util" "enterprise/common/model" "fmt" "github.com/skip2/go-qrcode" "github.com/smbrave/goutil" "github.com/spf13/cast" ) type StaffLoginReq struct { Username string `json:"username"` Password string `json:"password"` } type StaffUser struct { Id string `json:"id"` Phone string `json:"phone"` Idno string `json:"idno"` Username string `json:"username"` Realname string `json:"realname"` EntryDate string `json:"entry_date"` OfficialDate string `json:"official_date"` LeaveDate string `json:"leave_date"` Status string `json:"status"` SalaryBase string `json:"salary_base"` SalaryTarget string `json:"salary_target"` SalaryCalculator string `json:"salary_calculator"` SalaryCalculatorName string `json:"salary_calculator_name"` PayeeBankName string `json:"payee_bank_name"` PayeeBankCard string `json:"payee_bank_card"` PayeeAlipayUid string `json:"payee_alipay_uid"` PayeeAlipayAuthUrl string `json:"payee_alipay_auth_url"` PayeeAlipayAuthQrcode string `json:"payee_alipay_auth_qrcode"` Config interface{} `json:"config"` } type StaffListReq struct { BaseRequest Status string `form:"status"` Phone string `form:"phone"` Idno string `form:"idno"` Username string `form:"username"` Realname string `form:"realname"` } type StaffCreateReq struct { Username string `json:"username"` } type StaffUpdateReq struct { Id string `json:"id"` Phone string `json:"phone"` Idno string `json:"idno"` Username string `json:"username"` Realname string `json:"realname"` EntryDate string `json:"entry_date"` OfficialDate string `json:"official_date"` LeaveDate string `json:"leave_date"` Status string `json:"status"` SalaryBase string `json:"salary_base"` SalaryTarget string `json:"salary_target"` SalaryCalculator string `json:"salary_calculator"` PayeeBankName string `json:"payee_bank_name"` PayeeBankCard string `json:"payee_bank_card"` PayeeAlipayUid string `json:"payee_alipay_uid"` Config map[string]string `json:"config"` } func (s *StaffUser) From(m *model.StaffUser) { goutil.CopyStruct(s, m) s.Id = cast.ToString(m.Id) s.Status = cast.ToString(m.Status) salary := m.GetSalary() payee := m.GetPayee() s.SalaryBase = salary.Base s.SalaryTarget = salary.Target s.SalaryCalculator = salary.Calculator s.PayeeBankName = payee.BankName s.PayeeBankCard = payee.BankCard s.PayeeAlipayUid = payee.AlipayUid s.PayeeAlipayAuthUrl = fmt.Sprintf("https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=2021004108682468&scope=auth_base&state=%d&redirect_uri=https://e.batiao8.com/api/payment/auth/alipay", m.Id) s.PayeeAlipayAuthQrcode, _ = butil.CreateQrcodeBase64V2(s.PayeeAlipayAuthUrl, qrcode.Low, 300) }