修复了在登录逻辑中使用错误的密码哈希函数的问题
This commit is contained in:
parent
adab9b2702
commit
061db1d927
20
app/MyBusinessException.php
Normal file
20
app/MyBusinessException.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace app;
|
||||
|
||||
use support\exception\BusinessException;
|
||||
use Webman\Http\Request;
|
||||
use Webman\Http\Response;
|
||||
|
||||
class MyBusinessException extends BusinessException
|
||||
{
|
||||
public function render(Request $request): ?Response
|
||||
{
|
||||
// json请求返回json数据
|
||||
if ($request->expectsJson()) {
|
||||
return json(['code' => $this->getCode() ?: 500, 'message' => $this->getMessage(),'show'=>1]);
|
||||
}
|
||||
// 非json请求则返回一个页面
|
||||
return new Response(200, [], $this->getMessage());
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\operation;
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\operation\OpurchaseclassofferLists;
|
||||
use app\api\logic\operation\OpurchaseGoodsOfferLogic;
|
||||
use app\api\validate\OpurchaseGoodsOfferValidate;
|
||||
use think\facade\Db;
|
||||
|
||||
class OpurchaseGoodsOfferController extends BaseAdminController
|
||||
{
|
||||
/**
|
||||
* 供应商报价列表
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new OpurchaseclassofferLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 供应商报价日期列表
|
||||
*/
|
||||
public function date_lists()
|
||||
{
|
||||
$supplier=$this->request->supplierId;
|
||||
if(!$supplier) return $this->success('供应商不存在', []);
|
||||
$page_no = $this->request->get('page_no', 1);
|
||||
$page_size = $this->request->get('page_size', 15);
|
||||
|
||||
$data = Db::name('opurchase_goods_offer_date')->where('supplier_id', $supplier)->page($page_no, $page_size)->select()->each(function ($item) {
|
||||
$item['name']=date('Y-m-d', $item['create_time']).' 报价清单';
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = Db::name('opurchase_goods_offer_date')->where('supplier_id', $supplier)->count();
|
||||
return $this->success('请求成功', ['lists' => $data, 'count' => $count, 'page_no' => $page_no, 'page_size' => $page_size]);
|
||||
}
|
||||
/**
|
||||
* 提交报价
|
||||
*/
|
||||
public function offer()
|
||||
{
|
||||
$supplier=$this->request->supplierId;
|
||||
if(!$supplier) return $this->fail('非供应商用户不能报价');
|
||||
$params = (new OpurchaseGoodsOfferValidate())->post()->goCheck('offer');
|
||||
$result = OpurchaseGoodsOfferLogic::offer($params);
|
||||
if (true === $result) {
|
||||
return $this->success('报价成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(OpurchaseGoodsOfferLogic::getError());
|
||||
}
|
||||
}
|
@ -152,7 +152,7 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis
|
||||
// 部门列表
|
||||
$deptLists = Dept::column('name', 'id');
|
||||
// 岗位列表
|
||||
$jobsLists = Jobs::column('name', 'id');
|
||||
// $jobsLists = Jobs::column('name', 'id');
|
||||
|
||||
//管理员列表增加角色名称
|
||||
foreach ($adminLists as $k => $v) {
|
||||
|
@ -53,6 +53,9 @@ class OpurchaseclassofferLists extends BaseAdminDataLists implements ListsSearch
|
||||
if($id){
|
||||
$where[]=['order_id','=',$id];
|
||||
}
|
||||
if($this->request->supplierId>0){
|
||||
$where[]=['supplier_id','=',$this->request->supplierId];
|
||||
}
|
||||
$this->where=$where;
|
||||
return OpurchaseGoodsOffer::where($this->searchWhere)
|
||||
->where($where)
|
||||
|
@ -18,9 +18,9 @@ use app\common\logic\BaseLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\admin\service\AdminTokenService;
|
||||
use app\common\service\FileService;
|
||||
use app\MyBusinessException;
|
||||
use think\facade\Db;
|
||||
use Webman\Config;
|
||||
use support\exception\BusinessException;
|
||||
|
||||
/**
|
||||
* 登录逻辑
|
||||
@ -46,7 +46,7 @@ class LoginLogic extends BaseLogic
|
||||
if(isset($params['is_admin']) &&$params['is_admin'] == 0 &&$admin){
|
||||
$auth_shop=Db::name('user_auth_shop')->where(['admin_id'=>$admin['id'],'status'=>1,'apply_status'=>1,'type'=>2])->find();
|
||||
if(!$auth_shop){
|
||||
throw new BusinessException('该账户没有权限', 1);
|
||||
throw new MyBusinessException('该账户没有权限');
|
||||
}
|
||||
}
|
||||
//用户表登录信息更新
|
||||
|
@ -43,10 +43,11 @@ class AdminLogic extends BaseLogic
|
||||
*/
|
||||
public static function add(array $params)
|
||||
{
|
||||
d($params);
|
||||
Db::startTrans();
|
||||
try {
|
||||
$password = password_hash($params['password'],PASSWORD_DEFAULT);
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$password=create_password($params['password'], $passwordSalt);
|
||||
// $password = password_hash($params['password'],PASSWORD_DEFAULT);
|
||||
$defaultAvatar = config('project.default_image.admin_avatar');
|
||||
$avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar;
|
||||
|
||||
@ -102,7 +103,9 @@ class AdminLogic extends BaseLogic
|
||||
|
||||
// 密码
|
||||
if (!empty($params['password'])) {
|
||||
$data['password'] = password_hash($params['password'],PASSWORD_DEFAULT);
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$data['password']=create_password($params['password'], $passwordSalt);
|
||||
// $data['password'] = password_hash($params['password'],PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
// 禁用或更换角色后.设置token过期
|
||||
@ -254,7 +257,9 @@ class AdminLogic extends BaseLogic
|
||||
];
|
||||
|
||||
if (!empty($params['password'])) {
|
||||
$data['password'] = password_hash($params['password'],PASSWORD_DEFAULT);
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$data['password']=create_password($params['password'], $passwordSalt);
|
||||
// $data['password'] = password_hash($params['password'],PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
return Admin::update($data);
|
||||
|
@ -24,7 +24,7 @@ class GoodsValidate extends BaseValidate
|
||||
'spec' => 'require',
|
||||
'class' => 'require',
|
||||
'unit' => 'require',
|
||||
'sys_labels' => 'require',
|
||||
// 'sys_labels' => 'require',
|
||||
'buy' => 'require',
|
||||
'warehouse' => 'require',
|
||||
'stocktip' => 'require',
|
||||
|
@ -131,7 +131,7 @@ class RetailOrderController extends BaseApiController
|
||||
return $this->fail('购物车商品不能超过100个');
|
||||
}
|
||||
|
||||
if ($pay_type == 9) {
|
||||
if ($pay_type == 9 || $pay_type == 17) {
|
||||
if (empty($this->request->userInfo['merchant'])) {
|
||||
return $this->fail('请先绑定商户');
|
||||
}
|
||||
@ -158,7 +158,7 @@ class RetailOrderController extends BaseApiController
|
||||
case PayEnum::CASH_PAY:
|
||||
//现金支付
|
||||
PayNotifyLogic::handle('cash_pay', $order['number']);
|
||||
return $this->success('余额支付成功');
|
||||
return $this->success('现金支付成功');
|
||||
break;
|
||||
case PayEnum::WECHAT_PAY:
|
||||
//微信支付
|
||||
@ -226,6 +226,11 @@ class RetailOrderController extends BaseApiController
|
||||
return $this->fail(RetailOrderLogic::getError());
|
||||
}
|
||||
break;
|
||||
case PayEnum::CASH_PAY:
|
||||
//现金支付
|
||||
PayNotifyLogic::handle('cash_pay', $order['number']);
|
||||
return $this->success('现金支付成功');
|
||||
break;
|
||||
case PayEnum::WECHAT_PAY:
|
||||
//微信支付
|
||||
$redirectUrl = $params['redirect'] ?? '/pages/payment/payment';
|
||||
|
@ -26,10 +26,16 @@ class GoodsLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'%like%' => ['name'],
|
||||
$name=$this->request->get('name');
|
||||
$where= [
|
||||
'=' => ['class']
|
||||
];
|
||||
if($name && preg_match('/[\x{4e00}-\x{9fff}]+/u', $name)==1){
|
||||
$where['%like%']=['name'];
|
||||
}else{
|
||||
$where['=']=['code'];
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
|
7
app/common/cache/AdminTokenCache.php
vendored
7
app/common/cache/AdminTokenCache.php
vendored
@ -74,10 +74,13 @@ class AdminTokenCache extends BaseCache
|
||||
}
|
||||
$roleName = trim($roleName, '/');
|
||||
}
|
||||
|
||||
$supplier_id=0;
|
||||
if(isset($auth_shop)){
|
||||
$supplier_id=$auth_shop['pid'];
|
||||
}
|
||||
$adminInfo = [
|
||||
'admin_id' => $admin->id,
|
||||
'supplier_id' => $auth_shop?$auth_shop['id']:0,
|
||||
'supplier_id' => $supplier_id,
|
||||
'root' => $admin->root,
|
||||
'name' => $admin->name,
|
||||
'account' => $admin->account,
|
||||
|
Loading…
x
Reference in New Issue
Block a user