/** * 通过userId获取账号关系 * @return array */ public static function getAjkUserAccountByUserId($userId) { try { $data_obj = Model_Payment_AjkUserAccount::data_access(); $data = $data_obj->filter('userId', $userId)->find_only(); return $data; } catch (Exception $e) { return array(); } }
/** * Job执行逻辑 */ public function handle_request() { $mail = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**'); $frozenList = Model_Payment_AcFreezen::data_access()->filter('freezeEffective', 1)->filter('appid', $this->appids)->filter_by_op('createTime', '<=', $this->errorTime)->get_all(); $re = $accountId = array(); if ($frozenList) { $this->setLog('今日共' . count($frozenList)); foreach ($frozenList as $frozen) { $word = $this->getWord($frozen['appid']); $re[$word['word']]['数量']++; $re[$word['word']]['金额'] += $frozen['amount']; $userInfo = Model_Payment_AjkUserAccount::data_access()->filter('accountId', $frozen['accountId'])->get_row(); if (!$userInfo['userId']) { continue; } $brokerInfo = Model_Broker_AjkBrokerExtend::data_access()->filter('userId', $userInfo['userId'])->get_row(); if (!$brokerInfo['brokerId']) { continue; } $brokerId = $brokerInfo['brokerId']; $accountId[$brokerId]['word'] = $word['word']; $accountId[$brokerId]['amount'] = $frozen['amount']; if ($this->dealFlag) { //解冻处理 $url = $this->acenterHost . 'acenter/interfaces/?action=use&account=' . $frozen['accountId'] . '&amount=0&frozen=' . $frozen['acBalanceId'] . '¬e=解冻金额&appid=' . $frozen['appid'] . '&appkey=' . $this->appInfo[$word['constWord']]['appKey'] . '&requestid=' . date('YmdHis') . mt_rand(0, 1000) . $frozen['accountId']; $result = Uri_Curl::get_curl($url); $this->setLog($url); $this->setLog($result); if ($result['result']) { //解冻成功,call @马荟的查询余额接口进行数据修复 $balanceUrl = $this->proxyHost . 'service-exes/rest/exes/inquiry?json&appId=23&appKey=' . $this->appInfo['ajk_bid']['appKey'] . '&account=' . $frozen['accountId']; $reBalance = Uri_Curl::get_curl($balanceUrl); $this->setLog($balanceUrl); $this->setLog($reBalance); $this->setLog('account: ' . $frozen['accountId'] . ' ,业务: ' . $word['word'] . ' ,amount: ' . $frozen['amount'] . ' ,serialNumber: ' . $frozen['acBalanceId']); } } } $str = '<table border="1"><tr><td>业务类型</td><td>数量</td><td>金额</td></tr>'; foreach ($re as $wr => $ac) { $str .= '<tr><td>' . $wr . '</td><td>' . $ac['数量'] . '</td><td>' . $ac['金额'] . '</td></tr>'; } $str .= '</table><br /><br /><table border="1"><tr><td>业务类型</td><td>经纪人ID</td><td>金额</td></tr>'; foreach ($accountId as $brokerId => $ac) { $str .= '<tr><td>' . $ac['word'] . '</td><td>' . $brokerId . '</td><td>' . $ac['amount'] . '</td></tr>'; } $str .= '</table>'; $this->send_mail($mail, '有问题的冻结共 ' . count($frozenList), $str); return true; } else { $this->send_mail($mail, '今天没有有问题的冻结', '今天没有有问题的冻结'); return true; } }