Commit 9ff9cf3e authored by shajiaiming's avatar shajiaiming

调整返回数据

parent fb4759e4
...@@ -23,7 +23,7 @@ class PlatformCoinsController extends BaseController ...@@ -23,7 +23,7 @@ class PlatformCoinsController extends BaseController
$type = Yii::$app->request->post('type', ''); $type = Yii::$app->request->post('type', '');
if(empty($platform_id) || empty($coins_address) || empty($type)){ if(empty($platform_id) || empty($coins_address) || empty($type)){
return ['code' => -1,'data' => [], 'msg' => '缺少必要的参数']; return ['code' => -1,'data' => null, 'msg' => '缺少必要的参数'];
} }
$item_array = []; $item_array = [];
...@@ -38,14 +38,14 @@ class PlatformCoinsController extends BaseController ...@@ -38,14 +38,14 @@ class PlatformCoinsController extends BaseController
] ; ] ;
} }
if(empty($item_array)){ if(empty($item_array)){
return ['code' => -1,'data' => [], 'msg' => '数据重复插入']; return ['code' => -1,'data' => null, 'msg' => '数据重复插入'];
} }
$result = CoinPlatformCoins::batchImport($item_array); $result = CoinPlatformCoins::batchImport($item_array);
if(!$result){ if(!$result){
return ['code' => -1,'data' => [], 'msg' => '数据导入失败']; return ['code' => -1,'data' => null, 'msg' => '数据导入失败'];
} }
return ['code' => 0,'data' => [], 'msg' => '数据导入成功']; return ['code' => 0,'data' => null, 'msg' => '数据导入成功'];
} }
} }
\ No newline at end of file
...@@ -99,9 +99,9 @@ class VisitStatisticsController extends BaseController ...@@ -99,9 +99,9 @@ class VisitStatisticsController extends BaseController
$model_coinDailyTimes = new CoinDailyTimes(); $model_coinDailyTimes = new CoinDailyTimes();
$model_coinDailyTimes->setScenario(CoinDailyTimes::SCENARIOS_CREATE); $model_coinDailyTimes->setScenario(CoinDailyTimes::SCENARIOS_CREATE);
if($model_coinDailyTimes->load(Yii::$app->request->get(),'') && $model_coinDailyTimes->save()) { if($model_coinDailyTimes->load(Yii::$app->request->get(),'') && $model_coinDailyTimes->save()) {
return ['code' => 0,'data' => [], 'msg' => '数据记录插入成功']; return ['code' => 0,'data' => null, 'msg' => '数据记录插入成功'];
} else { } else {
return ['code' => -1,'data' => [], 'msg' => current($model_coinDailyTimes->firstErrors)]; return ['code' => -1,'data' => null, 'msg' => current($model_coinDailyTimes->firstErrors)];
} }
} }
......
...@@ -45,8 +45,8 @@ class CoinAppVersion extends BaseActiveRecord ...@@ -45,8 +45,8 @@ class CoinAppVersion extends BaseActiveRecord
*/ */
public static function getLastStable($type = 1,$platform_id = 1) public static function getLastStable($type = 1,$platform_id = 1)
{ {
$max_version = self::find()->where(['type' => $type,'platform_id' => $platform_id])->max('version'); $max_version_code = self::find()->where(['type' => $type,'platform_id' => $platform_id])->max('version_code');
$data = self::find()->where(['type' => $type,'platform_id' => $platform_id,'version' => $max_version])->asArray()->one(); $data = self::find()->where(['type' => $type,'platform_id' => $platform_id,'version_code' => $max_version_code])->asArray()->one();
return $data; return $data;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment