diff --git a/app/admin/controller/LoginController.php b/app/admin/controller/LoginController.php index 9964d3200..01b37fd05 100644 --- a/app/admin/controller/LoginController.php +++ b/app/admin/controller/LoginController.php @@ -38,7 +38,6 @@ class LoginController extends BaseAdminController public function account() { $params = (new LoginValidate())->post()->goCheck(); - $params['is_admin']=$this->request->post('is_admin',1); return $this->data((new LoginLogic())->login($params)); } diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php new file mode 100644 index 000000000..919201ba4 --- /dev/null +++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php @@ -0,0 +1,64 @@ + ['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(); + } + +} \ No newline at end of file diff --git a/app/admin/lists/system_store/SystemStoreSourceLists.php b/app/admin/lists/system_store/SystemStoreSourceLists.php index 169264c14..760841fc1 100644 --- a/app/admin/lists/system_store/SystemStoreSourceLists.php +++ b/app/admin/lists/system_store/SystemStoreSourceLists.php @@ -6,8 +6,7 @@ namespace app\admin\lists\system_store; use app\admin\lists\BaseAdminDataLists; use app\common\model\system_store\SystemStore; use app\common\lists\ListsSearchInterface; -use app\common\model\store_product\StoreProduct; -use PDO; +use app\common\model\store_branch_product\StoreBranchProduct; /** * 根据商品来源查询门店列表 @@ -17,6 +16,7 @@ use PDO; class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchInterface { + protected $where = []; // 搜索条件数组,用于存储搜索条件,以便在列表中使用。 /** * @notes 设置搜索条件 @@ -27,7 +27,7 @@ class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchI public function setSearch(): array { return [ - '=' => ['name', 'phone'], + '=' => ['product_id'], ]; } @@ -43,18 +43,11 @@ class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchI */ public function lists(): array { - $store_arr=StoreProduct::where('source_id',$this->request->get('product_id'))->column('store_id'); - if($store_arr){ - $this->searchWhere[]=['id', 'in', $store_arr]; - }else{ - return []; - } - return SystemStore::where($this->searchWhere) - ->field(['id', 'name', 'phone', 'detailed_address', 'image']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); + $arr = StoreBranchProduct::where($this->searchWhere)->select()->each(function ($item) { + $item['system_store_name']=SystemStore::whereIn('id', $item['store_id'])->value('name'); + return $item; + }); + return $arr?->toArray(); } @@ -66,11 +59,6 @@ class SystemStoreSourceLists extends BaseAdminDataLists implements ListsSearchI */ public function count(): int { - if($this->searchWhere){ - return SystemStore::where($this->searchWhere)->count(); - }else{ - return 0; - } + return StoreBranchProduct::where($this->searchWhere)->count(); } - -} \ No newline at end of file +} diff --git a/app/admin/logic/LoginLogic.php b/app/admin/logic/LoginLogic.php index 090793813..aaad56466 100644 --- a/app/admin/logic/LoginLogic.php +++ b/app/admin/logic/LoginLogic.php @@ -44,16 +44,6 @@ class LoginLogic extends BaseLogic { $time = time(); $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_ip = request()->getLocalIp(); diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 6747db80d..ad4f9c5c2 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -187,6 +187,7 @@ class StoreProductLogic extends BaseLogic 'keyword' => $find['keyword'], 'bar_code' => $find['bar_code'], 'cate_id' => $find['cate_id'], + 'price' => $find['price'], 'store_id' => $store_id, 'sales' => 0, 'stock' =>0,