|
- package fast_login
-
- import (
- "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db"
- "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db/offical"
- "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/db/offical/model"
- zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils"
- "fmt"
- "time"
- "xorm.io/xorm"
- )
-
- //数量
- func FastLoginNumGetSmsNum(engine *xorm.Engine, uid interface{}) int {
- numData := offical.GetFastLoginNum(engine, uid)
- num := 0
- if numData != nil {
- num = numData.Num
- }
- if num < 0 {
- num = 0
- }
- return num
- }
-
- //发送
- func FastLoginSend(engine *xorm.Engine, args map[string]interface{}) error {
- num := FastLoginNumGetSmsNum(engine, args["uid"])
- //存入记录
- ext := map[string]interface{}{
- "post": args,
- }
- var record = model.FastLoginRecord{
- OrdId: "",
- Uid: int(zhios_third_party_utils.AnyToInt64(args["uid"])),
- Amount: "1",
- CostPrice: "",
- Balance: zhios_third_party_utils.IntToStr(num - 1),
- PayWay: 0,
- State: 1,
- Memo: "一键登录",
- CreateAt: time.Now(),
- UpdateAt: time.Now(),
- TradeNo: "",
- Type: 1,
- OrdType: "buy",
- Fee: "",
- Ext: zhios_third_party_utils.SerializeStr(ext),
- Phone: args["mobile"].(string),
- }
- engine.InsertOne(&record)
- sql := `UPDATE fast_login_num_list set num=num-%d WHERE uid=%s ;`
- sql = fmt.Sprintf(sql, 1, args["uid"])
- fmt.Println(sql)
- nativeString, err := db.QueryNativeString(engine, sql)
- fmt.Println(nativeString)
- fmt.Println(err)
- return nil
- }
|