|
@@ -1,6 +1,7 @@
|
|
|
package service
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/date"
|
|
|
entity "bp.jydev.jianyu360.cn/BaseService/biService/entity"
|
|
|
"bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
|
|
@@ -10,7 +11,6 @@ import (
|
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
|
"log"
|
|
|
"math/big"
|
|
|
- "net/url"
|
|
|
"strings"
|
|
|
"time"
|
|
|
)
|
|
@@ -84,10 +84,10 @@ func PersonImageSave(imgUrl string, msgId, positionId, materialsId int64) bool {
|
|
|
return entity.BiService.Insert("operating_materials_attachment", saveMap) > 0
|
|
|
}
|
|
|
|
|
|
-func GetPersonCode(positionId int64, name string) string {
|
|
|
+func GetPersonCode(positionId int64, name, userId string) string {
|
|
|
//根据职位id获取到对应的渠道码
|
|
|
code := ""
|
|
|
- data := entity.JyBiTidb.FindOne("dwd_d_userbase_belongto_rulecode", map[string]interface{}{"position_id": positionId}, "code", "")
|
|
|
+ data := entity.JyBiTidb.FindOne("dwd_d_userbase_belongto_rulecode", map[string]interface{}{"user_id": positionId}, "code", "")
|
|
|
if data != nil && len(*data) > 0 {
|
|
|
code = gconv.String((*data)["code"])
|
|
|
} else {
|
|
@@ -104,27 +104,12 @@ func GetPersonCode(positionId int64, name string) string {
|
|
|
"SZ_PID0": "04",
|
|
|
"SZ_PID1": code,
|
|
|
"position_id": positionId,
|
|
|
+ "user_id": userId,
|
|
|
})
|
|
|
}
|
|
|
return code
|
|
|
}
|
|
|
|
|
|
-/*func PersonImgSaveComposite(fileUrl, qrcodeUrl, name, personCode string, positionId int64) ([]byte, error) {
|
|
|
-
|
|
|
- //合成图片
|
|
|
- ok, err := hasAnyParameters(qrcodeUrl)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
- if ok {
|
|
|
- qrcodeUrl = fmt.Sprintf("%s&personnelChannel=%s", qrcodeUrl, personCode)
|
|
|
- } else {
|
|
|
- qrcodeUrl = fmt.Sprintf("%s?personnelChannel=%s", qrcodeUrl, personCode)
|
|
|
- }
|
|
|
- err, imgByte := CompositeImage(fileUrl, qrcodeUrl)
|
|
|
- return imgByte, err
|
|
|
-}*/
|
|
|
-
|
|
|
func generateRandomString(length int) string {
|
|
|
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
|
|
b := make([]byte, length)
|
|
@@ -136,12 +121,13 @@ func generateRandomString(length int) string {
|
|
|
return string(b)
|
|
|
}
|
|
|
|
|
|
-func hasAnyParameters(rawURL string) (bool, error) {
|
|
|
- parsedURL, err := url.Parse(rawURL)
|
|
|
- if err != nil {
|
|
|
- return false, err
|
|
|
+func GetUserIds(positionIds string) map[int]string {
|
|
|
+ res := map[int]string{}
|
|
|
+ data := entity.BiService.SelectBySql("SELECT userid,position_id FROM data_service.`user_system` FROM position_id in (?)", positionIds)
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
+ for _, v := range *data {
|
|
|
+ res[common.IntAll(v["position_id"])] = common.InterfaceToStr(v["userid"])
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- // 检查查询参数或片段标识符中的参数
|
|
|
- return parsedURL.RawQuery != "" || (parsedURL.Fragment != "" && strings.Contains(parsedURL.Fragment, "=")), nil
|
|
|
+ return res
|
|
|
}
|