1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- class refill_errorControl extends SystemControl
- {
- public function __construct()
- {
- parent::__construct();
- }
- public function indexOp()
- {
- $mod = Model('refill_error');
- $condition = [];
- $_GET['query_start_time'] = $_GET['query_start_time'] ?? date("Y-m-d 00:00:00");
- $start_unixtime = intval(strtotime($_GET['query_start_time']));
- $end_unixtime = intval(strtotime($_GET['query_end_time']));
- if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
- $condition['add_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
- } elseif ($start_unixtime > 0) {
- $condition['add_time'] = ['egt', $start_unixtime];
- } elseif ($end_unixtime > 0) {
- $condition['add_time'] = ['lt', $end_unixtime];
- } else {
- $start = strtotime(date('Y-m-d', time()));
- $condition['add_time'] = ['egt', $start];
- }
- if(!empty($_GET['mchid'])) {
- $condition['mchid'] = $_GET['mchid'];
- }
- if(in_array($_GET['handled'], ['0', '1'])) {
- $condition['handled'] = $_GET['handled'];
- }
- if (!empty($_GET['mch_orders'])) {
- $mch_orders = rtrim($_GET['mch_orders'],',');
- $condition['mch_order'] = ['in', $mch_orders];
- }
- $list = $mod->getRefillErrorlList($condition, 200, 1000);
- $merchants = [];
- $merchant_list = $this->merchants();
- foreach ($merchant_list as $value) {
- $merchants[$value['mchid']] = $value;
- }
- $list = $this->DataFormat($list, $merchants);
- Tpl::output('merchant_list', $merchant_list);
- Tpl::output('list', $list);
- Tpl::output('show_page', $mod->showpage());
- Tpl::showpage('refill.error');
- }
- private function DataFormat($list,$merchants)
- {
- foreach ($list as $key => $value) {
- $list[$key]['company_name'] = $merchants[$value['mchid']]['company_name'];
- if($value['handled'] == 0) {
- $list[$key]['handled_text'] = '未处理';
- } else {
- $list[$key]['handled_text'] = '已处理';
- }
- }
- return $list;
- }
- public function handledOp()
- {
- $mod = Model('refill_error');
- $id = $_GET['error_id'];
- $condition['error_id'] = ['in',$id];
- $condition['handled'] = 0;
- $resp = $mod->where($condition)->update(['handled' => 1]);
- if(!$resp) {
- showMessage('操作失败', 'index.php?act=refill_error&op=index');
- }
- showMessage('操作成功', 'index.php?act=refill_error&op=index');
- }
- }
|