Example #1
0
 public function beforeAction($action)
 {
     if (parent::beforeAction($action)) {
         $headers = Yii::$app->request->headers;
         $this->client = Client::findOne(['app_id' => $headers['app-id']]);
         return true;
     }
 }
Example #2
0
 /**
  * 验证头
  * @author Allon<*****@*****.**>
  * @dateTime 2015-12-11T18:02:01+0800
  * @param    [type]                   $headers [description]
  * @return   boolean                           是否合法
  */
 public function checkHeader($headers)
 {
     $client = Client::findOne(['app_id' => $headers['app-id']]);
     if (!$client) {
         return false;
     }
     if ($client->validateHashKey($headers['once'], $headers['signkey'])) {
         return true;
     }
     return false;
 }