Example #1
0
 public function logTask($taskId, $taskType, $taskInfo, $isSuccess = 1, $context = array())
 {
     if (YII_ENV == 'dev') {
         //开发环境暂时记录同步日志
         $this->_log->logTask($taskId, $taskType, $taskInfo, $isSuccess, $context);
         return;
     }
     //如果改为同步写日志,则LogService中的task只能写DB保证稳定性
     $async = new \mysoft\helpers\AsyncService();
     $res = $async->Send('apps', 'erp-async-job/log-task', ['taskId' => $taskId, 'taskType' => $taskType, 'taskInfo' => $taskInfo, 'isSuccess' => $isSuccess, 'context' => $context, 'orgcode' => $this->_orgcode]);
 }
Example #2
0
 /**
  * 增加调用统计
  * @param type $orgcode
  * @param type $apiPath
  * @param type $success
  * @param type $costTime
  */
 private function _staticsApiCall($orgcode, $postData, $success, $context)
 {
     return;
     if (YII_ENV == 'dev') {
         return;
     }
     $msg = ['orgcode' => $orgcode, 'apiPath' => $postData['url'], 'success' => $success, 'costTime' => $context['requestTime'], 'bgnTime' => date('Y-m-d H:i:s')];
     if (isset($postData->data['ServiceName'])) {
         $msg['taskName'] = $postData->data['ServiceName'];
     }
     if (isset($context['taskId'])) {
         $msg['taskId'] = $context['taskId'];
     }
     if (isset($context['logId'])) {
         $msg['logId'] = $context['logId'];
     }
     $async = new \mysoft\helpers\AsyncService();
     $res = $async->Send('apps', 'erp-async-job/logging-erp-api-statics', ['message' => $msg]);
 }