Browse Source

短信api

master
huangjiajun 1 year ago
parent
commit
d5387a7b9f
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      sms/api.go

+ 7
- 4
sms/api.go View File

@@ -70,7 +70,7 @@ func SmsSend(engine *xorm.Engine, args map[string]interface{}) error {
where = map[string]interface{}{ where = map[string]interface{}{
"appkey": args["smsmsg_key"], "appkey": args["smsmsg_key"],
"zone": args["zone"], "zone": args["zone"],
"phone": args["phone"],
"phone": args["mobile"],
"templateCode": args["templateCode"], "templateCode": args["templateCode"],
} }
send, err = SmsMobApiSend(where) send, err = SmsMobApiSend(where)
@@ -122,9 +122,12 @@ func SmsSend(engine *xorm.Engine, args map[string]interface{}) error {
SmsType: args["sms_type"].(string), SmsType: args["sms_type"].(string),
} }
engine.InsertOne(&record) engine.InsertOne(&record)
sql := `UPDATE sms_num_list set num=num-%d WHERE uid=%s and type=%s;`
sql := `UPDATE sms_num_list set num=num-%d WHERE uid=%s and type='%s';`
sql = fmt.Sprintf(sql, count*int(contentLen), args["uid"], args["sms_type"]) sql = fmt.Sprintf(sql, count*int(contentLen), args["uid"], args["sms_type"])
db.QueryNativeString(engine, sql)
fmt.Println(sql)
nativeString, err := db.QueryNativeString(engine, sql)
fmt.Println(nativeString)
fmt.Println(err)
return nil return nil
} }


@@ -154,7 +157,7 @@ func SmsApiSend(engine *xorm.Engine, method string, args map[string]interface{})
} }
func SmsMobApiSend(args map[string]interface{}) (string, error) { func SmsMobApiSend(args map[string]interface{}) (string, error) {
thisUrl := "https://webapi.sms.mob.com/sms/sendmsg" thisUrl := "https://webapi.sms.mob.com/sms/sendmsg"
post, err := zhios_third_party_utils.CurlPost(thisUrl, zhios_third_party_utils.SerializeStr(args), nil)
post, err := zhios_third_party_utils.CurlPost(thisUrl, args, nil)
fmt.Println(string(post)) fmt.Println(string(post))
fmt.Println(err) fmt.Println(err)
return string(post), err return string(post), err


Loading…
Cancel
Save