Commit 5ef5548d authored by shajiaiming's avatar shajiaiming

fix

parent 1c1180ff
......@@ -109,9 +109,9 @@ class PlatformCoinsController extends BaseController
$contact = Yii::$app->request->post('contact', '');
$header = Yii::$app->request->headers;
$deviceCode = $header['FZM-REQUEST-UUID'] ?? null;
$version = $header['version'] ?? null;
$device = $header['device'] ?? null;
$deviceCode = $header['FZM-REQUEST-UUID'] ?? "";
$version = $header['version'] ?? "";
$device = $header['device'] ?? "";
if (empty($platform_id) || empty($coins_address) || empty($type)) {
return ['code' => -1, 'data' => null, 'msg' => '缺少必要的参数'];
......@@ -133,17 +133,20 @@ class PlatformCoinsController extends BaseController
$isExistModel = CoinPlatformCoins::find()->where(['coins_name' => $coin_name, 'coins_address' => $coins_address, 'contact' => $contact])->one();
if ($isExistModel) {
$isExistModel->update_time = date('Y-m-d H:i:s');
$isExistModel->save();
} else {
$isExistModel->coins_name = $coin_name;
$isExistModel->coins_address = $coins_address;
$isExistModel->type = $type;
$isExistModel->deviceCode = $deviceCode;
$isExistModel->platform_id = $platform_id;
$isExistModel->device = $device;
$isExistModel->version = $version;
$isExistModel->contact = $contact;
$model = new CoinPlatformCoins();
$model->setScenario(CoinPlatformCoins::SCENARIOS_CREATE);
$model->coins_name = $coin_name;
$model->coins_address = $coins_address;
$model->type = $type;
$model->deviceCode = $deviceCode;
$model->platform_id = $platform_id;
$model->device = $device;
$model->version = $version;
$model->contact = $contact;
$model->save();
}
$isExistModel->save();
}
return ['code' => $this->code, 'data' => $this->data, 'msg' => $this->msg];
......
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