-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
刘俊涛
committed
Dec 19, 2015
1 parent
c344540
commit 67cf607
Showing
5,095 changed files
with
131 additions
and
57 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
backend/mdmsoft/yii2-admin/controllers/AssignmentController.php
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified
0
backend/mdmsoft/yii2-admin/controllers/PermissionController.php
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
backend/mdmsoft/yii2-admin/migrations/m140602_111327_create_menu_table.php
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
backend/web/vagrant/yii/backend/web/upload/image/20151209/1449649302750605.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
backend/web/yii/backend/web/upload/image/20151209/1449649342574149.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
backend/web/yii/backend/web/upload/image/20151209/1449649360722510.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified
0
backend/web/yii/backend/web/upload/image/20151209/1449649435305665.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace common\models; | ||
|
||
use Yii; | ||
use yii\behaviors\TimestampBehavior; | ||
|
||
/** | ||
* This is the model class for table "{{%vote}}". | ||
* | ||
* @property integer $id | ||
* @property string $type | ||
* @property integer $user_id | ||
* @property integer $created_at | ||
* @property integer $updated_at | ||
*/ | ||
class Vote extends \yii\db\ActiveRecord | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function tableName() | ||
{ | ||
return '{{%vote}}'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
[['type', 'user_id','type_id'], 'required'], | ||
[['user_id', 'type_id'], 'integer'], | ||
[['type','action'], 'string', 'max' => 20], | ||
['action','in','range'=>['up','down']] | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function attributeLabels() | ||
{ | ||
return [ | ||
'id' => 'ID', | ||
'type' => 'Type', | ||
'user_id' => 'User ID', | ||
'created_at' => 'Created At', | ||
'updated_at' => 'Updated At', | ||
]; | ||
} | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function behaviors() | ||
{ | ||
return [ | ||
TimestampBehavior::className(), | ||
]; | ||
} | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
/** | ||
* author: yidashi | ||
* Date: 2015/12/11 | ||
* Time: 16:58 | ||
*/ | ||
|
||
namespace frontend\controllers; | ||
|
||
|
||
use common\models\Comment; | ||
use common\models\Vote; | ||
use frontend\models\Article; | ||
use yii\helpers\Url; | ||
use yii\web\Controller; | ||
use yii\web\ForbiddenHttpException; | ||
use yii\web\Response; | ||
use yii\filters\AccessControl; | ||
|
||
class VoteController extends Controller{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function behaviors() | ||
{ | ||
return [ | ||
'access' => [ | ||
'class' => AccessControl::className(), | ||
'rules' => [ | ||
[ | ||
'actions' => ['index'], | ||
'allow' => true, | ||
'roles' => ['@'], | ||
], | ||
], | ||
], | ||
]; | ||
} | ||
public function actionIndex() | ||
{ | ||
\Yii::$app->response->format = Response::FORMAT_JSON; | ||
$userId = \Yii::$app->user->id; | ||
$id = \Yii::$app->request->get('id'); | ||
$type = \Yii::$app->request->get('type','article'); | ||
$action = \Yii::$app->request->get('action','up'); | ||
$article = Article::find()->where(['id'=>$id])->select('id,up,down')->one(); | ||
$vote = Vote::find()->where(['type_id'=>$id, 'type'=>$type, 'action'=>$action, 'user_id'=>$userId])->one(); | ||
if(empty($vote)){ | ||
$article->$action += 1; | ||
$article->save(false); | ||
$vote = new Vote(); | ||
$params = [ | ||
'type'=>$type, | ||
'action'=>$action, | ||
'type_id'=>$id, | ||
'user_id'=>$userId | ||
]; | ||
$vote->attributes = $params; | ||
$vote->save(); | ||
|
||
} | ||
return [ | ||
'up'=> $article->up, | ||
'down' => $article->down | ||
]; | ||
} | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Oops, something went wrong.