文档
测试

3、获取登录Token

POST
http://api.123580.com/api/gateway/service

接口描述

获取登录授权令牌信息,用于Erp自动登录,10分钟内有效,将获取到的Token作为参数跳转登录页(/AutoLogin/CloudLogin?Token=Token)

系统参数

参数名
类型
描述
必填
Method
string
comradeapi/cloudapi/erp
必填

ReqBody

参数名
类型
描述
必填
UserId
int
必填;示例:0
必填
UserNo
string
必填;示例:system
必填
UserName
string
必填;示例:systemapi
必填
BranchId
int
必填;示例:2
必填
RequestMethod
string
必填;login.gettoken
必填
Datas
string
单据数据
必填
LoginType
int
必填;登录类型 0-ERP 1-POS
必填
Mobile
string
必填;手机号
必填
CustomerCode
string
POS登录-必填-店铺编号
必填
RoleCode
string
后台角色编号 职位为其他时必填
可选

RspBody参数

参数名
类型
描述
必填
PrimaryId
string
ERP单号
必填
IsSuccess
bool
是否成功
必填
IsException
bool
是否异常
必填
Message
string
信息说明
必填
RData
object
返回信息
必填
NonceStr
string
Token令牌信息
必填
Mobile
string
手机号
必填
EffectiveTime
datetime
有效期:默认请求内10分钟
必填
LoginType
int
登录类型
必填

说明 / 示例

var loginInfo = new { LoginType = 0, Mobile = "13521212121" }; CloudApiRequestSave item = new CloudApiRequestSave("login.gettoken"); item.BranchId = 2; item.UserNo = "system"; item.UserName = "systemapi"; item.AddDatas(loginInfo); APIRequest req = new APIRequest(); req.LicenseId = LicenseId; req.AppKey = AppKey; req.Method = "comradeapi/cloudapi/erp"; req.ReqBody = Newtonsoft.Json.JsonConvert.SerializeObject(item); req.TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); req.Token = Token; req.Sign = API.Helper.APISignature.SignToRequest(req, SecretKey); string result = API.Helper.APIClient.DoPost(Newtonsoft.Json.JsonConvert.SerializeObject(req), domain); API.Entity.APIResponse rsp = Newtonsoft.Json.JsonConvert.DeserializeObject<API.Entity.APIResponse>(result); if (!rsp.IsError) { //返回信息=rsp.RspBody //调用成功 Console.WriteLine(result); Console.ReadLine(); } else { //调用失败 Console.WriteLine(result); Console.ReadLine(); } return "";