Commit 3f41290c authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

fix See merge request !460
parents cabf5378 d7906fe2
...@@ -107,6 +107,8 @@ class PlatformCoinsController extends BaseController ...@@ -107,6 +107,8 @@ class PlatformCoinsController extends BaseController
$header = Yii::$app->request->headers; $header = Yii::$app->request->headers;
$deviceCode = $header['FZM-REQUEST-UUID'] ?? null; $deviceCode = $header['FZM-REQUEST-UUID'] ?? null;
$version = $header['version'] ?? null;
$device = $header['device'] ?? null;
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' => '缺少必要的参数'];
...@@ -146,6 +148,8 @@ class PlatformCoinsController extends BaseController ...@@ -146,6 +148,8 @@ class PlatformCoinsController extends BaseController
$type, $type,
$deviceCode, $deviceCode,
$platform_id, $platform_id,
$device,
$version
]; ];
} }
if (empty($item_array)) { if (empty($item_array)) {
......
...@@ -22,23 +22,25 @@ class CoinPlatformCoins extends BaseActiveRecord ...@@ -22,23 +22,25 @@ class CoinPlatformCoins extends BaseActiveRecord
return '{{%coin_platform_coins}}'; return '{{%coin_platform_coins}}';
} }
public function rules() { public function rules()
{
return [ return [
[['coins_name','coins_address', 'type', 'deviceCode', 'platform_id'], 'required'], [['coins_name', 'coins_address', 'type', 'deviceCode', 'platform_id'], 'required'],
]; ];
} }
public function scenarios() { public function scenarios()
{
$scenarios = [ $scenarios = [
self:: SCENARIOS_CREATE => ['coins_name','coins_address', 'type', 'deviceCode', 'platform_id'], self:: SCENARIOS_CREATE => ['coins_name', 'coins_address', 'type', 'deviceCode', 'platform_id'],
]; ];
return array_merge( parent:: scenarios(), $scenarios); return array_merge(parent:: scenarios(), $scenarios);
} }
/** /**
* 导入数据 * 导入数据
* *
* @param array $datas * @param array $datas
* @return boolean * @return boolean
*/ */
public static function batchImport(array $datas) public static function batchImport(array $datas)
...@@ -47,7 +49,7 @@ class CoinPlatformCoins extends BaseActiveRecord ...@@ -47,7 +49,7 @@ class CoinPlatformCoins extends BaseActiveRecord
return false; return false;
} }
try { try {
$result = self::getDb()->createCommand()->batchInsert(self::tableName(), ['coins_name', 'coins_address', 'type', 'deviceCode', 'platform_id'], $datas)->execute(); $result = self::getDb()->createCommand()->batchInsert(self::tableName(), ['coins_name', 'coins_address', 'type', 'deviceCode', 'platform_id', 'device', 'version'], $datas)->execute();
return $result; return $result;
} catch (\Exception $e) { } catch (\Exception $e) {
} }
......
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