provider.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. <?php
  2. include(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
  3. require_once(BASE_HELPER_PATH . '/model/member_info.php');
  4. require_once(BASE_HELPER_PATH . '/refill/chprice_helper.php');
  5. class providerControl extends SystemControl
  6. {
  7. public function __construct()
  8. {
  9. parent::__construct();
  10. }
  11. public function indexOp()
  12. {
  13. global $config;
  14. $provider_model = Model('refill_provider');
  15. $condition = [];
  16. if (trim($_GET['name']) != '') {
  17. $condition['store_name'] = ['like', '%' . $_GET['name'] . '%'];
  18. Tpl::output('name', $_GET['name']);
  19. }
  20. if (in_array($_GET['type'], [mtopcard\OilCardPaper, mtopcard\PhoneCardPaper, mtopcard\ThirdCardPaper])) {
  21. $condition['type'] = $_GET['type'];
  22. }
  23. if(!empty($_GET['quality'])) {
  24. $condition['qualitys'] = ['like', '%' . $_GET['quality'] . '%'];
  25. }
  26. if(!empty($_GET['export'])) {
  27. $condition['opened'] = 1;
  28. }
  29. $provider_items = $provider_model->table('refill_provider,store')
  30. ->field('refill_provider.*,store.store_name,store.member_id')
  31. ->join('inner')
  32. ->on('store.store_id=refill_provider.store_id')
  33. ->where($condition)
  34. ->order('opened asc, name asc')
  35. ->page(200)
  36. ->select();
  37. $providers = [];
  38. $mid_pids = [];
  39. $mids = [];
  40. foreach ($provider_items as $provider)
  41. {
  42. $pid = $provider['provider_id'];
  43. $providers[$pid] = $provider;
  44. $providers[$pid]['available_predeposit'] = 0;
  45. $quality_text = $provider['type'] == mtopcard\OilCardPaper ? $config['oil_quality_text'] : $config['phone_quality_text'];
  46. $providers[$pid]['quality_text'] = $quality_text[$provider['qualitys']];
  47. $account_id = intval($provider['account_id']);
  48. if($account_id > 0) {
  49. $mid_pids[$account_id] = $pid;
  50. $mids[] = $account_id;
  51. }
  52. }
  53. $debt_total = 0;
  54. $available_total = 0;
  55. if(!empty($mids))
  56. {
  57. $member_data = Model('member')->field('member_id,available_predeposit')->where(['member_id' => ['in',$mids]])->select();
  58. foreach ($member_data as $member)
  59. {
  60. $mid = intval($member['member_id']);
  61. if(array_key_exists($mid,$mid_pids)) {
  62. $pid = $mid_pids[$mid];
  63. $providers[$pid]['available_predeposit'] = $member['available_predeposit'];
  64. if($providers[$pid]['opened'] != 1) continue;
  65. if ($member['available_predeposit'] >= 0) {
  66. $available_total += $member['available_predeposit'];
  67. } else {
  68. $debt_total += $member['available_predeposit'];
  69. }
  70. }
  71. }
  72. }
  73. if(!empty($_GET['export']))
  74. {
  75. $this->provider_export($providers);
  76. return;
  77. }
  78. $stats = ['available_total' => $available_total, 'debt_total' => $debt_total];
  79. $opened_text = ['使用中', '已禁用'];
  80. $type_text = ['油卡', '手机充值卡', '增值业务'];
  81. Tpl::output('opened_text', $opened_text);
  82. Tpl::output('type_text', $type_text);
  83. Tpl::output('provider_list', $providers);
  84. Tpl::output('stats', $stats);
  85. Tpl::output('prices', $this->all_price());
  86. Tpl::output('show_page', $provider_model->showpage());
  87. Tpl::showpage('provider.index');
  88. }
  89. private function all_price()
  90. {
  91. $result = [];
  92. $mod_price = Model('provider_price');
  93. $prices = $mod_price->getPirces(['price_id' => ['gt', 0]]);
  94. foreach ($prices as $price)
  95. {
  96. $key = "{$price['provider_name']}-{$price['product_type']}";
  97. if(!empty($price['effect_time']))
  98. {
  99. $time = '<span style="color: #0bb20c">' . date("Y-m-d H:i:s", $price['effect_time']) . '</span>';
  100. }else{
  101. $time = date("Y-m-d H:i:s", $price['update_time']);
  102. }
  103. $result[$key] = $time;
  104. }
  105. return $result;
  106. }
  107. public function recharge_manualOp()
  108. {
  109. $provider_id = $_GET['provider_id'] ?? $_POST['provider_id'];
  110. $provider_model = Model('refill_provider');
  111. $provider_info = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
  112. if (empty($provider_info)) {
  113. showMessage('通道信息有误');
  114. }
  115. if (chksubmit())
  116. {
  117. $obj_validate = new Validator();
  118. $obj_validate->validateparam = [
  119. ["input" => $_POST["operation"], "require" => "true", "message" => '操作人姓名不能为空'],
  120. ["input" => $_POST["pointsnum"], "require" => "true", "message" => '预存金额不能为空']
  121. ];
  122. $operatetype = $_POST['operatetype'];
  123. $pointsnum = $_POST['pointsnum'];
  124. $money = abs($pointsnum);
  125. if ($money == 0) {
  126. showMessage('金额错误');
  127. }
  128. try {
  129. $model_merchant = Model('merchant');
  130. $trans = new trans_wapper($model_merchant, __METHOD__);
  131. $member_id = $provider_info['account_id'];
  132. if ($operatetype == 'add') {
  133. $bz = "管理员调款操作,手动增加通道余额";
  134. $this->credit_save_money($money, 'add', $member_id, $bz);
  135. $_POST['pointsnum'] = $money;
  136. } elseif ($operatetype == 'del') {
  137. $bz = "管理员调款操作,手动减少通道余额";
  138. $this->credit_save_money($money, 'del', $member_id, $bz);
  139. $_POST['pointsnum'] = -($money);
  140. } else {
  141. showMessage('预存类型错误');
  142. }
  143. $result = $this->ct_provider_amount($_POST, $provider_info);
  144. if (!$result) {
  145. $trans->rollback();
  146. showMessage('操作失败');
  147. }
  148. $trans->commit();
  149. showMessage('操作成功', 'index.php?act=provider&op=index');
  150. } catch (Exception $e) {
  151. $trans->rollback();
  152. showMessage('操作失败');
  153. }
  154. }
  155. else
  156. {
  157. Tpl::output('provider', $provider_info);
  158. Tpl::showpage('provider.recharge');
  159. }
  160. }
  161. private function ct_provider_amount($params, $provider_info)
  162. {
  163. $input['provider_id'] = $provider_info['provider_id'];
  164. $input['memeber_id'] = $provider_info['account_id'];
  165. $input['amount'] = $params['pointsnum'];
  166. $input['operation'] = $params['operation'];
  167. $input['add_time'] = time();
  168. $input['bz'] = $params['bz'] ?? '';
  169. return Model('provider_amount')->addAmount($input);
  170. }
  171. public function provider_amountOp()
  172. {
  173. $condition = [];
  174. if(!empty($_GET['provider_id'])) {
  175. $condition['provider_id'] = $_GET['provider_id'];
  176. }
  177. $start_unixtime = intval(strtotime($_GET['query_start_time']));
  178. $end_unixtime = intval(strtotime($_GET['query_end_time']));
  179. if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
  180. $condition['add_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
  181. } elseif ($start_unixtime > 0) {
  182. $condition['add_time'] = ['egt', $start_unixtime];
  183. } elseif ($end_unixtime > 0) {
  184. $condition['add_time'] = ['lt', $end_unixtime];
  185. }
  186. if (!empty($_GET['export'])) {
  187. $this->ProviderAmountExport($condition);
  188. return;
  189. }
  190. $provider_list = $this->providers();
  191. foreach ($provider_list as $provider) {
  192. $providers[$provider['provider_id']] = $provider;
  193. }
  194. $mod = Model('provider_amount');
  195. $list = $mod->getAmountList($condition,50,'*', 'add_time desc', '', true);
  196. foreach ($list as $key => $value) {
  197. $list[$key]['provider_name'] = $providers[$value['provider_id']]['name'];
  198. $list[$key]['store_name'] = $providers[$value['provider_id']]['store_name'];
  199. }
  200. $stat = Model()->table('provider_amount')
  201. ->where($condition)
  202. ->field('sum(amount) as amounts')
  203. ->find();
  204. Tpl::output('stat', $stat);
  205. Tpl::output('provider_list', $providers);
  206. Tpl::output('show_page', $mod->showpage());
  207. Tpl::output('info_list', $list);
  208. Tpl::showpage('provider.amount');
  209. }
  210. public function sync_cfgs()
  211. {
  212. $name_val = function ($items) {
  213. $result = [];
  214. foreach ($items as $item) {
  215. $name = $item['name'];
  216. $result[$name] = $item;
  217. }
  218. return $result;
  219. };
  220. $match = function ($all, $cur) {
  221. $inserts = $updates = [];
  222. foreach ($all as $key => $value) {
  223. if (!array_key_exists($key, $cur)) {
  224. $insert['name'] = $key;
  225. $insert['store_id'] = $value['cfg']['store_id'];
  226. $insert['qualitys'] = $value['cfg']['qualitys'];
  227. $inserts[] = $insert;
  228. } elseif ($value['cfg']['qualitys'] != $cur[$key]['qualitys']) {
  229. $update['provider_id'] = $cur[$key]['provider_id'];
  230. $update['qualitys'] = $value['cfg']['qualitys'];
  231. $updates[] = $update;
  232. }
  233. }
  234. return [$inserts, $updates];
  235. };
  236. $updater = function ($mod, $updates) {
  237. if (empty($updates)) return;
  238. foreach ($updates as $update) {
  239. $provider_id = $update['provider_id'];
  240. $data = ['qualitys' => $update['qualitys']];
  241. $mod->editProvider($data, ['provider_id' => $provider_id]);
  242. }
  243. };
  244. $inserter = function ($mod, $type, $names)
  245. {
  246. $model_member = Model('member');
  247. foreach ($names as $name) {
  248. $insert_member = [];
  249. $insert_member['member_name'] = "{$name['name']}-refill";
  250. $insert_member['member_passwd'] = md5($name['name']);
  251. $insert_id = $model_member->addMember($insert_member);
  252. $helper = new refill\divert_account();
  253. $helper->init_member($insert_id);
  254. $data = ['name' => $name['name'], 'type' => $type, 'store_id' => $name['store_id'], 'qualitys' => $name['qualitys'], 'opened' => 2, 'account_id' => $insert_id];
  255. $mod->insert($data);
  256. }
  257. };
  258. global $config;
  259. $oil_configs = $config['oil_providers'];
  260. $pho_configs = $config['phone_providers'];
  261. $third_configs = $config['third_providers'];
  262. $oils = $name_val($oil_configs);
  263. $phones = $name_val($pho_configs);
  264. $third = $name_val($third_configs);
  265. $mod_prov = Model('refill_provider');
  266. $oil_items = $mod_prov->getProviderList(['type' => 1]);
  267. $oil_items = $name_val($oil_items);
  268. [$oil_inserts, $oil_updates] = $match($oils, $oil_items);
  269. $phone_items = $mod_prov->getProviderList(['type' => 2]);
  270. $phone_items = $name_val($phone_items);
  271. [$phone_inserts, $phone_updates] = $match($phones, $phone_items);
  272. $third_items = $mod_prov->getProviderList(['type' => 3]);
  273. $third_items = $name_val($third_items);
  274. [$third_inserts, $third_updates] = $match($third, $third_items);
  275. $inserter($mod_prov, 1, $oil_inserts);
  276. $inserter($mod_prov, 2, $phone_inserts);
  277. $inserter($mod_prov, 3, $third_inserts);
  278. $updater($mod_prov, $oil_updates);
  279. $updater($mod_prov, $phone_updates);
  280. $updater($mod_prov, $third_updates);
  281. $chprice_helper = new refill\chprice_helper();
  282. $chprice_helper->update_from_file();
  283. }
  284. private function ProviderAmountExport($cond)
  285. {
  286. $result = Model('provider_amount')->getAllDatas($cond);
  287. $this->createExcel($result);
  288. }
  289. private function createExcel($data = [])
  290. {
  291. if(empty($data)) {
  292. showMessage('数据为空');
  293. }
  294. Language::read('export');
  295. import('libraries.excel');
  296. $provider_list = $this->providers();
  297. $providers = [];
  298. foreach ($provider_list as $provider) {
  299. $providers[$provider['provider_id']] = $provider;
  300. }
  301. $excel_obj = new Excel();
  302. $excel_data = [];
  303. //设置样式
  304. $excel_obj->setStyle(['id' => 's_title', 'Font' => ['FontName' => '宋体', 'Size' => '12', 'Bold' => '1']]);
  305. //header
  306. $excel_data[0][] = ['styleid' => 's_title', 'data' => '序号'];
  307. $excel_data[0][] = ['styleid' => 's_title', 'data' => '通道名称'];
  308. $excel_data[0][] = ['styleid' => 's_title', 'data' => '调款金额'];
  309. $excel_data[0][] = ['styleid' => 's_title', 'data' => '操作日期'];
  310. $excel_data[0][] = ['styleid' => 's_title', 'data' => '操作人'];
  311. //data
  312. foreach ((array)$data as $k => $v) {
  313. $tmp = [];
  314. $provider_id = intval($v['provider_id']);
  315. $provider = $providers[$provider_id];
  316. $store_name = "{$provider['name']}({$provider['store_name']})";
  317. $tmp[] = ['data' => $k+1];
  318. $tmp[] = ['data' => $store_name];
  319. $tmp[] = ['data' => $v['amount']];
  320. if (empty($v['add_time'])) {
  321. $tmp[] = ['data' => ''];
  322. } else {
  323. $tmp[] = ['data' => date('Y-m-d H:i:s', $v['add_time'])];
  324. }
  325. $tmp[] = ['data' => $v['operation']];
  326. $excel_data[] = $tmp;
  327. }
  328. $excel_data = $excel_obj->charset($excel_data, CHARSET);
  329. $excel_obj->addArray($excel_data);
  330. $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
  331. $excel_obj->generateXML('通道调款记录导出-' . date('Y-m-d-H', time()));
  332. }
  333. public function file_syncOp()
  334. {
  335. $this->sync_cfgs();
  336. showMessage('操作完成');
  337. }
  338. public function refresh_priceOp()
  339. {
  340. $publisher = new message\publisher();
  341. $publisher->modify_refill_channel();
  342. showMessage('操作完成');
  343. }
  344. public function provider_priceOp()
  345. {
  346. $provider_id = $_GET['provider_id'];
  347. $mod_provider = Model('refill_provider');
  348. $mod_price = Model('provider_price');
  349. $provider = $mod_provider->getProviderInfo(['provider_id' => $provider_id]);
  350. $provider_name = $provider['name'];
  351. $type = $provider['type'];
  352. $price = $mod_price->getPirce(['provider_name' => $provider_name,'product_type' => $type]);
  353. $cfg = $this->price_cfg($price);
  354. if(empty($provider)) {
  355. showMessage('通道不存在');
  356. }
  357. if(chksubmit()){
  358. $admininfo = $this->getAdminInfo();
  359. $new_cfg = $this->cfg_format($_POST, $cfg);
  360. $effect_time = $_POST['effect_time'];
  361. if(!empty($effect_time))
  362. {
  363. $effect_time = strtotime($effect_time);
  364. if($effect_time < time()) {
  365. $effect_time = 0;
  366. }
  367. }
  368. else {
  369. $effect_time = 0;
  370. }
  371. $chprice_helper = new refill\chprice_helper();
  372. $ret = $chprice_helper->update($price['price_id'], $new_cfg, $effect_time, $admininfo['name']);
  373. if($effect_time > 0) {
  374. QueueClient::async_push('AysncChangePrice', ['price_id' => $price['price_id']], $effect_time - time());
  375. }
  376. if($ret) {
  377. showMessage('编辑成功');
  378. }else{
  379. showMessage('编辑失败');
  380. }
  381. }
  382. else
  383. {
  384. global $config;
  385. $all_specs = $this->all_specs($cfg['qualitys'], $type);
  386. $amounts = $this->map_cfg($cfg,$all_specs);
  387. $quality_text = $price['product_type'] == mtopcard\OilCardPaper ? $config['oil_quality_text'] : $config['phone_quality_text'];
  388. $quality_text = $quality_text[$cfg['qualitys']];
  389. Tpl::output('provider_name', $cfg['name']);
  390. Tpl::output('product_type', $price['product_type']);
  391. Tpl::output('quality_text', $quality_text);
  392. Tpl::output('quality', $cfg['qualitys']);
  393. Tpl::output('effect_time', $price['effect_time']);
  394. Tpl::output('amounts', $amounts);
  395. Tpl::output('all_specs', $all_specs);
  396. Tpl::showpage('provider.price.set');
  397. }
  398. }
  399. private function price_cfg($price)
  400. {
  401. $cfg = json_decode($price['cfg'], true);
  402. $new_cfg = $price['new_cfg'];
  403. if(!empty($new_cfg))
  404. {
  405. $cfg = json_decode($new_cfg, true);
  406. }
  407. return $cfg;
  408. }
  409. private function card_types($stypes)
  410. {
  411. $result = [];
  412. $types = explode(',',$stypes);
  413. foreach ($types as $stype) {
  414. $type = mtopcard\topcard_type($stype);
  415. $result[] = $type;
  416. }
  417. return $result;
  418. }
  419. private function map_cfg($cfg,$all_specs)
  420. {
  421. $amounts = $cfg['amount'] ?? [];
  422. $amount_list = [];
  423. foreach ($amounts as $spec => $goods)
  424. {
  425. foreach ($goods as $gitem)
  426. {
  427. $types = $this->card_types($gitem['card_type']);
  428. foreach ($types as $type) {
  429. $amount_list[$type][$spec] = $gitem['price'] ?? 0;
  430. }
  431. }
  432. }
  433. $result = [];
  434. foreach ($all_specs as $card_type => $val)
  435. {
  436. $specs = $val['specs'];
  437. foreach ($specs as $spec)
  438. {
  439. $result[$card_type][$spec] = ['price' => 0,'opened' => 0];
  440. }
  441. }
  442. foreach ($amount_list as $card_type => $prices)
  443. {
  444. foreach ($prices as $spec => $price)
  445. {
  446. if (array_key_exists($card_type, $result) && array_key_exists($spec, $result[$card_type])) {
  447. $result[$card_type][$spec]['price'] = $price;
  448. $result[$card_type][$spec]['opened'] = 1;
  449. }
  450. }
  451. }
  452. return $result;
  453. }
  454. private function all_specs($qualitys, $type): array
  455. {
  456. global $config;
  457. if ($type == mtopcard\OilCardPaper) {
  458. $refill_specs = [
  459. 'petrochina' => $config['refill_oil_specs'],
  460. 'sinopec' => $config['refill_oil_specs']
  461. ];
  462. } elseif ($type == mtopcard\PhoneCardPaper) {
  463. $refill_specs = [
  464. 'chinamobile' => $config['refill_phone_specs'],
  465. 'chinaunicom' => $config['refill_phone_specs'],
  466. 'chinatelecom' => $config['refill_phone_specs']
  467. ];
  468. } else {
  469. return [];
  470. }
  471. $all_type_specs = [];
  472. foreach ($refill_specs as $scard_type => $specs) {
  473. $data = [];
  474. $card_type = mtopcard\topcard_type($scard_type);
  475. if (in_array($card_type, [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard])) {
  476. if (in_array(refill\Quality::Quick, explode(',', $qualitys))) {
  477. $specs = array_merge($config['refill_phone_small_specs'], $specs);
  478. }
  479. }
  480. $data['goods_name'] = $this->scard_type($card_type);
  481. $data['specs'] = $specs;
  482. $all_type_specs[$card_type] = $data;
  483. }
  484. return $all_type_specs;
  485. }
  486. private function cfg_format($input, $cfg)
  487. {
  488. foreach ($cfg['amount'] as $amount => $amt_items)
  489. {
  490. $new_amount = [];
  491. foreach ($amt_items as $item){
  492. $goods_id = $item['goods_id'];
  493. $quality = $item['quality'];
  494. $card_types = $this->card_types($item['card_type']);
  495. foreach ($card_types as $card_type)
  496. {
  497. $key = "price-{$card_type}-{$amount}";
  498. $arr = [
  499. 'goods_id' => $goods_id,
  500. 'price' => floatval(ncPriceFormat($input[$key])),
  501. 'quality' => $quality,
  502. 'card_type' => mtopcard\scard_type($card_type)
  503. ];
  504. $new_amount[] = $arr;
  505. }
  506. }
  507. $cfg['amount'][$amount] = $new_amount;
  508. }
  509. return $cfg;
  510. }
  511. public function provider_amount_editOp()
  512. {
  513. $amount_id = $_GET['amount_id'];
  514. $mod = Model('provider_amount');
  515. $provider_amount = $mod->where(['id' => $amount_id])->find();
  516. if(empty($provider_amount)) {
  517. showMessage('记录不存在');
  518. }
  519. if(chksubmit())
  520. {
  521. $bz = $_POST['bz'];
  522. $resp = $mod->where(['id' => $amount_id])->update(['bz' => $bz]);
  523. if($resp) {
  524. showMessage('编辑成功');
  525. }else{
  526. showMessage('编辑失败');
  527. }
  528. }
  529. else
  530. {
  531. $provider = Model('')->table('refill_provider,store')
  532. ->field('refill_provider.*,store.store_name')
  533. ->join('inner')
  534. ->on('store.store_id=refill_provider.store_id')
  535. ->where(['provider_id' => $provider_amount['provider_id']])
  536. ->find();
  537. Tpl::output('provider', $provider);
  538. Tpl::output('provider_amount', $provider_amount);
  539. Tpl::showpage('provider.amount.edit');
  540. }
  541. }
  542. public function provider_export($providers)
  543. {
  544. Language::read('export');
  545. import('libraries.excel');
  546. $excel_obj = new Excel();
  547. $excel_data = [];
  548. //设置样式
  549. $excel_obj->setStyle(['id' => 's_title', 'Font' => ['FontName' => '宋体', 'Size' => '12', 'Bold' => '1']]);
  550. //header
  551. $excel_data[0][] = ['styleid' => 's_title', 'data' => '通道ID'];
  552. $excel_data[0][] = ['styleid' => 's_title', 'data' => '通道名称'];
  553. $excel_data[0][] = ['styleid' => 's_title', 'data' => '订单成功后余额'];
  554. $excel_data[0][] = ['styleid' => 's_title', 'data' => '接口查询余额'];
  555. //data
  556. foreach ($providers as $provider) {
  557. $tmp = [];
  558. $store_name = "{$provider['name']}({$provider['store_name']})";
  559. $tmp[] = ['data' => $provider['provider_id']];
  560. $tmp[] = ['data' => $store_name];
  561. $tmp[] = ['data' => $provider['available_predeposit']];
  562. $tmp[] = ['data' => $provider['balance']];
  563. $excel_data[] = $tmp;
  564. }
  565. $excel_data = $excel_obj->charset($excel_data, CHARSET);
  566. $excel_obj->addArray($excel_data);
  567. $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
  568. $excel_obj->generateXML('通道余额明细导出-' . date('Y-m-d-H', time()));
  569. }
  570. }