汇率自动获取功能
This commit is contained in:
@@ -191,6 +191,18 @@ class Auto extends Base
|
||||
}
|
||||
|
||||
|
||||
public function changeExchangeRate(){
|
||||
$res = myGet("https://v6.exchangerate-api.com/v6/575c78ea6173243d6c366814/latest/USD");
|
||||
$r = object_to_array(json_decode($res));
|
||||
$update['USD'] = 1;
|
||||
$update['CNY'] = $r["conversion_rates"]['CNY'];
|
||||
$update['NZD'] = $r["conversion_rates"]['NZD'];
|
||||
$update['utime'] = time();
|
||||
$this->exchange_rate_obj->where("id",1)->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function reviewerRepeat(){
|
||||
$repeats = $this->article_reviewer_repeat_obj->where("ctime","<",(time()-24*5*3600))->where("state",0)->delete(true);
|
||||
// foreach ($repeats as $v){
|
||||
|
||||
@@ -87,6 +87,7 @@ class Base extends Controller
|
||||
protected $major_to_user_obj = "";
|
||||
protected $major_to_article_obj = "";
|
||||
protected $paystation_obj = "";
|
||||
protected $exchange_rate_obj = "";
|
||||
|
||||
|
||||
public function __construct(\think\Request $request = null)
|
||||
@@ -169,6 +170,7 @@ class Base extends Controller
|
||||
$this->major_to_user_obj = Db::name("major_to_user");
|
||||
$this->major_to_article_obj = Db::name("major_to_article");
|
||||
$this->paystation_obj = Db::name("paystation");
|
||||
$this->exchange_rate_obj = Db::name("exchange_rate");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user