wcj 5 年之前
父節點
當前提交
dd026b9b23

+ 1 - 1
src/jfw/modules/entniche/src/service/person/person.go

@@ -93,7 +93,7 @@ func (a *Action) Add() {
 	status, user_id := func() (int, int64) {
 		if VarUser.AddIsExists(entId, phone) {
 			return -1, 0
-		} else if Mysql.CountBySql(`SELECT count(1) from entniche_user where phone=?`, phone) >= Config.UserInEntLimit {
+		} else if Mysql.CountBySql(`SELECT count(1) as count from entniche_user where phone=?`, phone) >= Config.UserInEntLimit {
 			return -2, 0
 		}
 		var user_id int64

+ 12 - 2
src/jfw/modules/entniche/src/service/service.go

@@ -11,8 +11,9 @@ import (
 
 type Action struct {
 	*xweb.Action
-	move xweb.Mapper `xweb:"/move"`   //人员或者部门移动
-	del  xweb.Mapper `xweb:"/delete"` //人员或者部门删除
+	move       xweb.Mapper `xweb:"/move"`       //人员或者部门移动
+	del        xweb.Mapper `xweb:"/delete"`     //人员或者部门删除
+	whetherbuy xweb.Mapper `xweb:"/whetherbuy"` //是否购买过
 }
 
 func (a *Action) Move() {
@@ -57,3 +58,12 @@ func (a *Action) Del() {
 	}
 	a.ServeJson(Result{Data: M{"status": status}})
 }
+func (a *Action) Whetherbuy() {
+	userId, _ := a.GetSession("userId").(string)
+	phone := VarCurrentUser.Phone(userId)
+	status := 0
+	if Mysql.CountBySql("select count(1) as count from entniche_user where phone=?", phone) > 0 {
+		status = 1
+	}
+	a.ServeJson(Result{Data: M{"status": status}})
+}