feat: 修改了登录逻辑和门店商品查询功能
This commit is contained in:
parent
2a5bc68379
commit
20e891a596
@ -38,7 +38,6 @@ class LoginController extends BaseAdminController
|
|||||||
public function account()
|
public function account()
|
||||||
{
|
{
|
||||||
$params = (new LoginValidate())->post()->goCheck();
|
$params = (new LoginValidate())->post()->goCheck();
|
||||||
$params['is_admin']=$this->request->post('is_admin',1);
|
|
||||||
return $this->data((new LoginLogic())->login($params));
|
return $this->data((new LoginLogic())->login($params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\lists\store_branch_product;
|
||||||
|
|
||||||
|
|
||||||
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
|
use app\common\model\system_store\SystemStore;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店商品辅助表
|
||||||
|
* Class StoreBranchProductLists
|
||||||
|
* @package app\admin\listssystem_store
|
||||||
|
*/
|
||||||
|
class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 设置搜索条件
|
||||||
|
* @return \string[][]
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 17:45
|
||||||
|
*/
|
||||||
|
public function setSearch(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'=' => ['product_id'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取门店列表列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 17:45
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
return StoreBranchProduct::where($this->searchWhere)
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取门店列表数量
|
||||||
|
* @return int
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 17:45
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return SystemStore::where($this->searchWhere)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,8 +6,7 @@ namespace app\admin\lists\system_store;
|
|||||||
use app\admin\lists\BaseAdminDataLists;
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
use app\common\model\system_store\SystemStore;
|
use app\common\model\system_store\SystemStore;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
use PDO;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据商品来源查询门店列表
|
* 根据商品来源查询门店列表
|
||||||
@ -17,6 +16,7 @@ use PDO;
|
|||||||
class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchInterface
|
class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
protected $where = []; // 搜索条件数组,用于存储搜索条件,以便在列表中使用。
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 设置搜索条件
|
* @notes 设置搜索条件
|
||||||
@ -27,7 +27,7 @@ class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['name', 'phone'],
|
'=' => ['product_id'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,18 +43,11 @@ class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
$store_arr=StoreProduct::where('source_id',$this->request->get('product_id'))->column('store_id');
|
$arr = StoreBranchProduct::where($this->searchWhere)->select()->each(function ($item) {
|
||||||
if($store_arr){
|
$item['system_store_name']=SystemStore::whereIn('id', $item['store_id'])->value('name');
|
||||||
$this->searchWhere[]=['id', 'in', $store_arr];
|
return $item;
|
||||||
}else{
|
});
|
||||||
return [];
|
return $arr?->toArray();
|
||||||
}
|
|
||||||
return SystemStore::where($this->searchWhere)
|
|
||||||
->field(['id', 'name', 'phone', 'detailed_address', 'image'])
|
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
|
||||||
->order(['id' => 'desc'])
|
|
||||||
->select()
|
|
||||||
->toArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,11 +59,6 @@ class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchI
|
|||||||
*/
|
*/
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
if($this->searchWhere){
|
return StoreBranchProduct::where($this->searchWhere)->count();
|
||||||
return SystemStore::where($this->searchWhere)->count();
|
|
||||||
}else{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
@ -44,16 +44,6 @@ class LoginLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
$time = time();
|
$time = time();
|
||||||
$admin = Admin::where('account', '=', $params['account'])->find();
|
$admin = Admin::where('account', '=', $params['account'])->find();
|
||||||
if($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 MyBusinessException('该账户没有权限');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($admin &&$params['is_admin'] == 1){
|
|
||||||
$role_find=AdminRole::where('admin_id',$admin['id'])->where('role_id',1)->find();
|
|
||||||
if($role_find) throw new MyBusinessException('请使用供应商后台登录');
|
|
||||||
}
|
|
||||||
//用户表登录信息更新
|
//用户表登录信息更新
|
||||||
$admin->login_time = $time;
|
$admin->login_time = $time;
|
||||||
$admin->login_ip = request()->getLocalIp();
|
$admin->login_ip = request()->getLocalIp();
|
||||||
|
@ -187,6 +187,7 @@ class StoreProductLogic extends BaseLogic
|
|||||||
'keyword' => $find['keyword'],
|
'keyword' => $find['keyword'],
|
||||||
'bar_code' => $find['bar_code'],
|
'bar_code' => $find['bar_code'],
|
||||||
'cate_id' => $find['cate_id'],
|
'cate_id' => $find['cate_id'],
|
||||||
|
'price' => $find['price'],
|
||||||
'store_id' => $store_id,
|
'store_id' => $store_id,
|
||||||
'sales' => 0,
|
'sales' => 0,
|
||||||
'stock' =>0,
|
'stock' =>0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user