添source_type字段(券的来源:1-vip获得,2-认证获得,3-拉新获得),用来判断券的来源,
userinfo接口返回企业统一社会信用代码和营业执照路径
This commit is contained in:
+10
-13
@@ -137,8 +137,8 @@ var CompanyCtr = Ctr{
|
||||
}
|
||||
|
||||
//统一社会信用代码
|
||||
code := that.Req.FormValue("social_code")
|
||||
if code == "" {
|
||||
social_code := that.Req.FormValue("social_code")
|
||||
if social_code == "" {
|
||||
that.Display(3, "请求参数异常")
|
||||
return
|
||||
}
|
||||
@@ -162,10 +162,10 @@ var CompanyCtr = Ctr{
|
||||
}
|
||||
//营业执照路径
|
||||
business_license := that.Req.FormValue("business_license")
|
||||
//if business_license == ""{
|
||||
// that.Display(3, "请求参数异常")
|
||||
// return
|
||||
//}
|
||||
if business_license == "" {
|
||||
that.Display(3, "请求参数异常")
|
||||
return
|
||||
}
|
||||
user_id := that.Session("user_id").Data
|
||||
user := that.Db.Get("user", "*", Map{"id": user_id})
|
||||
if user == nil {
|
||||
@@ -186,7 +186,7 @@ var CompanyCtr = Ctr{
|
||||
|
||||
that.Db.Update("user", Map{"name": name, "phone": phone, "authentication_flag": authentication_flag}, Map{"id": user_id})
|
||||
|
||||
that.Db.Update("company", Map{"code": code, "name": company_name, "phone": phone, "business_license": business_license, "modify_time[#]": "now()"}, Map{"id": id})
|
||||
that.Db.Update("company", Map{"social_code": social_code, "name": company_name, "phone": phone, "business_license": business_license, "modify_time[#]": "now()"}, Map{"id": id})
|
||||
|
||||
//赠送一张券
|
||||
data := Map{
|
||||
@@ -195,19 +195,16 @@ var CompanyCtr = Ctr{
|
||||
"code_no": "SN" + time.Now().Format("20060102150405") + getSn(),
|
||||
"effective_start_time[#]": "NOW()",
|
||||
"effective_end_time": "2022-10-01 23:59:59",
|
||||
"source_type": 2,
|
||||
"status": 0,
|
||||
"admin_id": user.GetCeilInt("admin_id"),
|
||||
"create_time[#]": "NOW()",
|
||||
}
|
||||
//先判断是否领取过
|
||||
couponCount := that.Db.Count("coupon_user", Map{"user_id": user_id})
|
||||
//先判断是否领取过 source_type=2 是通过认证赠送的券
|
||||
couponCount := that.Db.Count("coupon_user", Map{"AND": Map{"user_id": user_id, "source_type": 2}})
|
||||
if couponCount == 0 {
|
||||
that.Db.Insert("coupon_user", data)
|
||||
}
|
||||
//不为0但是是10的倍数,说明是vip,也应该给一张
|
||||
if couponCount != 0 && couponCount%10 == 0 {
|
||||
that.Db.Insert("coupon_user", data)
|
||||
}
|
||||
|
||||
that.Display(0, "认证成功")
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user