service.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. package service
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "log"
  6. "strconv"
  7. "strings"
  8. "time"
  9. "context"
  10. "app.yhyue.com/moapp/jybase/mongodb"
  11. . "bp.jydev.jianyu360.cn/BaseService/entManageApplication/entity"
  12. "bp.jydev.jianyu360.cn/BaseService/entManageApplication/rpc/entmanageapplication"
  13. "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
  14. // "github.com/zeromicro/go-zero/core/logx"
  15. "app.yhyue.com/moapp/jybase/common"
  16. "app.yhyue.com/moapp/jybase/redis"
  17. )
  18. func AddUsePerson(this *entmanageapplication.AddUsePersonReq) *entmanageapplication.AddUsePersonResp {
  19. timeStr, ok, id, msg, code := time.Now().Format("2006-01-02 15:04:05"), false, int64(0), "", int64(0)
  20. UserArr := strings.Split(this.EntUserId, ",")
  21. sourceData := JyMysql.FindOne(EntnicheWaitEmpower, map[string]interface{}{"id": this.WaitEmpowerId}, "", "")
  22. if sourceData != nil && len(*sourceData) > 0 {
  23. empower_count := common.IntAll((*sourceData)["empower_count"])
  24. use_count := common.IntAll((*sourceData)["use_count"])
  25. if empower_count-use_count < len(UserArr) {
  26. msg = "购买数量不足"
  27. code = int64(-1)
  28. } else {
  29. for _, v := range UserArr {
  30. entUserId, _ := strconv.Atoi(v)
  31. data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, "", "")
  32. if data != nil && len(*data) > 0 {
  33. dataStatus := common.IntAll((*data)["status"])
  34. if dataStatus == -1 {
  35. ok = JyMysql.Update(EntnichePower, map[string]interface{}{"ent_user_id": entUserId}, map[string]interface{}{"wait_empower_id": this.WaitEmpowerId, "status": 1, "update_time": timeStr})
  36. } else {
  37. msg = "人员已经拥有权限,请先删除原有权限"
  38. code = int64(-1)
  39. break
  40. }
  41. } else {
  42. id = JyMysql.Insert(EntnichePower, map[string]interface{}{
  43. "wait_empower_id": this.WaitEmpowerId,
  44. "ent_id": this.EntId,
  45. "ent_user_id": entUserId,
  46. "status": 1,
  47. "create_time": timeStr,
  48. "update_time": timeStr,
  49. })
  50. }
  51. JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count + 1 where id = ?`, this.WaitEmpowerId)
  52. addPower(this.WaitEmpowerId, entUserId)
  53. }
  54. }
  55. }
  56. status := 0
  57. if ok || id > 0 {
  58. status = 1
  59. }
  60. return &entmanageapplication.AddUsePersonResp{
  61. ErrorCode: code,
  62. ErrorMsg: msg,
  63. Data: &entmanageapplication.AddUsePerson{Status: int64(status)},
  64. }
  65. }
  66. func DelUsePerson(this *entmanageapplication.DelUsePersonReq) *entmanageapplication.AddUsePersonResp {
  67. timeStr := time.Now().Format("2006-01-02 15:04:05")
  68. ok := JyMysql.Update(EntnichePower, map[string]interface{}{"id": this.EntnichePowerId},
  69. map[string]interface{}{"status": -1, "update_time": timeStr})
  70. delPower(this.EntnichePowerId)
  71. status := 0
  72. if ok {
  73. status = 1
  74. }
  75. return &entmanageapplication.AddUsePersonResp{
  76. ErrorCode: 0,
  77. Data: &entmanageapplication.AddUsePerson{Status: int64(status)},
  78. }
  79. }
  80. func UsePersonList(this *entmanageapplication.UsePersonListReq) *entmanageapplication.UsePersonListResp {
  81. data := JyMysql.SelectBySql(`select a.id,a.wait_empower_id,c.name,c.phone,c.mail,g.name as department,e.name as role from entniche_power a
  82. INNER JOIN entniche_user c on (a.ent_user_id=c.id and a.ent_id = c.ent_id)
  83. LEFT JOIN entniche_user_role d on (c.id=d.user_id)
  84. LEFT JOIN entniche_role e on (d.role_id=e.id)
  85. LEFT JOIN entniche_department_user f on (a.ent_user_id=f.user_id)
  86. LEFT JOIN entniche_department g on (g.id=f.dept_id)
  87. where a.status = 1 and a.ent_id = ?
  88. order by a.update_time desc`, this.EntId)
  89. arr := []*entmanageapplication.UsePersonList{}
  90. if data != nil && len(*data) > 0 {
  91. for _, v := range *data {
  92. wait_empower_id := common.Int64All(v["wait_empower_id"])
  93. if wait_empower_id == this.WaitEmpowerId {
  94. obj := &entmanageapplication.UsePersonList{
  95. EntnichePowerId: common.Int64All(v["id"]),
  96. Name: common.ObjToString(v["name"]),
  97. Phone: common.ObjToString(v["phone"]),
  98. Email: common.ObjToString(v["mail"]),
  99. Department: common.ObjToString(v["department"]),
  100. Role: common.ObjToString(v["role"]),
  101. Status: 1,
  102. }
  103. arr = append(arr, obj)
  104. } else {
  105. obj := &entmanageapplication.UsePersonList{
  106. EntnichePowerId: common.Int64All(v["id"]),
  107. Name: common.ObjToString(v["name"]),
  108. Phone: common.ObjToString(v["phone"]),
  109. Email: common.ObjToString(v["mail"]),
  110. Department: common.ObjToString(v["department"]),
  111. Role: common.ObjToString(v["role"]),
  112. Status: 2,
  113. }
  114. arr = append(arr, obj)
  115. }
  116. }
  117. }
  118. return &entmanageapplication.UsePersonListResp{
  119. ErrorCode: 0,
  120. Data: arr,
  121. }
  122. }
  123. func BuyProductList(this *entmanageapplication.BuyProductListReq) *entmanageapplication.BuyProductListResp {
  124. data := JyMysql.Find(EntnicheWaitEmpower, map[string]interface{}{"ent_id": this.EntId}, "", "create_time desc", 0, 0)
  125. arr := []*entmanageapplication.BuyProductList{}
  126. if data != nil && len(*data) > 0 {
  127. for _, v := range *data {
  128. product_type := common.ObjToString(v["product_type"])
  129. if product_type == "VIP订阅" {
  130. product_type = "超级订阅"
  131. }
  132. obj := &entmanageapplication.BuyProductList{
  133. WaitEmpowerId: common.Int64All(v["id"]),
  134. ProductType: product_type,
  135. UseCount: common.Int64All(v["use_count"]),
  136. EmpowerCount: common.Int64All(v["empower_count"]),
  137. ProvinceCount: common.Int64All(v["province_count"]),
  138. EndTime: common.ObjToString(v["end_time"]),
  139. }
  140. arr = append(arr, obj)
  141. }
  142. }
  143. return &entmanageapplication.BuyProductListResp{
  144. ErrorCode: 0,
  145. Data: arr,
  146. }
  147. }
  148. func addPower(waitEmpowerId int64, entUserId int) {
  149. data := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
  150. if data != nil && len(*data) > 0 {
  151. orderId := common.Int64All((*data)["order_id"])
  152. orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
  153. if orderData != nil && len(*orderData) > 0 {
  154. productType := common.ObjToString((*orderData)["product_type"])
  155. userId := getUserId(entUserId)
  156. if productType == "VIP订阅" {
  157. log.Println("开通超级订阅", userId)
  158. openPowerVip(*orderData, userId)
  159. } else if productType == "大会员" {
  160. log.Println("开通大会员", userId)
  161. openPowerBig(*orderData, userId)
  162. }
  163. }
  164. }
  165. }
  166. func openPowerBig(orderData map[string]interface{}, userId string) bool {
  167. filterMap := common.ObjToMap(orderData["filter"])
  168. startTime := common.ObjToString(orderData["vip_starttime"])
  169. endTime := common.ObjToString(orderData["vip_endtime"])
  170. tmp := "2006-01-02 15:04:05"
  171. startdate, _ := time.ParseInLocation(tmp, startTime, time.Local)
  172. enddate, _ := time.ParseInLocation(tmp, endTime, time.Local)
  173. level := common.IntAll((*filterMap)["level"])
  174. comboId := common.IntAll((*filterMap)["comboId"])
  175. payCycle := common.IntAll((*filterMap)["payCycle"])
  176. serversId := common.ObjToString((*filterMap)["serversId"])
  177. serverMap := GetServerPid()
  178. dataType := 1
  179. if startdate.Unix() > time.Now().Unix() {
  180. dataType = 2
  181. }
  182. sets := map[string]interface{}{
  183. "i_member_status": common.If(dataType == 1, level, -level),
  184. "i_member_starttime": startdate.Unix(),
  185. "i_member_endtime": enddate.Unix(),
  186. "i_mainaccount": 1,
  187. "o_member_jy.i_wxpush": 1,
  188. }
  189. set := map[string]interface{}{
  190. "$set": sets,
  191. }
  192. ok := Mgo.UpdateById("user", userId, set)
  193. if !ok {
  194. log.Println("大会员创建订单user表大会员状态更新失败")
  195. }
  196. if comboId != 0 {
  197. datas := JyMysql.FindOne("bigmember_combo", map[string]interface{}{"id": comboId}, "", "")
  198. if datas == nil || len(*datas) == 0 {
  199. log.Println("未找到此套餐")
  200. return false
  201. }
  202. s_servers := common.ObjToString((*datas)["s_servers"])
  203. for _, s := range strings.Split(s_servers, ",") {
  204. serverId, _ := strconv.Atoi(s)
  205. mainId := serverId
  206. if serverMap[serverId] != 0 {
  207. serverId = serverMap[serverId]
  208. }
  209. serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
  210. frequency := 0
  211. if serverData != nil && len(*serverData) > 0 {
  212. if serverId == 11 || serverId == 15 {
  213. if serverId == 15 {
  214. if payCycle >= 12 {
  215. frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
  216. } else {
  217. frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
  218. }
  219. } else {
  220. frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
  221. }
  222. } else {
  223. frequency = common.IntAll((*serverData)["s_count_month"])
  224. }
  225. }
  226. sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and i_status = -1"
  227. serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
  228. if serverDatas != nil && len(*serverDatas) > 0 {
  229. i_status := common.If(dataType == 1, 0, 1)
  230. sql := ""
  231. if serverId == 17 || serverId == 18 {
  232. sql = "update bigmember_service_user set i_frequency = ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
  233. } else {
  234. sql = "update bigmember_service_user set i_frequency = i_frequency + ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
  235. }
  236. status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
  237. if status1 < 0 {
  238. log.Println("新建服务-更新服务表出错", userId)
  239. return false
  240. }
  241. } else {
  242. insert := map[string]interface{}{
  243. "s_smainid": mainId,
  244. "s_userid": userId,
  245. "s_serviceid": serverId,
  246. "i_frequency": frequency,
  247. "l_starttime": startdate.Format(tmp),
  248. "l_endtime": enddate.Format(tmp),
  249. "i_status": common.If(dataType == 1, 0, 1),
  250. "l_createtime": time.Now().Format(tmp),
  251. "l_updatetime": time.Now().Format(tmp),
  252. }
  253. order_id := JyMysql.Insert(BigServiceUser, insert)
  254. if order_id > 0 {
  255. log.Println("用户服务表插入成功", userId)
  256. } else {
  257. log.Println("用户服务表插入失败", userId)
  258. return false
  259. }
  260. }
  261. }
  262. } else {
  263. for _, s := range strings.Split(serversId, ",") {
  264. serverId, _ := strconv.Atoi(s)
  265. mainId := serverId
  266. if serverMap[serverId] != 0 {
  267. serverId = serverMap[serverId]
  268. }
  269. serverData := JyMysql.FindOne("bigmember_service", map[string]interface{}{"id": mainId}, "", "")
  270. frequency := 0
  271. if serverData != nil && len(*serverData) > 0 {
  272. if serverId == 11 || serverId == 15 {
  273. if serverId == 15 {
  274. if payCycle >= 12 {
  275. frequency = (payCycle / 12 * common.IntAll((*serverData)["s_count_year"])) + (payCycle % 12 * common.IntAll((*serverData)["s_count_month"]))
  276. } else {
  277. frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
  278. }
  279. } else {
  280. frequency = payCycle * common.IntAll((*serverData)["s_count_month"])
  281. }
  282. } else {
  283. frequency = common.IntAll((*serverData)["s_count_month"])
  284. }
  285. }
  286. sqls := "select * from bigmember_service_user where s_serviceid = ? and s_userid = ? and i_status = -1"
  287. serverDatas := JyMysql.SelectBySql(sqls, serverId, userId)
  288. if serverDatas != nil && len(*serverDatas) > 0 {
  289. i_status := common.If(dataType == 1, 0, 1)
  290. sql := "update bigmember_service_user set i_frequency = i_frequency + ?,l_updatetime = ?,l_starttime = ?,l_endtime = ?,i_status = ? where s_serviceid = ? and s_userid = ?"
  291. status1 := JyMysql.UpdateOrDeleteBySql(sql, fmt.Sprint(frequency), time.Now().Format(tmp), startdate.Format(tmp), enddate.Format(tmp), fmt.Sprint(i_status), serverId, userId)
  292. if status1 < 0 {
  293. log.Println("新建服务-更新服务表出错")
  294. return false
  295. }
  296. } else {
  297. insert := map[string]interface{}{
  298. "s_userid": userId,
  299. "s_smainid": mainId,
  300. "s_serviceid": serverId,
  301. "i_frequency": frequency,
  302. "l_starttime": startdate.Format(tmp),
  303. "l_endtime": enddate.Format(tmp),
  304. "i_status": common.If(dataType == 1, 0, 1),
  305. "l_createtime": time.Now().Format(tmp),
  306. "l_updatetime": time.Now().Format(tmp),
  307. }
  308. order_id := JyMysql.Insert(BigServiceUser, insert)
  309. if order_id > 0 {
  310. log.Println("用户服务表插入成功", userId)
  311. } else {
  312. log.Println("用户服务表插入失败")
  313. return false
  314. }
  315. }
  316. }
  317. }
  318. RedisDel(userId)
  319. return true
  320. }
  321. func GetServerPid() map[int]int {
  322. pidMap := map[int]int{}
  323. datas := JyMysql.Find("bigmember_service", map[string]interface{}{"i_status": 0}, "id,i_pid", "", 0, 0)
  324. if datas != nil && len(*datas) > 0 {
  325. for _, v := range *datas {
  326. if v["i_pid"] != nil {
  327. pidMap[common.IntAll(v["id"])] = common.IntAll(v["i_pid"])
  328. }
  329. }
  330. }
  331. return pidMap
  332. }
  333. func RedisDel(userId string) {
  334. redis.Del(NewOther, "pl_indexMessage_"+userId)
  335. cacheKey := fmt.Sprintf(PowerCacheKey, userId)
  336. baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
  337. redisMenuKeyPC := fmt.Sprintf(RedisMenuKeyPC, userId)
  338. redisMenuKeyWX := fmt.Sprintf(RedisMenuKeyWX, userId)
  339. redisMenuKeyAPP := fmt.Sprintf(RedisMenuKeyAPP, userId)
  340. userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, time.Now().Day(), userId)
  341. redis.Del(NewOther, cacheKey)
  342. redis.Del(NewOther, baseInfoCacheKey)
  343. redis.Del(NewOther, redisMenuKeyPC)
  344. redis.Del(NewOther, redisMenuKeyWX)
  345. redis.Del(NewOther, redisMenuKeyAPP)
  346. redis.Del(NewOther, userPowerRedisKey)
  347. }
  348. func openPowerVip(orderData map[string]interface{}, userId string) bool {
  349. vms := VipSimpleMsg{}
  350. json.Unmarshal([]byte(common.ObjToString(orderData["filter"])), &vms)
  351. startTime := common.ObjToString(orderData["vip_starttime"])
  352. endTime := common.ObjToString(orderData["vip_endtime"])
  353. Date_Full_Layout := "2006-01-02 15:04:05"
  354. user_phone := common.ObjToString(orderData["user_phone"])
  355. startdate, _ := time.ParseInLocation(Date_Full_Layout, startTime, time.Local)
  356. enddate, _ := time.ParseInLocation(Date_Full_Layout, endTime, time.Local)
  357. dataType := 1
  358. if startdate.Unix() > time.Now().Unix() {
  359. dataType = 2
  360. }
  361. //为用户开通超级订阅权限
  362. //是否开通超级订阅 -1 试用到期 -2 正式到期 1 试用 2 开通
  363. isTrial := false
  364. if dataType == 2 {
  365. isTrial = true
  366. }
  367. isOk := StartSubVip(user_phone, *vms.Area, *vms.NewBuyset, startdate, enddate, isTrial, userId)
  368. return isOk
  369. }
  370. func StartSubVip(phone string, area map[string]interface{}, newBuyset SubvipBuySet, startTime, endTime time.Time, isTrial bool, userId string) bool {
  371. set := map[string]interface{}{
  372. "o_vipjy.i_trial": -1, //已激活试用
  373. "o_vipjy.o_area": area, //设置地区
  374. "o_vipjy.o_buyset": newBuyset, //购买内容 城市、省份、行业数量
  375. "l_vip_starttime": startTime.Unix(), //开始时间
  376. "l_vip_endtime": endTime.Unix(), //结束时间
  377. "i_vip_status": common.If(isTrial, -2, 2), //1试用 2正式 -2 试用到期
  378. "i_vip_expire_tip": 0, //消息提示初始化
  379. "o_vipjy.a_buyerclass": []interface{}{}, //设置行业
  380. }
  381. isOk := Mgo.UpdateById("user", userId, map[string]interface{}{
  382. "$set": set,
  383. })
  384. go func() {
  385. MergeKws(userId)
  386. RedisDel(userId)
  387. }()
  388. if isOk {
  389. return true
  390. }
  391. return true
  392. }
  393. // 初始化vip订阅关键词
  394. func MergeKws(userId string) {
  395. if userId == "" { //11-11 取消此操作
  396. return
  397. }
  398. data, ok := Mgo.FindById("user", userId, `{"o_jy":1,"o_vipjy":1}`)
  399. var o_vipjy map[string]interface{}
  400. if ok && data != nil && len(*data) > 0 {
  401. o_vipjy, _ = (*data)["o_vipjy"].(map[string]interface{})
  402. a_items, _ := o_vipjy["a_items"].([]interface{})
  403. if a_items == nil { //首次
  404. Mgo.UpdateById("user", userId, map[string]interface{}{
  405. "$set": map[string]interface{}{"o_vipjy.i_matchway": 1, "o_vipjy.i_ratemode": 1, "o_vipjy.i_wxpush": 1, "o_vipjy.i_apppush": 1, "o_vipjy.i_projectmatch": 0, "o_vipjy.a_infotype": []string{}, "o_vipjy.a_items": []string{}, "o_vipjy.l_modifydate": time.Now().Unix()},
  406. })
  407. }
  408. }
  409. }
  410. func delPower(id int64) {
  411. data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"id": id}, "", "")
  412. if data != nil && len(*data) > 0 {
  413. waitEmpowerId := common.Int64All((*data)["wait_empower_id"])
  414. entUserId := common.IntAll((*data)["ent_user_id"])
  415. JyMysql.UpdateOrDeleteBySql(`update `+EntnicheWaitEmpower+` set use_count = use_count - 1 where id = ?`, waitEmpowerId)
  416. eOData := JyMysql.FindOne(EntnicheOrder, map[string]interface{}{"wait_empower_id": waitEmpowerId}, "", "")
  417. if eOData != nil && len(*eOData) > 0 {
  418. orderId := common.Int64All((*eOData)["order_id"])
  419. orderData := JyMysql.FindOne(Order, map[string]interface{}{"id": orderId}, "", "")
  420. if orderData != nil && len(*orderData) > 0 {
  421. productType := common.ObjToString((*orderData)["product_type"])
  422. userId := getUserId(entUserId)
  423. if productType == "VIP订阅" {
  424. Mgo.UpdateById("user", userId, map[string]interface{}{"$unset": map[string]interface{}{"i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1}})
  425. } else if productType == "大会员" {
  426. Mgo.UpdateById("user", userId, map[string]interface{}{"$unset": map[string]interface{}{"i_member_status": 1, "i_member_starttime": 1, "i_member_endtime": 1}})
  427. JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": userId}, map[string]interface{}{"i_status": -1})
  428. }
  429. RedisDel(userId)
  430. }
  431. }
  432. }
  433. }
  434. func getUserId(entUserId int) string {
  435. data := JyMysql.FindOne(EntnicheUser, map[string]interface{}{"id": entUserId}, "", "")
  436. userId := ""
  437. now := time.Now()
  438. if data != nil && len(*data) > 0 {
  439. phone := common.ObjToString((*data)["phone"])
  440. userData, ok := Mgo.FindOne("user", map[string]interface{}{"s_phone": phone})
  441. if ok && userData != nil && len(*userData) > 0 {
  442. userId = mongodb.BsonIdToSId((*userData)["_id"])
  443. } else {
  444. userDatas, oks := Mgo.FindOne("user", map[string]interface{}{"s_m_phone": phone})
  445. if oks && userDatas != nil && len(*userDatas) > 0 {
  446. userId = mongodb.BsonIdToSId((*userDatas)["_id"])
  447. } else {
  448. ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
  449. res, _ := UserCenterRpc.UserAdd(ctx, &usercenter.UserAddReq{
  450. Appid: "10000",
  451. Phone: phone,
  452. })
  453. data := map[string]interface{}{
  454. "i_appid": 2,
  455. "s_phone": phone,
  456. "s_password": "",
  457. "l_registedate": now.Unix(),
  458. "i_ts_guide": 2,
  459. "o_jy": map[string]interface{}{
  460. "i_wxpush": 1,
  461. "i_apppush": 1,
  462. "i_ratemode": 2,
  463. "l_modifydate": now.Unix(),
  464. },
  465. "s_regsource": "qmx_admin",
  466. "base_user_id": res.Data.Id,
  467. }
  468. _id := Mgo.Save("user", data)
  469. log.Println("新增用户", _id)
  470. if _id != "" {
  471. userId = _id
  472. }
  473. }
  474. }
  475. }
  476. return userId
  477. }