public function export(Request $request) { $bill = new WechatBill(); $builder = $bill->newQuery(); $page = $bill->input('page') ?: 0; $pagesize = $request->input('pagesize') ?: config('site.pagesize.export', 1000); $total = $this->_getCount($request, $builder); if (empty($page)) { $this->_of = $request->input('of'); $this->_table = $bill->getTable(); $this->_total = $total; $this->_pagesize = $pagesize > $total ? $total : $pagesize; return $this->view('wechat::admin.wechat.statement.export'); } $data = $this->_getExport($request, $builder); return $this->success('', FALSE, $data); }
/** * 支付回调 * @return [type] [description] */ public function feedback(Request $request, $aid, $oid = NULL) { $aid = $request->input('aid') ?: $aid; $oid = $request->input('oid') ?: $oid; $account = WechatAccount::findOrFail($aid); $api = new API($account->toArray(), $account->getKey()); $pay = new WechatPayTool($api); $result = $pay->notify(function ($result, &$message) use($account) { if ($result['return_code'] == 'SUCCESS') { $wechatUser = WechatUser::where('openid', $result['openid'])->firstOrFail(); $result = array_only($result, ['return_code', 'return_msg', 'mch_id', 'device_info', 'result_code', 'err_code', 'err_code_des', 'trade_type', 'bank_type', 'total_fee', 'fee_type', 'cash_fee', 'cash_fee_type', 'coupon_fee', 'coupon_count', 'transaction_id', 'out_trade_no', 'attach', 'time_end']); WechatBill::create($result + ['waid' => $account->getKey(), 'wuid' => $wechatUser->getKey()]); } else { WechatBill::create(['return_code' => $result['return_code'], 'return_msg' => $result['return_msg'], 'waid' => $account->getKey()]); } return true; }); return $result; }