| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <?php
- declare(strict_types=1);
- namespace app\finance\controller;
- use app\base\BaseController;
- use app\finance\model\PriceAdjust as PriceAdjustModel;
- use app\finance\model\PriceAdjustCate;
- use app\finance\validate\PriceAdjustValidate;
- use think\exception\ValidateException;
- use think\facade\Db;
- use think\facade\View;
- class Priceadjust extends BaseController
- {
- protected $model;
- public function __construct()
- {
- parent::__construct();
- $this->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, '错误的请求');
- }
- }
|