Commit ca337d62 authored by shajiaiming's avatar shajiaiming

fix

parent 56dcefed
......@@ -179,19 +179,22 @@ class PlatformCoinsController extends BaseController
foreach ($data as $val) {
$address = $val['address'] ?? null;
$mobile = $val['mobile'] ?? null;
if (empty($address) || empty($mobile)) continue;
$mail = $val['mail'] ?? null;
if (empty($address) || empty($mobile) || empty($mail)) continue;
$count = CoinAddress::find()->where(['address' => $address, 'mobile' => $mobile])->count();
$count = CoinAddress::find()->where(['address' => $address, 'mobile' => $mobile, 'mail' => $mail])->count();
if ($count > 0) continue;
$item_array[] = [
$address,
$mobile,
$mail
];
}
if (empty($item_array)) {
goto doEnd;
}
$result = CoinAddress::batchImport(Tools::super_unique($item_array));
if (!$result) {
$this->code = -1;
......
......@@ -24,14 +24,14 @@ class CoinAddress extends BaseActiveRecord
public function rules()
{
return [
[['address', 'mobile'], 'required'],
[['address', 'mobile', 'mail'], 'required'],
];
}
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_CREATE => ['address', 'mobile'],
self:: SCENARIOS_CREATE => ['address', 'mobile', 'mail'],
];
return array_merge(parent:: scenarios(), $scenarios);
}
......@@ -48,10 +48,10 @@ class CoinAddress extends BaseActiveRecord
return false;
}
try {
$result = self::getDb()->createCommand()->batchInsert(self::tableName(), ['address', 'mobile'], $datas)->execute();
$result = self::getDb()->createCommand()->batchInsert(self::tableName(), ['address', 'mobile', 'mail'], $datas)->execute();
return $result;
} catch (\Exception $e) {
var_dump($e->getMessage());exit;
}
return false;
}
......
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