From c3afeb3f116078fc9697c59222c166475e7b8ccf Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Wed, 27 Sep 2023 15:41:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BB=E5=90=8E=E5=8F=B0=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/AdminAgentTeam.php | 97 ++++++++--- app/listener/LogoutAgent.php | 4 +- app/middleware/CheckAgent.php | 8 +- app/model/AgentInfo.php | 75 +++++++++ app/model/AgentRechargeRecords.php | 40 ----- app/model/AgentUser.php | 248 ----------------------------- app/model/RechargeRecords.php | 6 +- app/model/User.php | 65 ++++++-- app/model/WithdrawalRecords.php | 4 +- app/validate/Agent.php | 5 +- 10 files changed, 221 insertions(+), 331 deletions(-) create mode 100644 app/model/AgentInfo.php delete mode 100644 app/model/AgentRechargeRecords.php delete mode 100644 app/model/AgentUser.php diff --git a/app/controller/AdminAgentTeam.php b/app/controller/AdminAgentTeam.php index e4adb15..295d3b7 100644 --- a/app/controller/AdminAgentTeam.php +++ b/app/controller/AdminAgentTeam.php @@ -8,8 +8,10 @@ use app\event\AgentPasswordChange; use app\middleware\CheckAdmin; use app\model\AdminDownScoresRecords; use app\model\AdminUpScoresRecords; -use app\model\AgentRechargeRecords; -use app\model\AgentUser; +use app\model\AgentInfo; +use app\model\RechargeRecords; +use app\model\User; +use app\model\WithdrawalRecords; use app\validate\Admin; use app\validate\Agent; use think\exception\ValidateException; @@ -35,9 +37,9 @@ class AdminAgentTeam extends BaseController $limit = $request['limit'] ?? 10; - $where = []; + $where = ['identity' => 2]; - $UserModel = new AgentUser(); + $UserModel = new User(); # 用户id / 手机号码查询 if (isset($request['title']) && !empty($request['title'])) { @@ -56,17 +58,20 @@ class AdminAgentTeam extends BaseController } # 查询用户列表 - $field = 'id,phone,avatar,balance,withdrawal_balance'; + $field = 'id,phone,avatar,balance,withdrawal_balance,status'; $userRes = $UserModel->field($field)->where($where)->order('id desc')->paginate($limit); $list = $userRes->items(); $total = $userRes->total(); + $AgentInfo = new AgentInfo(); foreach ($list as &$item) { - #$item['phone'] = format_phone_number($item['phone']); $item['avatar'] = get_image_url($item['avatar']); $item['status'] = $item['status'] == 1 ? '正常' : '停用'; + # 获取返点占比 + $rebate_ratio = $AgentInfo->where('aid',$item['id'])->value('rebate_ratio'); + $item['rebate_ratio'] = $rebate_ratio * 100; } return $this->renderSuccess('数据返回成功', ['list' => $list, 'total' => $total]); @@ -93,11 +98,11 @@ class AdminAgentTeam extends BaseController $connection->startTrans(); # 增加代理余额 - $agentBalance = AgentUser::incrBalance($aid,$quota); + $agentBalance = User::incrBalance($aid,$quota); # 代理上分记录 AdminUpScoresRecords::createRecords($aid,$adminUser['id'],$quota,$agentBalance,2); # 代理充值记录 - AgentRechargeRecords::createRecords($aid,$quota,$agentBalance,1); + RechargeRecords::createRecords($aid,$quota,$agentBalance,1,2,$adminUser['id']); $connection->commit(); return $this->renderSuccess('上分成功'); @@ -105,7 +110,7 @@ class AdminAgentTeam extends BaseController return $this->renderError($e->getMessage()); } catch (\Exception $exception) { $connection->rollback(); - return $this->renderError($exception->getMessage()); + return $this->renderError('操作失败'); } } @@ -129,25 +134,28 @@ class AdminAgentTeam extends BaseController $quota = $request['quota']; # 额度 # 检测代理可提余额是否足够 - $inspectRes = AgentUser::inspectWithdrawalBalance($aid,$quota); + $inspectRes = User::inspectUserBalance($aid,$quota); if (!$inspectRes['status']) throw new ValidateException($inspectRes['msg']); # 开启事务 $connection->startTrans(); # 扣减代理可提余额 - $agentBalance = AgentUser::decrWithdrawalBalance($aid,$quota); + $agentBalance = User::decrWithdrawalBalance($aid,$quota); # 代理下分记录 AdminDownScoresRecords::createRecords($aid,$adminUser['id'],$quota,$agentBalance,2); + # 用户提现记录-下分 + WithdrawalRecords::createRecords($aid,$quota,$agentBalance,1,2,$adminUser['id']); + $connection->commit(); return $this->renderSuccess('下分成功'); } catch (ValidateException $e) { return $this->renderError($e->getMessage()); } catch (\Exception $exception) { $connection->rollback(); - return $this->renderError($exception->getMessage()); + return $this->renderError('操作失败'); } } @@ -158,21 +166,46 @@ class AdminAgentTeam extends BaseController { $param = Request::param(); + $connection = Db::connect(); try { - validate(Agent::class)->scene('edit')->check($param); + validate()->rule([ + 'aid|代理id' => 'require|number', + 'password|密码' => 'min:6|max:20', + 'rebate_ratio|返点占比' => 'float|egt:1' + ])->check($param); + if (empty($param['password']) && empty($param['rebate_ratio'])) { + throw new ValidateException('请填写修改的密码或返点占比'); + } + + # 开启事务 + $connection->startTrans(); + + # 保存密码 + if (!empty($param['password'])) { - $UserModel = new AgentUser(); - $result = $UserModel->retrieve($param); + $param['user_id'] = $param['aid']; - if (!$result['status']) throw new ValidateException($result['msg']); + $UserModel = new User(); + $result = $UserModel->retrieve($param); - $event = new AgentPasswordChange($param['aid']); - Event::trigger(AgentPasswordChange::class,$event); + if (!$result['status']) throw new ValidateException($result['msg']); + # 清除登录记录 + $event = new AgentPasswordChange($param['aid']); + Event::trigger(AgentPasswordChange::class,$event); + } + # 保存返点占比 + if (!empty($param['rebate_ratio'])) { + AgentInfo::updateRebateRatio($param['aid'],$param['rebate_ratio']); + } - return $this->renderSuccess($result['msg']); + $connection->commit(); + return $this->renderSuccess('成功'); } catch (ValidateException $validateException) { return $this->renderError($validateException->getMessage()); + } catch (\Exception $exception) { + $connection->rollback(); + return $this->renderError('操作失败'); } } @@ -184,18 +217,27 @@ class AdminAgentTeam extends BaseController { $param = Request::param(); + $connection = Db::connect(); try { validate(Agent::class)->scene('del')->check($param); - $result = AgentUser::destroy($param['aid']); + $connection->startTrans(); + + $result = User::destroy($param['aid']); if (!$result) throw new ValidateException('删除失败'); + $agent_info_id = AgentInfo::where('aid',$param['aid'])->value('id'); + $resInfo = AgentInfo::destroy($agent_info_id); + if (!$resInfo) throw new ValidateException('删除失败'); + + $connection->commit(); return $this->renderSuccess('已删除'); } catch (ValidateException $validateException) { return $this->renderError($validateException->getMessage()); } catch (\Exception $e) { + $connection->rollback(); return $this->renderError('操作失败'); } } @@ -211,19 +253,28 @@ class AdminAgentTeam extends BaseController { $param = Request::param(); + $connection = Db::connect(); try { validate(Agent::class)->scene('register')->check($param); - $AgentUser = new AgentUser(); - $result = $AgentUser->register($param); + # 开启事务 + $connection->startTrans(); + + $AgentUser = new User(); + $param['aid'] = 0; + $aid = $AgentUser->register($param,2); - if (!$result) throw new ValidateException('代理已存在'); + if (!$aid) throw new ValidateException('代理已存在'); + AgentInfo::createInfo($aid,$param['rebate_ratio']); + + $connection->commit(); return $this->renderSuccess('添加成功'); } catch (ValidateException $validateException) { return $this->renderError($validateException->getMessage()); } catch (\Exception $e) { + $connection->rollback(); return $this->renderError('操作失败'); } } diff --git a/app/listener/LogoutAgent.php b/app/listener/LogoutAgent.php index 1b99467..952b069 100644 --- a/app/listener/LogoutAgent.php +++ b/app/listener/LogoutAgent.php @@ -17,11 +17,11 @@ class LogoutAgent { $aid = $event->aid; - $agentData = Cache::store('redis')->get('login_agent_user_data'); + $agentData = Cache::store('redis')->get('login_user_data'); if ($agentData) { $agentData = unserialize($agentData); if ($agentData['id'] == $aid) { - Session::delete('login_agent_user_data'); + Session::delete('login_user_data'); } } } diff --git a/app/middleware/CheckAgent.php b/app/middleware/CheckAgent.php index 29e74a3..95c2340 100644 --- a/app/middleware/CheckAgent.php +++ b/app/middleware/CheckAgent.php @@ -3,8 +3,8 @@ declare (strict_types = 1); namespace app\middleware; +use app\model\User; use think\Exception; -use think\facade\Cache; use think\facade\Request; use think\facade\Session; @@ -26,9 +26,13 @@ class CheckAgent if($userinfo['code'] != 200) throw new Exception('当前登录已失效,请重新登录',403); $request->userInfo = $userinfo['data']; - if (!Session::get('login_agent_user_data')) { + if (!Session::get('login_user_data')) { throw new Exception('代理未登陆,请先登陆后操作',201); } + $user = User::find($userinfo['data']['id']); + if ($user['identity'] != 2) { + throw new Exception('非代理身份无法操作',400); + } } catch (\Exception $err){ return json(['code'=>$err->getCode(),'msg'=>$err->getMessage()]); diff --git a/app/model/AgentInfo.php b/app/model/AgentInfo.php new file mode 100644 index 0000000..9797778 --- /dev/null +++ b/app/model/AgentInfo.php @@ -0,0 +1,75 @@ + $aid, + 'invite_code' => $invite_code, + 'create_time' => date("Y-m-d H:i:s",time()) + ]; + if (!empty($rebate_ratio)) { + $save['rebate_ratio'] = $rebate_ratio / 100; + } + $model->save($save); + } + + /** + * 递归获取验证码(不重复) + * @return string + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public static function returnInviteCode() + { + $invite_code = generate_random_str(6); + $query = AgentInfo::withTrashed()->where('invite_code',$invite_code)->field('id')->find(); + if ($query) { + return self::returnInviteCode(); + } + return $invite_code; + } + + + /** + * 修改返点占比 + * @param $aid + * @param $rebate_ratio + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public static function updateRebateRatio($aid,$rebate_ratio) + { + $AgentInfo = new AgentInfo(); + $AgentInfoRes = $AgentInfo->where('aid',$aid)->find(); + $AgentInfoRes->rebate_ratio = $rebate_ratio / 100; + $AgentInfoRes->update_time = date("Y-m-d H:i:s",time()); + $AgentInfoRes->save(); + } +} diff --git a/app/model/AgentRechargeRecords.php b/app/model/AgentRechargeRecords.php deleted file mode 100644 index 4b15f91..0000000 --- a/app/model/AgentRechargeRecords.php +++ /dev/null @@ -1,40 +0,0 @@ -aid = $aid; - $RechargeRecords->recharge_amount = $recharge_amount; - $RechargeRecords->residue_amount = $residue_amount; - $RechargeRecords->recharge_time = date("Y-m-d H:i:s",time()); - $RechargeRecords->trade_type = $trade_type; - $RechargeRecords->status = $status; - if ($status == 1) { - $RechargeRecords->pay_time = date("Y-m-d H:i:s",time()); - } - - $RechargeRecords->save(); - - return $RechargeRecords->id; - } -} diff --git a/app/model/AgentUser.php b/app/model/AgentUser.php deleted file mode 100644 index ac26554..0000000 --- a/app/model/AgentUser.php +++ /dev/null @@ -1,248 +0,0 @@ -where('phone', $data['phone']) - ->field('id,phone,avatar,password,salt,status') - ->find(); - - try { - if (!$user) throw new \Exception('代理账号不存在'); - - if ($user->status != 1) throw new \Exception('账号已被停用'); - - // 使用相同的盐值对输入密码进行哈希验证 - $hashedPassword = $AgentUser->generateHashedPassword($data['password'], $user->salt); - - if ($user->password !== $hashedPassword) throw new \Exception('密码错误'); - - # 缓存用户信息 - $login_user_data = $user->toArray(); - unset($login_user_data['password'],$login_user_data['salt'],$login_user_data['status']); - Session::set('login_agent_user_data',$login_user_data); - Cache::store('redis')->set('login_agent_user_data',serialize($login_user_data),7200); - - return ['status' => 1, 'msg' => '登陆成功', 'data' => $login_user_data]; - } catch (\Exception $e) { - return ['status' => 0, 'msg' => $e->getMessage()]; - } - } - - /** - * 注册、创建代理 - * @param $data - * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function register($data) - { - $user = $this->where('phone', $data['phone'])->find(); - if ($user) return false; - - // 生成盐值 - $salt = generate_random_str(6); - // 密码加盐值后哈希存储 - $password = $this->generateHashedPassword($data['password'], $salt); - - $this->save([ - // 随机头像 - 'avatar' => rand_avatar(), - 'password' => $password, - 'salt' => $salt, - 'phone' => $data['phone'], - 'invite_code' => generate_random_str(6), - 'create_time' => date("Y-m-d H:i:s",time()) - ]); - - return true; - } - - /** - * 扣减余额(给用户上分) - * @param $aid - * @param $balance - * @return float|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public static function decrBalance($aid,$balance) - { - $user = self::find($aid); - $user->balance = round($user->balance - $balance,2); - $user->save(); - return $user->balance; - } - - /** - * 增加余额(充值、总后台上分) - * @param $aid - * @param $balance - * @return float|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public static function incrBalance($aid,$balance) - { - $userModel = new AgentUser(); - $user = $userModel->find($aid); - $user->balance = round($user->balance + $balance,2); - $user->save(); - return $user->balance; - } - - /** - * 扣除可提余额 (提现) - * @param $aid - * @param $balance - * @return float|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public static function decrWithdrawalBalance($aid,$balance) - { - $userModel = new AgentUser(); - $user = $userModel->find($aid); - $user->withdrawal_balance = round($user->withdrawal_balance - $balance,2); - $user->save(); - return $user->withdrawal_balance; - } - - /** - * 增加可提余额(给用户下分) - * @param $aid - * @param $balance - * @return float|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public static function incrWithdrawalBalance($aid,$balance) - { - $userModel = new AgentUser(); - $user = $userModel->find($aid); - $user->withdrawal_balance = round($user->withdrawal_balance + $balance,2); - $user->save(); - return $user->withdrawal_balance; - } - - /** - * 检测代理余额 - * @param $aid - * @param $balance - * @return array|int[] - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public static function inspectBalance($aid,$balance) - { - $userModel = new AgentUser(); - $user = $userModel->find($aid); - if ($user->balance < $balance) { - return ['status' => 0, 'msg' => '代理余额不足']; - } - return ['status' => 1]; - } - - /** - * 检测代理余额 - * @param $aid - * @param $balance - * @return array|int[] - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public static function inspectWithdrawalBalance($aid,$balance) - { - $userModel = new AgentUser(); - $user = $userModel->find($aid); - if ($user->withdrawal_balance < $balance) { - return ['status' => 0, 'msg' => '代理可提余额不足']; - } - return ['status' => 1]; - } - - /** - * 找回密码 - * @param $data - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - */ - public function retrieve($data) - { - // 根据代理手机号和代理id修改密码 - $user = []; - $errorMsg = ''; - if (isset($data['phone'])) { - $errorMsg = '手机号'; - $user = $this->where('phone', $data['phone'])->find(); - } elseif ($data['aid']) { - $errorMsg = '代理账号'; - $user = $this->find($data['aid']); - } - - if ($user) { - - // 生成盐值 - $salt = generate_random_str(6); - $password = $this->generateHashedPassword($data['password'], $salt); - // 密码加盐值后哈希存储 - $user->password = $password; - $user->salt = $salt; - $user->update_time = date("Y-m-d H:i:s",time()); - $user->save(); - - return ['status' => true, 'msg' => '密码重制成功']; - } - - return ['status' => false, 'msg' => $errorMsg.'未注册']; - } - - - /** - * 生成密码 - * @param $password - * @param $salt - * @return string - */ - private function generateHashedPassword($password,$salt) - { - return md5(md5($password) . md5($salt)); - } -} diff --git a/app/model/RechargeRecords.php b/app/model/RechargeRecords.php index 4e5f153..7da861a 100644 --- a/app/model/RechargeRecords.php +++ b/app/model/RechargeRecords.php @@ -10,6 +10,8 @@ use think\Model; */ class RechargeRecords extends Model { + + public $tradeType = [1 => '代理上分', 2 => '管理员上分', 3 => '支付宝']; /** * 创建充值记录 * @param $user_id @@ -17,9 +19,10 @@ class RechargeRecords extends Model * @param $residue_amount * @param $status * @param $trade_type + * @param $trade_id * @return mixed */ - public static function createRecords($user_id,$recharge_amount,$residue_amount,$status = 0,$trade_type = 1) + public static function createRecords($user_id,$recharge_amount,$residue_amount,$status = 0,$trade_type = 1,$trade_id = 0) { $RechargeRecords = new RechargeRecords(); @@ -28,6 +31,7 @@ class RechargeRecords extends Model $RechargeRecords->residue_amount = $residue_amount; $RechargeRecords->recharge_time = date("Y-m-d H:i:s",time()); $RechargeRecords->trade_type = $trade_type; + $RechargeRecords->trade_id = $trade_id; $RechargeRecords->status = $status; if ($status == 1) { $RechargeRecords->pay_time = date("Y-m-d H:i:s",time()); diff --git a/app/model/User.php b/app/model/User.php index 990a4ff..81a3123 100644 --- a/app/model/User.php +++ b/app/model/User.php @@ -13,36 +13,40 @@ class User extends Model protected $deleteTime = 'delete_time'; protected $defaultSoftDelete = 0; + public $identityArr = [2 => '代理', 3 => '用户']; + /** * 注册用户 * @param $data + * @param $identity * @return bool * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function register($data) + public function register($data,$identity = 3) { - - $user = $this->where('phone', $data['phone'])->find(); - if ($user) return false; + $User = new User(); + $user = $User->where('phone', $data['phone'])->find(); + if ($user) return 0; // 生成盐值 $salt = $this->generateSalt(); // 密码加盐值后哈希存储 $password = $this->generateHashedPassword($data['password'], $salt); - $this->save([ + $User->save([ // 随机头像 'avatar' => rand_avatar(), 'password' => $password, 'salt' => $salt, 'phone' => $data['phone'], 'aid' => $data['aid'], + 'identity' => $identity, 'register_time' => date("Y-m-d H:i:s",time()) ]); - return true; + return $User->id; } /** @@ -56,10 +60,11 @@ class User extends Model public function login($data) { // 根据用户名查询用户信息 - $user = $this->where('phone', $data['phone'])->field('id,avatar,phone,password,salt,status')->find(); + $user = $this->where('phone', $data['phone'])->field('id,avatar,phone,password,salt,status,identity')->find(); if ($user) { - if ($user['status'] != 1) return ['status' => false, 'msg' => '用户已被停用']; + $msg = $this->identityArr[$user['identity']]; + if ($user['status'] != 1) return ['status' => false, 'msg' => $msg.'已被停用']; // 使用相同的盐值对输入密码进行哈希验证 $hashedPassword = $this->generateHashedPassword($data['password'], $user->salt); @@ -167,14 +172,15 @@ class User extends Model */ public function verifyInviteCode($invite_code) { - $AgentUser = new AgentUser(); + if (empty($invite_code)) return 0; + $AgentUser = new AgentInfo(); $codeRes = $AgentUser->where('invite_code',$invite_code)->find(); if (empty($codeRes)) { return 0; } - return $codeRes->id; + return $codeRes->aid; } /** @@ -250,7 +256,7 @@ class User extends Model } /** - * 检查用户余额是否足够 + * 检查用户|代理可提余额是否足够 * @param $user_id * @param $balance * @return array|int[] @@ -263,7 +269,7 @@ class User extends Model $userModel = new User(); $user = $userModel->find($user_id); if ($user->withdrawal_balance < $balance) { - return ['status' => 0, 'msg' => '用户可提余额不足']; + return ['status' => 0, 'msg' => $userModel->identityArr[$user->identity].'可提余额不足']; } return ['status' => 1]; } @@ -289,6 +295,41 @@ class User extends Model return ['status' => 1]; } + /** + * 检测代理|用户余额 + * @param $aid + * @param $balance + * @return array|int[] + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public static function inspectBalance($aid,$balance) + { + $userModel = new User(); + $user = $userModel->find($aid); + if ($user->balance < $balance) { + return ['status' => 0, 'msg' => $userModel->identityArr[$user->identity].'余额不足']; + } + return ['status' => 1]; + } + + /** + * 修改身份 + * @param $user_id + * @param $identity + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public static function changeIdentity($user_id,$identity = 2) + { + $user = new User(); + $userRes = $user->find($user_id); + $userRes->identity = $identity; + $userRes->save(); + } + /** * 生成盐值 * @return string diff --git a/app/model/WithdrawalRecords.php b/app/model/WithdrawalRecords.php index 3f67d4a..2382944 100644 --- a/app/model/WithdrawalRecords.php +++ b/app/model/WithdrawalRecords.php @@ -17,9 +17,10 @@ class WithdrawalRecords extends Model * @param $withdrawal_balance * @param $status * @param $trade_type + * @param $trade_id * @return mixed */ - public static function createRecords($user_id,$withdrawal_amount,$withdrawal_balance,$status = 0,$trade_type = 1) + public static function createRecords($user_id,$withdrawal_amount,$withdrawal_balance,$status = 0,$trade_type = 1,$trade_id = 0) { $Records = new WithdrawalRecords(); @@ -27,6 +28,7 @@ class WithdrawalRecords extends Model $Records->withdrawal_amount = $withdrawal_amount; $Records->withdrawal_balance = $withdrawal_balance; $Records->trade_type = $trade_type; + $Records->trade_id = $trade_id; $Records->status = $status; $Records->apply_time = date("Y-m-d H:i:s",time()); if ($status == 1) { diff --git a/app/validate/Agent.php b/app/validate/Agent.php index 4c51676..588a144 100644 --- a/app/validate/Agent.php +++ b/app/validate/Agent.php @@ -20,6 +20,7 @@ class Agent extends Validate 'repassword|确认密码' => 'require|confirm:password', 'aid|代理id' => 'require|number', 'phone|手机号' => 'require|mobile', + 'rebate_ratio|返点占比' => 'float|egt:1' ]; /** @@ -32,9 +33,9 @@ class Agent extends Validate protected $scene = [ 'scores' => ['user_id','quota'], - 'edit' => ['aid','password'], + 'edit' => ['aid','password','rebate_ratio'], 'del' => ['aid'], - 'register' => ['phone','password'], + 'register' => ['phone','password','rebate_ratio'], 'modifyPassword' => ['password','repassword'], ]; }