Beispiel #1
0
 public function check($data, $isISystem = false)
 {
     $requiredItems = $this->getRequiredItems($isISystem);
     foreach ($requiredItems as $key => $item) {
         if (!isset($data[$key])) {
             return $item;
         }
     }
     if (!$isISystem) {
         $mAppBase = new ApplicationBase();
         $appNO = $data['appNO'];
         $appInfo = $mAppBase->pk($appNO);
         if (!$appInfo) {
             return [2201, 'error_appno_invalid'];
         }
         $appKey = $appInfo['app_key'];
         $appID = trim(Yii::$app->util->decrypt($data['appID'], $appKey));
         if ($appID !== $appInfo['app_id']) {
             return [2202, 'error_appid_invalid'];
         }
     } else {
         $appID = $data['appID'];
     }
     $mAppService = new ServiceBinding();
     $serviceID = $this->getServiceID();
     $appService = $mAppService->getAppService($appID, $serviceID);
     if (!$appService) {
         return [2401, 'error_service_not_bound'];
     }
     if (!$isISystem) {
         $asKey = $appService['as_key'];
         if (!Yii::$app->sign->checkSign($data, $asKey)) {
             return [1201, 'error_sign'];
         }
     }
     return $this->customCheck($appID, $data, $isISystem);
 }