|
@@ -6,18 +6,39 @@ import (
|
|
|
)
|
|
|
|
|
|
type CygxApplyRecord struct {
|
|
|
- ApplyRecordId int `orm:"column(apply_record_id);pk" description:"申请试用id"`
|
|
|
- BusinessCardUrl string `description:"名片地址"`
|
|
|
- RealName string `description:"姓名"`
|
|
|
- CompanyName string `description:"公司名称"`
|
|
|
- CompanyNamePay string `description:"公司名称"`
|
|
|
- Mobile string `description:"手机号"`
|
|
|
- CreateTime time.Time `description:"创建时间"`
|
|
|
- ApplyMethod int `description:"1:已付费客户申请试用,2:非客户申请试用"`
|
|
|
- RegisterPlatform int `description:"来源 1小程序,2:网页"`
|
|
|
+ ApplyRecordId int `orm:"column(apply_record_id);pk" description:"申请试用id"`
|
|
|
+ UserId int `description:"用户ID"`
|
|
|
+ BusinessCardUrl string `description:"名片地址"`
|
|
|
+ RealName string `description:"姓名"`
|
|
|
+ CompanyName string `description:"公司名称"`
|
|
|
+ CompanyIdPay int `description:"已付费客户公司id"`
|
|
|
+ CompanyIdType int `description:"用户状态,1:潜在客户 、2:现有客户 、3:FICC客户 、4:现有客户(正式,无对应权限) 、5:现有客户(试用,无对应权限) 、6:现有客户(试用暂停) 、7:现有客户(冻结) 、8:现有客户(流失) "`
|
|
|
+ CompanyNamePay string `description:"公司名称"`
|
|
|
+ Mobile string `description:"手机号"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ApplyMethod int `description:"1:已付费客户申请试用,2:非客户申请试用"`
|
|
|
+ RegisterPlatform int `description:"来源 1小程序,2:网页"`
|
|
|
+ InviteCompanySource int `description:"来源 1小程序,2:网页"`
|
|
|
}
|
|
|
|
|
|
-func AddApplyRecord(item *ApplyTryReq, mobile, companyNamePay string, userId, companyIdPay, CompanyIdType int) (err error) {
|
|
|
+type CygxApplyRecordResp struct {
|
|
|
+ ApplyRecordId int `orm:"column(apply_record_id);pk" description:"申请试用id"`
|
|
|
+ UserId int `description:"用户ID"`
|
|
|
+ BusinessCardUrl string `description:"名片地址"`
|
|
|
+ RealName string `description:"姓名"`
|
|
|
+ CompanyName string `description:"公司名称"`
|
|
|
+ CompanyIdPay int `description:"已付费客户公司id"`
|
|
|
+ CompanyIdType int `description:"用户状态,1:潜在客户 、2:现有客户 、3:FICC客户 、4:现有客户(正式,无对应权限) 、5:现有客户(试用,无对应权限) 、6:现有客户(试用暂停) 、7:现有客户(冻结) 、8:现有客户(流失) "`
|
|
|
+ CompanyNamePay string `description:"公司名称"`
|
|
|
+ Mobile string `description:"手机号"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ApplyMethod int `description:"1:已付费客户申请试用,2:非客户申请试用"`
|
|
|
+ RegisterPlatform int `description:"来源 1小程序,2:网页"`
|
|
|
+ InviteCompanySource int `description:"三方来源 ,1:弘则本身,2:络町"`
|
|
|
+ ApplicationSource string `description:"申请来源"`
|
|
|
+}
|
|
|
+
|
|
|
+func AddApplyRecordold(item *ApplyTryReq, mobile, companyNamePay string, userId, companyIdPay, CompanyIdType int) (err error) {
|
|
|
o, err := orm.NewOrm().Begin()
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -48,6 +69,34 @@ func AddApplyRecord(item *ApplyTryReq, mobile, companyNamePay string, userId, co
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func AddApplyRecord(item *CygxApplyRecord) (err error) {
|
|
|
+ o, err := orm.NewOrm().Begin()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ o.Rollback()
|
|
|
+ } else {
|
|
|
+ o.Commit()
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ _, err = o.Insert(item)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ msql := `UPDATE wx_user
|
|
|
+ SET
|
|
|
+ note = ?,
|
|
|
+ is_note = 1,
|
|
|
+ apply_method = ?,
|
|
|
+ real_name=?,
|
|
|
+ mobile=?
|
|
|
+ WHERE user_id = ? `
|
|
|
+ _, err = o.Raw(msql, item.CompanyName, item.ApplyMethod, item.RealName, item.Mobile, item.UserId).Exec()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetApplyRecordCount(userId int) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT COUNT(1) AS count FROM cygx_apply_record WHERE user_id=? AND status=0 `
|
|
@@ -64,13 +113,13 @@ func GetCygxApplyRecordByMobile(mobile string) (item *CygxApplyRecord, err error
|
|
|
}
|
|
|
|
|
|
// 通过ID获取详情
|
|
|
-func GetCygxApplyRecordById(applyRecordId int) (item *CygxApplyRecord, err error) {
|
|
|
+func GetCygxApplyRecordById(applyRecordId int) (item *CygxApplyRecordResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT * FROM cygx_apply_record WHERE apply_record_id=? `
|
|
|
err = o.Raw(sql, applyRecordId).QueryRow(&item)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-type CygxApplyRecordResp struct {
|
|
|
- Detail *CygxApplyRecord
|
|
|
+type CygxApplyRecordDetialResp struct {
|
|
|
+ Detail *CygxApplyRecordResp
|
|
|
}
|