request->filter('trim')->only(['supplierNo' => '', 'keyword' => '', 'status' => '', 'page' => 1, 'size' => 15], 'post'); $val = Validate::rule([ 'supplierNo|供应商编码' => 'alphaNum|length:18', 'keyword|关键字' => 'chsDash|max:100', 'status|状态' => 'number|in:' . SupplierUser::$status_disabled . ',' . SupplierUser::$status_normal, 'page|页码' => 'require|number|gt:0', 'size|每页数量' => 'require|number|elt:100', ]); if (!$val->check($param)) return json_show(1004, $val->getError()); return AccountLogic::getAccountList($param); } //修改供应商账号密码 public function changePassword() { $param = $this->request->filter('trim')->only(['uid', 'password'], 'post'); $val = Validate::rule([ 'uid|用户ID' => 'require|number|gt:0', 'password|密码' => 'require|min:6|max:200', ]); if (!$val->check($param)) return json_show(1004, $val->getError()); return AccountLogic::changePassword($param); } //读取供应商账号账号信息 public function readAccount() { $param = $this->request->filter('trim')->only(['uid'], 'post'); $val = Validate::rule(['uid|用户ID' => 'require|number|gt:0']); if (!$val->check($param)) return json_show(1004, $val->getError()); return AccountLogic::readAccount($param); } //添加供应商账号 public function addAccount() { $param = $this->request->filter('trim')->only(['supplierNo', 'nickname', 'mobile', 'email' => ''], 'post'); $val = Validate::rule([ 'nickname|姓名' => 'require|max:255', 'mobile|手机号' => 'require|number|length:11|mobile', 'email|邮箱' => 'email', 'supplierNo|供应商编码' => 'require|array|max:100', ]); if (!$val->check($param)) return json_show(1004, $val->getError()); $token = $this->request->filter('trim')->post('token'); return AccountLogic::addAccount($param, $token); } //修改供应商账号 public function editAccount() { $param = $this->request->filter('trim')->only(['token', 'uid', 'nickname', 'mobile', 'email' => '', 'supplier_list' => []], 'post'); $val = Validate::rule([ 'uid|用户ID' => 'require|number|gt:0', 'nickname|姓名' => 'require|max:255', 'mobile|手机号' => 'require|number|length:11|mobile', 'email|邮箱' => 'email', 'supplier_list|供应商列表' => 'array|max:100', ]); if (!$val->check($param)) return json_show(1004, $val->getError()); return AccountLogic::editAccount($param); } //启/禁用 供应商账号 public function statusAccount() { $param = $this->request->filter('trim')->only(['uid', 'status'], 'post'); $val = Validate::rule([ 'uid|用户ID' => 'require|number|gt:0', 'status|状态' => 'require|number|in:' . \app\abutment\model\SupplierUser::$status_normal . ',' . \app\abutment\model\SupplierUser::$status_disabled, ]); if (!$val->check($param)) return json_show(1004, $val->getError()); return AccountLogic::statusAccount($param); } //删除供应商账号 public function deleteAccount() { $uid = $this->request->filter('trim')->post('uid/d', 0); return AccountLogic::deleteAccount($uid); } }