Commit a9144ede authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

Feature/optimize See merge request !66
parents 2f8da1bb 6f7d22e4
......@@ -131,7 +131,7 @@ class CoinController extends BaseController
if ($recommend) {
$condition['recommend'] = $recommend;
}
$select = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'treaty'];
$select = ['id', 'sid', 'icon', 'name', 'optional_name', 'nickname', 'platform', 'chain', 'treaty'];
$order_by = ['sort' => SORT_ASC];
$datas = CoinRecommend::getList($page, $limit, $condition, $order_by, $select);
//获取详细信息
......
......@@ -49,7 +49,7 @@ class TradeController extends BaseController
return ['code' => 1, 'data' => [], 'msg' => '记录不存在'];
}
CoinHashMemo::updateAll(['memo' => $memo], 'hash = :hash',[':hash'=>$hash]);
CoinHashMemo::updateAll(['memo' => $memo], 'hash = :hash', [':hash' => $hash]);
return ['code' => 0, 'data' => [], 'msg' => '本地备注更新成功'];
}
......@@ -61,35 +61,39 @@ class TradeController extends BaseController
$request = Yii::$app->request;
$hash = $request->post('hash');
$version = $request->post('version', '');
if(empty($hash)) {
if (empty($hash)) {
return ['code' => 1, 'data' => [], 'msg' => '交易hash值不能为空'];
}
$model = CoinHashMemo::find()->where(['hash' => $hash])->asArray()->one();
if(empty($model)) {
return ['code' => 1, 'data' => [], 'msg' => '记录不存在'];
}
if(empty($version)){
if (empty($version)) {
if (empty($model)) {
return ['code' => 1, 'data' => '', 'msg' => '记录不存在'];
}
return ['code' => 0, 'data' => $model['memo']];
} else {
if (empty($model)) {
return ['code' => 0, 'data' => ['memo' => '', 'coins_fee' => ''], 'msg' => '记录不存在'];
}
return ['code' => 0, 'data' => [
'memo' => $model['memo'],
'coins_fee' => $model['coins_fee']
]];
}
return ['code' => 0, 'data' => [
'memo' => $model['memo'],
'coins_fee' => $model['coins_fee']
]];
}
public function actionSyncToDb()
{
$data = [];
$result = Yii::$app->redis->HGETALL ('trade_hash_memo');
foreach ($result as $key => $val){
if (($key + 2) % 2 == 0){
$result = Yii::$app->redis->HGETALL('trade_hash_memo');
foreach ($result as $key => $val) {
if (($key + 2) % 2 == 0) {
$data[] = [
'hash' => $val,
'memo' => $result[$key + 1]
];
}
}
foreach ($data as $val){
foreach ($data as $val) {
if ('0xc080c6a0937f25d1017e5e88bdcff5c3979810c8a6cc1f3a64cf50970da28fc9' == $val['hash']) continue;
$coin_memo_hash = new CoinHashMemo();
$coin_memo_hash->hash = $val['hash'];
......
This diff is collapsed.
......@@ -14,6 +14,7 @@ class CoinForm extends Model
{
public $id;
public $name;
public $optional_name;
public $nickname;
public $sid;
public $icon;
......@@ -49,6 +50,7 @@ class CoinForm extends Model
return [
'id' => 'ID',
'name' => '名称',
'optional_name' => '可选简称',
'nickname' => '别称',
'sid' => '全称',
'icon' => '图标',
......@@ -74,6 +76,7 @@ class CoinForm extends Model
'add' => [
'id',
'name',
'optional_name',
'nickname',
'sid',
'icon',
......@@ -92,6 +95,7 @@ class CoinForm extends Model
'update' => [
'id',
'name',
'optional_name',
'nickname',
'sid',
'icon',
......
......@@ -19,25 +19,33 @@
<input name="id" type="hidden" value="<?= $model->id ?>">
<div class="layui-inline">
<label class="layui-form-label">简称</label>
<div class="layui-input-block">
<input class="layui-input" name="name" placeholder="请填写大写字母" value="<?= $model->name ?>" lay-verify="required">
<div class="layui-input-block" style="width: 250px">
<input class="layui-input" name="name" placeholder="请填写大写字母" value="<?= $model->name ?>"
lay-verify="required">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">可选简称</label>
<div class="layui-input-block"style="width: 250px">
<input class="layui-input" name="optional_name" placeholder="请填写大写字母"
value="<?= $model->optional_name ?>" lay-verify="required">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">中文名</label>
<div class="layui-input-block" style="width: 250px">
<div class="layui-input-block" style="width: 190px">
<input class="layui-input" name="nickname[]" value="<?= $model->nickname['zh-CN'] ?>">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">英文名</label>
<div class="layui-input-block" style="width: 250px">
<div class="layui-input-block" style="width: 190px">
<input class="layui-input" name="nickname[]" value="<?= $model->nickname['en-US'] ?>">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">日文名</label>
<div class="layui-input-block" style="width: 250px">
<div class="layui-input-block" style="width: 190px">
<input class="layui-input" name="nickname[]" value="<?= $model->nickname['ja'] ?>">
</div>
</div>
......
......@@ -20,7 +20,15 @@
<div class="layui-inline">
<label class="layui-form-label">简称</label>
<div class="layui-input-block">
<input class="layui-input" name="name" placeholder="请填写大写字母" value="<?= $model->name ?>" lay-verify="required">
<input class="layui-input" name="name" placeholder="请填写大写字母" value="<?= $model->name ?>"
lay-verify="required">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">可选简称</label>
<div class="layui-input-block">
<input class="layui-input" name="optional_name" placeholder="请填写大写字母" value="<?= $model->optional_name ?>"
lay-verify="required">
</div>
</div>
<div class="layui-inline">
......@@ -76,7 +84,7 @@
<div class="layui-input-block">
<input type="text" class="layui-input" name="address" value="<?= $model->address ?>">
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">精度</label>
<div class="layui-input-block">
......@@ -121,10 +129,12 @@
<select name="treaty">
<option value="1" <?php if ($model->treaty == 1) {
echo "selected";
} ?>>token</option>
} ?>>token
</option>
<option value="2" <?php if ($model->treaty == 2) {
echo "selected";
} ?>>coins</option>
} ?>>coins
</option>
</select>
</div>
</div>
......
......@@ -253,7 +253,7 @@ class ExchangeBusiness
public static function getApiListForIndex($page = 1, $limit = 999, $condition = [], $fields = [])
{
if (!$fields) {
$fields = ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'treaty'];
$fields = ['id', 'sid', 'icon', 'name', 'optional_name', 'nickname', 'platform', 'chain', 'address as contract_address', 'treaty'];
}
$rows = Coin::getSelectList($page, $limit, $fields, $condition);
$count = 0;
......@@ -307,7 +307,7 @@ class ExchangeBusiness
*/
public static function SearchByName($page = 1, $limit = 10, $condition = [])
{
$rows = Coin::getSelectList($page, $limit, ['id', 'sid', 'icon', 'name', 'nickname', 'platform', 'chain', 'address as contract_address', 'treaty'],
$rows = Coin::getSelectList($page, $limit, ['id', 'sid', 'icon', 'name', 'optional_name', 'nickname', 'platform', 'chain', 'address as contract_address', 'treaty'],
$condition);
if ($rows['count'] > 0) {
$total = $rows['count'];
......
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