model = new PriceAdjustModel(); } public function datalist() { $param = get_params(); if (request()->isAjax()) { $uid = $this->uid; $where = []; $whereOr = []; $where[] = ['delete_time', '=', 0]; $tab = isset($param['tab']) ? (int) $param['tab'] : 0; if ($tab === 0) { $whereOr[] = ['admin_id', '=', $uid]; $whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_uids)")]; $whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_history_uids)")]; $whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_copy_uids)")]; } elseif ($tab === 1) { $where[] = ['admin_id', '=', $uid]; } elseif ($tab === 2) { $where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_uids)")]; } elseif ($tab === 3) { $where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_history_uids)")]; } elseif ($tab === 4) { $where[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',check_copy_uids)")]; } if (!empty($param['keywords'])) { $where[] = ['customer_id', 'like', '%' . $param['keywords'] . '%']; } if (isset($param['check_status']) && $param['check_status'] !== '') { $where[] = ['check_status', '=', $param['check_status']]; } if (!empty($param['diff_time'])) { $diff = explode('~', $param['diff_time']); $where[] = ['create_time', 'between', [strtotime(urldecode($diff[0])), strtotime(urldecode($diff[1] . ' 23:59:59'))]]; } $list = $this->model->datalist($param, $where, $whereOr); return table_assign(0, '', $list); } return view(); } public function add() { $param = get_params(); if (request()->isAjax()) { if (!empty($param['id']) && $param['id'] > 0) { try { validate(PriceAdjustValidate::class)->scene('edit')->check($param); } catch (ValidateException $e) { return to_assign(1, $e->getError()); } $this->model->edit($param); } else { try { validate(PriceAdjustValidate::class)->scene('add')->check($param); } catch (ValidateException $e) { return to_assign(1, $e->getError()); } $param['admin_id'] = $this->uid; $param['did'] = $this->did; $this->model->add($param); } } else { $id = isset($param['id']) ? (int) $param['id'] : 0; $detail = [ 'id' => 0, 'customer_id' => '', 'history_fee_deduct' => 1, 'trade_scene' => 0, 'trade_scene_remark' => '', 'card_bin' => 0, 'card_bin_remark' => '', 'card_type' => 0, 'fee_recharge' => '', 'fee_card_open' => '', 'fee_other' => '', 'monthly_trade_vol' => '', 'estimated_trade_vol' => '', 'competitor_info' => '', 'remark' => '', 'file_ids' => '', 'check_status' => 0, 'check_flow_id' => 0, ]; if ($id > 0) { $detail = $this->model->getById($id); } View::assign('detail', $detail); View::assign('trade_scenes', PriceAdjustCate::getByType(1)); View::assign('card_bins', PriceAdjustCate::getByType(2)); View::assign('card_types', PriceAdjustCate::getByType(3)); return view(); } } public function view($id) { $detail = $this->model->getById($id); if (!empty($detail)) { View::assign('create_user', get_admin($detail['admin_id'])); View::assign('detail', $detail); return view(); } return view(EEEOR_REPORTING, ['code' => 404, 'warning' => '找不到页面']); } public function del() { $param = get_params(); $id = isset($param['id']) ? (int) $param['id'] : 0; if (request()->isDelete()) { return $this->model->delById($id); } return to_assign(1, '错误的请求'); } }