Commit 5ef5548d authored by shajiaiming's avatar shajiaiming

fix

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