Commit 8609825e authored by ZhuChunYang's avatar ZhuChunYang

update

parent 2d5efe4d
......@@ -80,6 +80,9 @@ class CoinController extends BaseController
$coin = Yii::createObject(Coin::className());
$data = array_merge($request->post(), ['platform_id' => Yii::$app->user->identity->platform_id]);
unset($data['id']);
$data['name'] = strtoupper($data['name']);
$data['platform'] = strtolower($data['platform']);
$data['chain'] = strtoupper($data['chain']);
$result = $coin->addOne($data);
if ($result === true) {
$this->success('添加成功', '/admin/coin/index');
......@@ -103,11 +106,16 @@ class CoinController extends BaseController
public function actionEdit()
{
if (Yii::$app->request->isPost) {
$model = new CoinForm();
$model->scenario = 'update';
$req = Yii::$app->request;
$data = $req->post();
$data['name'] = strtoupper($data['name']);
$data['platform'] = strtolower($data['platform']);
$data['chain'] = strtoupper($data['chain']);
Yii::$app->response->format = 'json';
if ($model->load($req->post()) && $model->validate()) {
if ($model->load($data) && $model->validate()) {
$platform_id = Yii::$app->user->identity->platform_id;
$can = false;
......
......@@ -20,7 +20,7 @@
<div class="layui-inline">
<label class="layui-form-label">简称</label>
<div class="layui-input-block">
<input class="layui-input" name="name" 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">
......@@ -88,13 +88,13 @@
<div class="layui-form-item">
<label class="layui-form-label">平台</label>
<div class="layui-input-block">
<input class="layui-input" name="platform" value="<?= $model->platform ?>">
<input class="layui-input" name="platform" placeholder="请填写小写字母" value="<?= $model->platform ?>">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">类型</label>
<div class="layui-input-block">
<input class="layui-input" name="chain" value="<?= $model->chain ?>">
<input class="layui-input" name="chain" placeholder="请填写小写字母" value="<?= $model->chain ?>">
</div>
</div>
<div class="layui-form-item">
......
......@@ -20,7 +20,7 @@
<div class="layui-inline">
<label class="layui-form-label">简称</label>
<div class="layui-input-block">
<input class="layui-input" name="name" 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">
......@@ -88,13 +88,13 @@
<div class="layui-form-item">
<label class="layui-form-label">平台</label>
<div class="layui-input-block">
<input class="layui-input" name="platform" value="<?= $model->platform ?>">
<input class="layui-input" name="platform" placeholder="请填写小写字母" value="<?= $model->platform ?>">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">类型</label>
<div class="layui-input-block">
<input class="layui-input" name="chain" value="<?= $model->chain ?>">
<input class="layui-input" name="chain" placeholder="请填写小写字母" value="<?= $model->chain ?>">
</div>
</div>
<div class="layui-form-item">
......
......@@ -132,7 +132,7 @@ class Coin extends BaseActiveRecord
public static function getPlatformList()
{
$data = self::find()->select('platform')->asArray()->all();
$data = array_unique(array_map('strtoupper', array_column($data, 'platform')));
$data = array_unique(array_map('strtolower', array_column($data, 'platform')));
return $data;
}
......
<?php
/**
* Created by PhpStorm.
* User: ZCY
* Date: 2018/11/22
* Time: 10:57
*/
namespace console\controllers;
use yii\console\Controller;
class CrawlerController extends Controller
{
public function actionCoinInfo()
{
$feixiaohao_url = "https://www.feixiaohao.com/currencies/vechain";
$content = file_get_contents($feixiaohao_url);
$patt = "/<li><span class=tit>发行时间:<\/span> <span class=value>(.+?)<\/span><li>/";
preg_match($patt, $content, $res);
var_dump($res);
}
}
\ No newline at end of file
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