package mobile

import (
	"gin-vue-admin/model/request"
	"gin-vue-admin/model/response"
	"gin-vue-admin/service"
	"github.com/gin-gonic/gin"
)

func GetIdByCode(c *gin.Context) {
	var req request.GetIdByCodeReq
	_ = c.ShouldBindJSON(&req)

	reply := service.GetIdByCode(req.Code)

	response.OkWithDetailed(reply, "获取成功", c)
}

func SetCode(c *gin.Context) {
	var req request.GetCustomerUserListReq
	_ = c.ShouldBindJSON(&req)

	req.PageSize = 99999

	_, list, _ := service.GetCustomerUserList(req)

	codeList := service.GetVcodeList(req.MocId)

	for _, v := range list {
		_, ok := codeList[v.Id]
		if ok == false {
			service.GetVcode(v.Id, req.MocId)
		}
	}

	response.OkWithDetailed("", "获取成功", c)
}
