Commit 9c0b22c2 authored by shajiaiming's avatar shajiaiming

update column

parent 6ea915a8
......@@ -19,23 +19,25 @@ class VisitStatisticsController extends BaseController
public function actionIndex()
{
$dapp = Yii::$app->request->get('dapp', '');
$dapp_name = Yii::$app->request->get('dapp_name', '');
$identify = Yii::$app->request->get('identify', '');
$duration = Yii::$app->request->get('duration', '');
$address = Yii::$app->request->get('address', '');
$dapp_address = Yii::$app->request->get('dapp_address', '');
$coins_address = Yii::$app->request->get('coins_address', '');
$platform_id = Yii::$app->request->get('platform_id', '');
if(empty($dapp) || empty($identify) || empty($duration) || empty($address) || empty($platform_id)){
if(empty($dapp_name) || empty($identify) || empty($duration) || empty($dapp_address) || empty($coins_address) || empty($platform_id)){
return ['code' => -1,'data' => [], 'msg' => '缺少必要的参数'];
}
$isExistModel = CoinDailyStatistics::find()->where(['identify' => $identify, 'platform_id' => $platform_id])->one();
if(!$isExistModel) {
$model = new CoinDailyStatistics();
$model->dapp = $dapp;
$model->dapp_name = $dapp_name;
$model->dapp_address = $dapp_address;
$model->duration = $duration;
$model->address = $address;
$model->identify = $identify;
$model->coins_address = $coins_address;
$model->platform_id = $platform_id;
$model->save();
return ['code' => 0,'data' => [], 'msg' => '数据记录插入成功'];
......@@ -50,18 +52,19 @@ class VisitStatisticsController extends BaseController
public function actionDailyTimes()
{
$dapp = Yii::$app->request->get('dapp', '');
$address = Yii::$app->request->get('address', '');
$dapp_name = Yii::$app->request->get('dapp_name', '');
$dapp_address = Yii::$app->request->get('dapp_address', '');
$coins_address = Yii::$app->request->get('coins_address', '');
$platform_id = Yii::$app->request->get('platform_id', '');
if(empty($dapp) || empty($address) || empty($platform_id)){
if(empty($dapp_name) || empty($dapp_address) || empty($coins_address) || empty($platform_id)){
return ['code' => -1,'data' => [], 'msg' => '缺少必要的参数'];
}
$begin = date("Y-m-d",time())." 00:00:00";
$end = date("Y-m-d",time())." 23:59:59";
$isExist_coinDailyNumbers = CoinDailyNumbers::find()
->where(['dapp' => $dapp, 'address' => $address, 'platform_id' => $platform_id])
->where(['dapp_name' => $dapp_name, 'dapp_address' => $dapp_address, 'coins_address' => $coins_address, 'platform_id' => $platform_id])
->andWhere(['between', 'create_time', $begin, $end])
->one();
if(!$isExist_coinDailyNumbers){
......
......@@ -25,14 +25,14 @@ class CoinDailyNumbers extends BaseActiveRecord
public function rules() {
return [
[['dapp','address', 'platform_id'], 'required'],
[['dapp_name','dapp_address', 'coins_address', 'platform_id'], 'required'],
[['platform_id'],'match','pattern'=>'/^[0-9]+$/','message' => '{attribute} 必须为数字'],
];
}
public function scenarios() {
$scenarios = [
self:: SCENARIOS_CREATE => ['dapp', 'address', 'platform_id'],
self:: SCENARIOS_CREATE => ['dapp_name','dapp_address', 'coins_address', 'platform_id'],
];
return array_merge( parent:: scenarios(), $scenarios);
}
......
......@@ -25,14 +25,14 @@ class CoinDailyTimes extends BaseActiveRecord
public function rules() {
return [
[['dapp','address', 'platform_id'], 'required'],
[['dapp_name','dapp_address', 'coins_address', 'platform_id'], 'required'],
[['platform_id'],'match','pattern'=>'/^[0-9]+$/','message' => '{attribute} 必须为数字'],
];
}
public function scenarios() {
$scenarios = [
self:: SCENARIOS_CREATE => ['dapp', 'address', 'platform_id'],
self:: SCENARIOS_CREATE => ['dapp_name','dapp_address', 'coins_address', 'platform_id'],
];
return array_merge( parent:: scenarios(), $scenarios);
}
......
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