Completed
Push — master ( a107f0...697b33 )
by graychen
12:14 queued 03:42
created
src/actions/JdVerifyAction.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 use graychen\yii2\jd\deposit\filters\JdSignAuth;
5 5
 use yii\filters\VerbFilter;
6 6
 use yii\filters\RateLimiter;
7
-use yii\base\Action;
8 7
 
9 8
 class JdVerifyAction extends action
10 9
 {
Please login to merge, or discard this patch.
src/controllers/DepositController.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     /**
57 57
      * 生成签名验证串sign
58
-     * @param array $params post或get请求的请求参数数组
58
+     * @param string $params post或get请求的请求参数数组
59 59
      * @return string sign签名验证串
60 60
      */
61 61
     public function createSign($params)
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     /**
70 70
      * Lists all Order models.
71
-     * @return mixed
71
+     * @return string
72 72
      */
73 73
     public function actionIndex()
74 74
     {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     /**
87 87
      * Displays a single Order model.
88 88
      * @param integer $id
89
-     * @return mixed
89
+     * @return string
90 90
      */
91 91
     public function actionView($id)
92 92
     {
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * Deletes an existing Order model.
100 100
      * If deletion is successful, the browser will be redirected to the 'index' page.
101 101
      * @param integer $id
102
-     * @return mixed
102
+     * @return \yii\web\Response
103 103
      */
104 104
     public function actionDelete($id)
105 105
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $params = Yii::$app->request->getBodyParams();
37 37
         $client = new Client();
38
-        $data = base64_encode(json_encode(['orderId' =>$params['orderId'],'orderStatus'=>$params['orderStatus']]));
38
+        $data = base64_encode(json_encode(['orderId' =>$params['orderId'], 'orderStatus'=>$params['orderStatus']]));
39 39
         $allData = [
40 40
             'customerId' => getenv('JINDONG_API_CUSTOMERID'),
41 41
             'timestamp'=>date("YmdHis"),
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
             'data'=>$data
44 44
         ];
45 45
         $res = $client->request('POST', 'http://card.jd.com/api/gameApi.action', $allData);
46
-        $body=$res->getBody();
47
-        $arrBody=json_decode($body, true);
48
-        if ($arrBody['retCode']==100) {
49
-            $orderDeposit=OrderDeposit::find()->where(['sn'=>'JD'.$params['orderId']])->one();
50
-            $orderDeposit->status=$params['orderStatus'];
46
+        $body = $res->getBody();
47
+        $arrBody = json_decode($body, true);
48
+        if ($arrBody['retCode'] == 100) {
49
+            $orderDeposit = OrderDeposit::find()->where(['sn'=>'JD' . $params['orderId']])->one();
50
+            $orderDeposit->status = $params['orderStatus'];
51 51
             $orderDeposit->save();
52 52
         }
53 53
         return $body;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     public function createSign($params)
62 62
     {
63 63
         $data = $params;
64
-        $signStr="customerId=".getenv('JINDONG_API_CUSTOMERID')."&data=".$data."&timestamp=".date("YmdHis")."&".getenv('JINDONG_API_PRIVATEKEY');
64
+        $signStr = "customerId=" . getenv('JINDONG_API_CUSTOMERID') . "&data=" . $data . "&timestamp=" . date("YmdHis") . "&" . getenv('JINDONG_API_PRIVATEKEY');
65 65
         $sign = md5($signStr);
66 66
         return $sign;
67 67
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $searchModel = new SearchDeposit();
76 76
         $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
77
-        $total=Order::getOrderTotal();
77
+        $total = Order::getOrderTotal();
78 78
 
79 79
         return $this->render('index', [
80 80
             'searchModel' => $searchModel,
Please login to merge, or discard this patch.
src/models/Order.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
 
99 99
     /**
100 100
      * 订单状态列表
101
-     * @return array
101
+     * @return string[]
102 102
      */
103 103
     public static function getStatusList()
104 104
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@
 block discarded – undo
52 52
     public function rules()
53 53
     {
54 54
         return [
55
-           [['id', 'game_id', 'type','user_id','hours', 'status', 'created_at', 'updated_at', 'payment_method'], 'integer'],
56
-           [['sn',  'serverinfo', 'account', 'password', 'remark', 'client_id', 'name', 'description'], 'safe'],
57
-           [['count', 'final_price'], 'number'],
55
+            [['id', 'game_id', 'type','user_id','hours', 'status', 'created_at', 'updated_at', 'payment_method'], 'integer'],
56
+            [['sn',  'serverinfo', 'account', 'password', 'remark', 'client_id', 'name', 'description'], 'safe'],
57
+            [['count', 'final_price'], 'number'],
58 58
         ];
59 59
     }
60 60
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
 class Order extends \yii\db\ActiveRecord
13 13
 {
14 14
     public $source = 'PC';
15
-    const TYPE_JD= 'JD充值';
16
-    const SOURCE_JD= 'JD';//京东
15
+    const TYPE_JD = 'JD充值';
16
+    const SOURCE_JD = 'JD'; //京东
17 17
     const PAYMENT_METHOD_JD = 9; //京东支付
18 18
 
19
-    const STATUS_SUCCESS=0;
20
-    const STATUS_RECHARGE=1;
21
-    const STATUS_FAILURE=2;
19
+    const STATUS_SUCCESS = 0;
20
+    const STATUS_RECHARGE = 1;
21
+    const STATUS_FAILURE = 2;
22 22
 
23 23
     const TYPE_PEIWAN_PUTONG = 1; //普通陪玩
24 24
     const TYPE_PEIWAN_YANZHI = 2; //颜值陪玩
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     public function rules()
53 53
     {
54 54
         return [
55
-           [['id', 'game_id', 'type','user_id','hours', 'status', 'created_at', 'updated_at', 'payment_method'], 'integer'],
56
-           [['sn',  'serverinfo', 'account', 'password', 'remark', 'client_id', 'name', 'description'], 'safe'],
55
+           [['id', 'game_id', 'type', 'user_id', 'hours', 'status', 'created_at', 'updated_at', 'payment_method'], 'integer'],
56
+           [['sn', 'serverinfo', 'account', 'password', 'remark', 'client_id', 'name', 'description'], 'safe'],
57 57
            [['count', 'final_price'], 'number'],
58 58
         ];
59 59
     }
Please login to merge, or discard this patch.
src/models/OrderDeposit.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace graychen\yii2\jd\deposit\models;
4 4
 
5
-use Yii;
6 5
 use yii\base\Model;
7 6
 use yii\behaviors\TimestampBehavior;
8 7
 use yii\web\ConflictHttpException;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
  */
13 13
 class OrderDeposit extends Model
14 14
 {
15
-    public $orderId;//京东订单号
16
-    public $buyNum;//购买数量
15
+    public $orderId; //京东订单号
16
+    public $buyNum; //购买数量
17 17
     public $skuId; //对应京东的商品 skuId
18 18
     public $brandId; //对应京东游戏品牌 ID
19 19
     public $userIp; //用户 ip 地址
Please login to merge, or discard this patch.
src/models/SearchDeposit.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace graychen\yii2\jd\deposit\models;
4 4
 
5
-use Yii;
6 5
 use yii\base\Model;
7 6
 use yii\data\ActiveDataProvider;
8 7
 use graychen\yii2\jd\deposit\models\Order;
Please login to merge, or discard this patch.
src/views/default/index.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
                 'created_at:dateTime',
84 84
                 [
85 85
                     'attribute' => 'payment_method',
86
-                    'value' => function ($model) {
86
+                    'value' => function($model) {
87 87
                         return '京东支付';
88 88
                     }
89 89
                 ],
90 90
                 [
91 91
                     'attribute' => 'status',
92
-                    'value' => function ($model) {
92
+                    'value' => function($model) {
93 93
                         return OrderDeposit::getStatusList()[$model->status];
94 94
                     }
95 95
                 ],
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
                     'class' => 'yii\grid\ActionColumn',
100 100
                     'template' => '{view} {successStatus} {failStatus}',
101 101
                     'buttons' => [
102
-                        'successStatus' => function ($url, $model, $key) {
102
+                        'successStatus' => function($url, $model, $key) {
103 103
                             return Html::a('<span>充值成功</span>', 'javascript:void(0);', [
104 104
                                 'title' => '充值成功',
105 105
                                 'onclick' => 'changeStatus(' . substr($model->sn, 2) . ',0,this)'
106 106
                             ]);
107 107
                         },
108
-                        'failStatus' => function ($url, $model, $key) {
108
+                        'failStatus' => function($url, $model, $key) {
109 109
                             return Html::a('<span>充值失败</span>', 'javascript:void(0);', [
110 110
                                 'title' => '充值失败',
111 111
                                 'onclick' => 'changeStatus(' . substr($model->sn, 2) . ',2,this)'
Please login to merge, or discard this patch.
src/views/default/view.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
             'game_id',
35 35
             [
36 36
                 'attribute' => 'type',
37
-                'value' => function ($model) {
37
+                'value' => function($model) {
38 38
                     return $model::getTypeList()[$model->type];
39 39
                 }
40 40
             ],
41 41
             [
42 42
                 'attribute' => 'beauty',
43
-                'value' => function ($model) {
43
+                'value' => function($model) {
44 44
                     return $model::getBeautyList()[$model->beauty];
45 45
                 }
46 46
             ],
47 47
             'user_id',
48 48
             [
49 49
                 'attribute' => 'current_tiers',
50
-                'value' => function ($model) {
51
-                    return DataPack::kingGloryLevels()[$model->current_tiers-1]['name'];
50
+                'value' => function($model) {
51
+                    return DataPack::kingGloryLevels()[$model->current_tiers - 1]['name'];
52 52
                 },
53 53
                 'visible' => $model->game_id == $model::GAME_KG,
54 54
             ],
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
             ],
59 59
             [
60 60
                 'attribute' => 'target_tiers',
61
-                'value' => function ($model) {
62
-                    return DataPack::kingGloryLevels()[$model->target_tiers-1]['name'];
61
+                'value' => function($model) {
62
+                    return DataPack::kingGloryLevels()[$model->target_tiers - 1]['name'];
63 63
                 },
64 64
                 'visible' => $model->game_id == $model::GAME_KG,
65 65
             ],
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             'remark',
84 84
             [
85 85
                 'attribute' => 'status',
86
-                'value' => function ($model) {
86
+                'value' => function($model) {
87 87
                     return $model::getStatusList()[$model->status];
88 88
                 }
89 89
             ],
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             'updated_at:dateTime',
92 92
             [
93 93
                 'attribute' => 'payment_method',
94
-                'value' => function ($model) {
94
+                'value' => function($model) {
95 95
                     return $model::getPaymentMethodList()[$model->payment_method];
96 96
                 }
97 97
             ],
Please login to merge, or discard this patch.