1
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use plugin\admin\app\controller\Crud;
|
||||
use app\model\Address as AddressModel;
|
||||
|
||||
/**
|
||||
* 用户地址
|
||||
*/
|
||||
class AddressController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \app\model\Address
|
||||
*/
|
||||
protected $model = null;
|
||||
protected $relationSearch = ['user'];
|
||||
/**
|
||||
* 构造函数
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->model = new AddressModel();
|
||||
$statusList = $this->model->getStatusList();
|
||||
$this->assign("statusList", $statusList);
|
||||
$this->assignconfig("statusList", $statusList);
|
||||
$this->assign("networkList", $this->model->getNetworkList());
|
||||
$this->assignconfig("networkList", $this->model->getNetworkList());
|
||||
}
|
||||
function __before_index__(){
|
||||
$this->assign('refreshBalance',cache('refreshBalance'));
|
||||
}
|
||||
function refreshbalance(){
|
||||
$ids = Input('ids');
|
||||
if($ids){
|
||||
$data = AddressModel::field('id,network,address')->whereIn('id',$ids)->order('id asc')->find();
|
||||
try {
|
||||
$res = get(Config('pay.server').'/Util/balance?address='.$data['address'].'&network='.$data['network']);
|
||||
$res = json_decode($res,true);
|
||||
AddressModel::where('id',$data['id'])->update($res['data']);
|
||||
\support\Log::info($data['address'].'已经更新');
|
||||
} catch (\Exception $e) {
|
||||
\support\Log::info($data['address'].'更新失败:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
return $this->success('ok');
|
||||
}
|
||||
function refresh_balance(){
|
||||
return $this->success('ok');
|
||||
// $ids = Input('ids');
|
||||
// if($ids){
|
||||
// $address = AddressModel::field('id,network,address,approve_address')->whereIn('id',$ids)->order('id asc')->select();
|
||||
// }else{
|
||||
// $address = AddressModel::field('id,network,address,approve_address')->order('id asc')->select();
|
||||
// }
|
||||
// $data = $address->toArray();
|
||||
// addJob($data,'refreshBalance');
|
||||
// return $this->success('ok');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user