提交进度
This commit is contained in:
parent
04ef81a8f2
commit
03724ecea4
@ -198,19 +198,32 @@ class UrlsController extends ControllerBase{
|
|||||||
}
|
}
|
||||||
//如果以上判断都通过
|
//如果以上判断都通过
|
||||||
if(empty($rs['errcode'])){
|
if(empty($rs['errcode'])){
|
||||||
//{"errmsg":"ok","errcode":0,"data":{"shorturl":"weu.me/FUhGg"}}
|
//设置生成长链接
|
||||||
//设置转换长链接
|
|
||||||
$post_arr['urls'] = json_encode(array($request_arr['url']));
|
$post_arr['urls'] = json_encode(array($request_arr['url']));
|
||||||
//设置转换TokenID
|
//设置生成TokenID
|
||||||
$post_arr['TokenID'] = "TH3UOn1Z4p7aJFS5q8eE6Kmt9xWQsocw";
|
$post_arr['TokenID'] = "TH3UOn1Z4p7aJFS5q8eE6Kmt9xWQsocw";
|
||||||
//开发阶段转为使用测试TokenID
|
//开发阶段转为使用测试TokenID
|
||||||
$post_arr['TokenID'] = "DAdlkwahhODpoiQPKwndkwaMDsdIN59P";
|
$post_arr['TokenID'] = "DAdlkwahhODpoiQPKwndkwaMDsdIN59P";
|
||||||
//准备转换短链接
|
//准备生成短链接
|
||||||
$url = "https://weapp.wemediacn.com/we/surl/api/get";
|
$url = "https://weapp.wemediacn.com/we/surl/api/get";
|
||||||
//获取转换结果
|
//获取生成结果
|
||||||
$array = json_decode($this->__http_post_request($url, $post_arr), true);
|
$json = $this->__http_post_request($url, $post_arr);
|
||||||
echo "<pre>";
|
//转换生成结果
|
||||||
print_r($array);
|
$array = json_decode($json, true);
|
||||||
|
//如果生成失败
|
||||||
|
if(!(strpos(strtolower($json), "ok")!==false)){
|
||||||
|
//告知用户"系统繁忙,请稍候再试"
|
||||||
|
$rs['errmsg'] = "系统繁忙,请稍候再试";
|
||||||
|
$rs['errcode'] = -1;
|
||||||
|
$rs['data'] = null;
|
||||||
|
}
|
||||||
|
//如果生成成功
|
||||||
|
else{
|
||||||
|
//告知用户"ok"
|
||||||
|
$rs['errmsg'] = "ok";
|
||||||
|
$rs['errcode'] = 0;
|
||||||
|
$rs['data']['shorturl'] = $array['urls'][0]['surl'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user