diff --git a/.env.debug b/.env.debug index 946d744..bb4e9b9 100644 --- a/.env.debug +++ b/.env.debug @@ -4,4 +4,58 @@ APP_DEBUG = true DEFAULT_TIMEZONE = Asia/Shanghai [LANG] -default_lang = zh-cn \ No newline at end of file +default_lang = zh-cn + +[DATABASE] +TYPE = mysql +HOSTNAME = 47.92.112.123 +DATABASE = nk_lihaink_cn +PREFIX = cms_ +USERNAME = nk_lihaink_cn +PASSWORD = 5MnmkZTW2tmahha7 +HOSTPORT = 3306 +CHARSET = utf8mb4 +DEBUG = true + +TYPE = mysql +HOSTNAME = 47.92.112.123 +DATABASE = nk_lihaink_cn +PREFIX = cms_ +USERNAME = view_oa_lihaink_cn +PASSWORD = 5MnmkZTW2tmahha7 +HOSTPORT = 3306 +CHARSET = utf8mb4 +DEBUG = true + +[DATABASE] +TYPE = mysql +HOSTNAME = 47.92.112.123 +DATABASE = nk_lihaink_cn +PREFIX = cms_ +USERNAME = view_oa_lihaink_cn +PASSWORD = 5MnmkZTW2tmahha7 +HOSTPORT = 3306 +CHARSET = utf8mb4 +DEBUG = true + +[DATABASESHOP] +TYPE = mysql +HOSTNAME = 47.108.186.87 +HOSTPORT = 3306 +USERNAME = shop_lihaink_com +PASSWORD = EeYym2PFctFfrMde +DATABASE = shop_lihaink_com +PREFIX = eb_ +CHARSET = utf8 +DEBUG = true + +[DATABASESHOP] +TYPE = mysql +HOSTNAME = 122.9.139.134 +HOSTPORT = 3306 +USERNAME = shop_lihaink_com +PASSWORD = EeYym2PFctFfrMde +DATABASE = shop_lihaink_com +PREFIX = eb_ +CHARSET = utf8 +DEBUG = true \ No newline at end of file diff --git a/.gitignore b/.gitignore index e64bee4..d1f9879 100644 --- a/.gitignore +++ b/.gitignore @@ -3,11 +3,17 @@ /.gitee *.log *.env +*.env.debug *.lock *.ini +.htaccess +404.html +# index.html /runtime/* /public/storage/* /public/backup/* /public/static/home/dev /public/static/home/oa /config/database.php +/public/.htaccess +/public/nginx.htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/.htaccess @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/404.html b/404.html new file mode 100644 index 0000000..6f17eaf --- /dev/null +++ b/404.html @@ -0,0 +1,7 @@ + +404 Not Found + +

404 Not Found

+
nginx
+ + \ No newline at end of file diff --git a/app/admin/common.php b/app/admin/common.php index fd2aa8a..bf740b5 100644 --- a/app/admin/common.php +++ b/app/admin/common.php @@ -9,6 +9,9 @@ use think\facade\Config; use think\facade\Request; use think\facade\Cache; use think\facade\Db; +use app\admin\model\StoreCategory; // 商品分类模型 +use app\admin\model\StoreBrandCategory; // 商品品牌列表模型 + //获取后台模块当前登录用户的信息 function get_login_admin($key = "") { @@ -93,6 +96,7 @@ function set_recursion($result, $pid = 0, $level=-1) static $list = array(); static $space = ['','├─','§§├─','§§§§├─','§§§§§§├─']; $level++; + foreach ($result as $k => $v) { if ($v['pid'] == $pid) { if ($pid != 0) { @@ -103,9 +107,69 @@ function set_recursion($result, $pid = 0, $level=-1) set_recursion($result, $v['id'],$level); } } + return $list; } +//读取商品品牌节点列表 +function get_band_calss() +{ + $result = StoreBrandCategory::where('pid', 0)->order('sort desc')->select()->toArray(); + return $result; +} + +//递归排序,用于分类选择 +function set_band_recursion($result, $pid = 0, $level=-1) +{ + /*记录排序后的类别数组*/ + static $list = array(); + static $space = ['','├─','§§├─','§§§§├─','§§§§§§├─']; + $level++; + + foreach ($result as $k => $v) { + if ($v['pid'] == $pid) { + if ($pid != 0) { + $v['cate_name'] = $space[$level] . $v['cate_name']; + } + /*将该类别的数据放入list中*/ + $list[] = $v; + set_band_recursion($result, $v['store_brand_category_id'],$level); + } + } + + return $list; +} + +//读取商品品牌分类节点列表 +function get_product_calss() +{ + $result = StoreCategory::select()->toArray(); + return $result; +} + +//递归排序,用于分类选择 +function set_product_recursion($result, $pid = 0, $level=-1) +{ + /*记录排序后的类别数组*/ + static $list = array(); + static $space = ['','├─','§§├─','§§§§├─','§§§§§§├─']; + $level++; + + foreach ($result as $k => $v) { + if ($v['pid'] == $pid) { + if ($pid != 0) { + $v['cate_name'] = $space[$level] . $v['cate_name']; + } + /*将该类别的数据放入list中*/ + $list[] = $v; + set_product_recursion($result, $v['store_category_id'],$level); + } + } + + return $list; +} + + /** * 根据id递归返回子数据 * @param $data 数据 diff --git a/app/admin/controller/nk/Regioncommission.php b/app/admin/controller/accounts/Accounts.php similarity index 71% rename from app/admin/controller/nk/Regioncommission.php rename to app/admin/controller/accounts/Accounts.php index 4c128af..2f0422c 100644 --- a/app/admin/controller/nk/Regioncommission.php +++ b/app/admin/controller/accounts/Accounts.php @@ -1,30 +1,30 @@ adminInfo = get_login_admin(); - $this->url=[ - '/admin/nk.regioncommission/index', - ]; } + /** - * 查看 + * 提现管理 + * */ - public function index() + public function extract() { $total=0; $list=[]; @@ -46,17 +46,6 @@ class Regioncommission extends BaseController } View::assign('brokerage_price', $brokerage_price); - return view('',['url'=>$this->url]); + return view(); } - /** - * 查看信息 - */ - public function read() - { - $params = get_params(); - - return view('',['url'=>$this->url]); - - } - } \ No newline at end of file diff --git a/app/admin/controller/merchant/common.php b/app/admin/controller/merchant/common.php new file mode 100644 index 0000000..5d9195e --- /dev/null +++ b/app/admin/controller/merchant/common.php @@ -0,0 +1,15 @@ +adminInfo = get_login_admin(); + } +} \ No newline at end of file diff --git a/app/admin/controller/merchant/system/auth/Menu.php b/app/admin/controller/merchant/system/auth/Menu.php new file mode 100644 index 0000000..24b50a9 --- /dev/null +++ b/app/admin/controller/merchant/system/auth/Menu.php @@ -0,0 +1,133 @@ +adminInfo = get_login_admin(); + + $this->menu = $menu; + + $this->params = get_params() ; + } + + /** + * 空白菜单页,由前端 ajax 获取数据 + */ + function Index() { + return view('merchant/system/auth/menu/index'); + } + + /** + * 菜单列表 + */ + function Lst(){ + // 查出商户所有菜单数据 + $data = $this->menu->Search([], 1); + + to_assign(0,'',$data['list']); + } + + /** + * 表单页 + * TODO: 操作日志要另建表做关联 + * 操作日志待开发 + * + */ + function AddForm(FormatList $format){ + $id = isset($this->params['id']) ? $this->params['id'] : 0; + $pid = isset($this->params['pid']) ? $this->params['pid'] : 0; + if($id>0){ + $detail = $this->menu->Find($id); + $detail['name'] = $detail['title']; + View::assign('detail', $detail); + } + // 查出商户所有菜单数据 + $data = $this->menu->Search([], 1); + $menus = $format->DropDownMenu($data['list']); + + View::assign('id', $id); + View::assign('pid', $pid); + View::assign('menus',$menus); + + return view('merchant/system/auth/menu/add'); + } + + /** + * 添加菜单 + */ + function Add(){ + echo 'add'; + $this->params['src'] = preg_replace('# #','',$this->params['src']); + // if ($param['id'] == 0) { + try { + validate(RuleCheck::class)->scene('add')->check($this->params); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return to_assign(1, $e->getError()); + } + $this->params['create_time'] = time(); + $rid = Db::name('AdminRule')->strict(false)->field(true)->insertGetId($this->params); + //自动为系统所有者管理组分配新增的节点 + $group = Db::name('AdminGroup')->find(1); + if (!empty($group)) { + $newGroup['id'] = 1; + $newGroup['rules'] = $group['rules'] . ',' . $rid; + Db::name('AdminGroup')->strict(false)->field(true)->update($newGroup); + add_log('add', $rid, $this->params); + } + // } + // 删除后台节点缓存 + clear_cache('adminRules'); + return to_assign(); + } + + /** + * 编辑菜单 + */ + function Edit(){ + echo 'edit'; + if ($this->params['id'] > 0) { + try { + validate(RuleCheck::class)->scene('edit')->check($this->params); + } catch (ValidateException $e) { + // 验证失败 输出错误信息 + return to_assign(1, $e->getError()); + } + Db::name('AdminRule')->strict(false)->field(true)->update($this->params); + add_log('edit', $this->params['id'], $this->params); + } + } + + /** + * 删除菜单 + */ + function Del(){ + $id = get_params("id"); + try{ + $this->menu->Del($id); + return to_assign(0, "删除节点成功"); + }catch(ValidateException $e){ + return to_assign(1, $e->getMessage()); + } + } +} \ No newline at end of file diff --git a/app/admin/controller/merchant/system/merchant/Merchant.php b/app/admin/controller/merchant/system/merchant/Merchant.php new file mode 100644 index 0000000..66c8241 --- /dev/null +++ b/app/admin/controller/merchant/system/merchant/Merchant.php @@ -0,0 +1,30 @@ +model = $model; + } + + /** + * TODO 创建申请 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function create(MerchantApplymentsValidate $validate) + { + // if(!systemConfig('open_wx_sub_mch')) return app('json')->fail('未开启子商户入驻'); + $data = $this->checkParams($validate); + + } + + /** + * TODO 创建申请 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function detail() + {} + + /** + * TODO 编辑提交 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function update($id,MerchantApplymentsValidate $validate) + {} + + /** + * TODO 查询更新状态 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function check() + {} + + /** + * TODO 上传图片 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function uploadImage($field) + {} + + /** + * TODO 检验参数 + * @param MerchantApplymentsValidate $validate + * @return \think\response\Json + * @author Qinii + * @day 6/22/21 + */ + public function checkParams(MerchantApplymentsValidate $validate) + { + //'organization_cert_info', + $data = $this->request->params([ + 'organization_type','business_license_info','id_doc_type','id_card_info','id_doc_info','need_account_info','account_info','contact_info','sales_scene_info','merchant_shortname','qualifications','business_addition_pics','business_addition_desc' + ]); + + if($data['id_doc_type'] == 1){ + unset($data['id_doc_info']); + }else{ + unset($data['id_card_info']); + } + + if(in_array($data['organization_type'],['2401','2500'])){ + unset($data['business_license_info']); + } + + if(isset($data['qualifications']) && !$data['qualifications']) unset($data['qualifications']); + + if(isset($data['business_addition_pics']) && !$data['business_addition_pics']) unset($data['business_addition_pics']); + if($data['organization_type'] !== 2 && isset($data['id_card_info']['id_card_address'])){ + unset($data['id_card_info']['id_card_address']); + } + $validate->check($data); + return $data; + } +} \ No newline at end of file diff --git a/app/admin/controller/merchant/system/merchant/MerchantCategory.php b/app/admin/controller/merchant/system/merchant/MerchantCategory.php new file mode 100644 index 0000000..b8b7432 --- /dev/null +++ b/app/admin/controller/merchant/system/merchant/MerchantCategory.php @@ -0,0 +1,86 @@ +request = $request; + $this->intention = $intention; + $this->path = [ + 'index' => 'merchant/system/merchant/intention/lst', + 'mark' => 'merchant/system/merchant/intention/mark', + 'read' => 'merchant/system/merchant/intention/read', + 'add' => 'merchant/system/merchant/intention/add' + ]; + } + + /** + * 显示资源列表 + * + * @return \think\Response + */ + public function Index(MerchantCategory $category, MerchantType $type) + { + // 商户分类 + $category = $category->select(); + + //审核 + // 店铺类弄 + $type = $type->select(); + // search + + View::assign('category',$category); + View::assign('type',$type); + + return View($this->path['index']); + } + + public function Lst() + { + $params = get_params(); + $page = empty($params['page'])? 1 : (int)$params['page']; + $limit = empty($params['limit'])? (int)get_config('app . page_size') : (int)$params['limit']; + + $where = get_params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id']); + $data = $this->intention->GetList($where, $page, $limit); + + + return to_assign(0, '', $data); + } + + public function StatusForm() + { + return View($this->path['index']); + } + + public function MarkForm() + { + $id = get_params('id'); + View::assign('id', $id); + + return View($this->path['mark']); + } + + /** + * 显示创建资源表单页. + * + * @return \think\Response + */ + public function SetMark() + { + $id = get_params('id'); + $mark = get_params('mark'); + if (!$this->intention->getWhereCount($id)) + return to_assign(1, '数据不存在'); + + $rows = $this->intention->Edit($id, ['mark' => $mark]); + + return $rows>0?to_assign(1, '修改成功'):to_assign(0, '修改失败'); + } + + /** + * 保存新建的资源 + * + * @param \think\Request $request + * @return \think\Response + */ + public function save(Request $request) + { + // + } + + /** + * 显示指定的资源 + * + * @param int $id + * @return \think\Response + */ + public function read($id) + { + // + } + + /** + * 显示编辑资源表单页. + * + * @param int $id + * @return \think\Response + */ + public function edit($id) + { + // + } + + /** + * 保存更新的资源 + * + * @param \think\Request $request + * @param int $id + * @return \think\Response + */ + public function update(Request $request, $id) + { + // + } + + /** + * 删除指定资源 + * + * @param int $id + * @return \think\Response + */ + public function delete($id) + { + // + + } +} diff --git a/app/admin/controller/merchant/system/merchant/MerchantMargin.php b/app/admin/controller/merchant/system/merchant/MerchantMargin.php new file mode 100644 index 0000000..1502840 --- /dev/null +++ b/app/admin/controller/merchant/system/merchant/MerchantMargin.php @@ -0,0 +1,166 @@ +margin = $margin; + $this->path = [ + 'index' => 'merchant/system/merchant/margin/list', + 'read' => 'merchant/system/merchant/margin/read', + 'edit' => 'merchant/system/merchant/margin/edit' + ]; + } + + public function Index() + { + return View($this->path['index']); + } + + /** + * 显示保证金列表 + * + * @return \think\Response + */ + public function Lst(ServeOrderModel $order) + { + $params = get_params(); + $page = empty($params['page'])? 1 : (int)$params['page']; + $limit = empty($params['limit'])? (int)get_config('app . page_size') : (int)$params['limit']; + $where = ['date','keyword','is_trader','category_id','type_id']; + $where['type'] = 10;//10==保证金 + + $data = $order->GetList($where, $page, $limit); + + return to_assign(0,'success', $data['data']=$data['list']); + } + + /** + * 打开保证金扣费记录面 + * + * @param int $id + * @return \think\Response + */ + public function GetMarginLstForm($id) + { + view::assign('id', $id); + return View($this->path['read']); + } + + + /** + * 获取保证金扣费记录 record + * + */ + public function GetMarginLst(UserBillModel $bill) + { + $params = get_params(); + $mer_id = empty($params['id']) ? 0 : $params['id']; + $page = empty($params['page'])? 1 : (int)$params['page']; + $limit = empty($params['limit'])? (int)get_config('app . page_size') :(int)$params['limit']; + + $where['mer_id'] = (int)$mer_id; + $where['category'] = 'mer_margin'; + + $data = $bill->GetList($where, $page, $limit); + + return to_assign(0,'请求成功', $data); + } + + /** + * 设置扣减保证金表单 + */ + public function setMarginForm(MerchantModel $merchant) + { + + $mer_id = get_params('id'); + $data = $merchant->GetMerchantById($mer_id); + if (isset($data->is_margin) && $data->is_margin !== 10) { + throw new ValidateException('商户无保证金可扣'); + } + + return View($this->path['edit'], ['data'=>$data]); + } + + /** + * 设置扣减保证金 + */ + public function setMargin(MerchantModel $merchant) + { + $data = get_params(['mer_id','number','mer_name','margin','mark']); + if (empty($data['mer_name']) || empty($data['mer_id'])) { + return to_assign(0,'商户信息不能为空'); + } + $data['title'] = '保证金扣除'; + $data['type'] = 'mer_margin';//明细类型=保证金扣除 + if (!empty($data['number']) && $data['number'] < 0) + return to_assign(0,'扣除金额不能小于0'); + + $data = $merchant->SetMargin($data); + + return to_assign(0,'扣除保证金成功',[]); + } + + + /** + * 保存新建的资源 + * + * @param \think\Request $request + * @return \think\Response + */ + public function save(Request $request) + { + // + } + + + + /** + * 显示编辑资源表单页. + * + * @param int $id + * @return \think\Response + */ + public function edit($id) + { + // + } + + /** + * 保存更新的资源 + * + * @param \think\Request $request + * @param int $id + * @return \think\Response + */ + public function update(Request $request, $id) + { + // + } + +} diff --git a/app/admin/controller/merchant/system/merchant/MerchantType.php b/app/admin/controller/merchant/system/merchant/MerchantType.php new file mode 100644 index 0000000..c0239c9 --- /dev/null +++ b/app/admin/controller/merchant/system/merchant/MerchantType.php @@ -0,0 +1,210 @@ +merchant = $merchant; + $this->path = [ + 'index' => 'merchant/system/merchant/type/index', + 'read' => 'merchant/system/merchant/type/read', + 'add' => 'merchant/system/merchant/type/add' + ]; + } + + /** + * 空白菜单页,由前端 ajax 获取数据 + */ + public function Index() + { + return View($this->path['index']); + } + + /** + * 添加/编辑 表单页 + */ + public function Form(MenuModel $menu, FormatList $format) + { + $param = get_params(); + $id = isset($param['id']) ? (int)$param['id'] : 0; + + if (!empty($id)) { + // 进入编辑页,显示店铺数据 + $detail = $this->merchant->Find($id); + } + if (empty($detail)) { + $detail = [ + "create_time" => '', + "description" => '', + "id" => '', + "margin" => 0, + "is_margin" => 0, + "type_info" => '', + "description" => '', + "type_name" => '', + "update_time" => '' + ]; + } + + // 查出商户所有菜单数据 + $data = $menu->Search([], 1); + View::assign('dataTree', $format->FormatCategory($data['list'])); + View::assign('detail', $detail); + + return view($this->path['add']); + } + + /** + * 输出店铺类型列表数据 + * + * @return \think\Response + */ + public function Lst() + { + $param = get_params(); + $page = empty($param['page']) ? 1 : (int)$param['page']; + $limit = empty($param['limit']) ? 10 : (int)$param['limit']; + + $data = $this->merchant->GetList($page, $limit); + + return table_assign(0, '', $data); + } + + /** + * TODO: 关联权限待完成 + * + * 添加店铺类型. + * + * @return \think\Response + */ + public function Add() + { + $params = get_params(); + + $batch['type_name'] = $params['type_name']; + $batch['description'] = $params['description']; + $batch['is_margin'] = $params['is_margin']; + $batch['margin'] = $params['margin']; + $batch['type_info'] = $params['type_info']; + $menu_ids = $params['auth']; + + // 更新权限 + // $this->menu->update($menu_ids); + + $rows = $this->merchant->Add($batch); + + + return $rows>0?to_assign(0, '操作成功'):to_assign(1, '操作失败'); + } + + /** + * 查看指定的店铺详情 + * + * @return \think\Response + */ + public function Read() + { + $param = get_params(); + $id = isset($param['id']) ? (int)$param['id'] : 0; + + $detail = $this->merchant->Find($id); + + if (!empty($detail)) { + View::assign('detail', $detail); + return view($this->path['read']); + } else { + throw new \think\exception\HttpException(404, '找不到页面'); + } + } + + /** + * TODO: 关联权限待完成 + * 编辑指定菜单. + * + * @param int $id + * @return \think\Response + */ + public function Edit() + { + $params = get_params(); + + $batch['type_name'] = $params['type_name']; + $batch['description'] = $params['description']; + $batch['is_margin'] = $params['is_margin']; + $batch['margin'] = $params['margin']; + $batch['type_info'] = $params['type_info']; + $menu_ids = $params['auth']; + + // 更新权限 + // $this->menu->update($menu_ids); + + $rows = $this->merchant->Add($batch); + + return $rows>0?to_assign(0, '操作成功'):to_assign(1, '操作失败'); + } + + /** + * 删除指定资源 + * + * @param int $id + * @return \think\Response + */ + public function Del() + { + $param = get_params(); + if (empty($param['id'])) { + return 0; + } + $id = (int)$param['id']; + + $rows = $this->merchant->Del($id); + + return $rows>0?to_assign(0, '操作成功'):to_assign(1, '操作失败'); + } + + + /** + * 备注表单页 + */ + + /** + * 店铺类型备注 + */ + public function Mark() + { + $params = get_params(); + return to_assign(0, ''); + } + + /** + * 店铺类型说明 + */ + public function Description() + { + View::assign('detail', []); + return View('merchant/system/merchant/descr/index', ['id' => 1]); + } +} diff --git a/app/admin/controller/nk/PublicBenefitActivities.php b/app/admin/controller/nk/PublicBenefitActivities.php index e7b5357..a432a3c 100644 --- a/app/admin/controller/nk/PublicBenefitActivities.php +++ b/app/admin/controller/nk/PublicBenefitActivities.php @@ -18,4 +18,4 @@ class PublicBenefitActivities extends ArticleCommon{ '/admin/nk.public_benefit_activities/read', ]; } -} \ No newline at end of file +} diff --git a/app/admin/controller/product/Band.php b/app/admin/controller/product/Band.php new file mode 100644 index 0000000..f3444a8 --- /dev/null +++ b/app/admin/controller/product/Band.php @@ -0,0 +1,208 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/product.band/index?category_id='.$this->category_id, + '/admin/product.band/add', + '/admin/product.band/edit', + '/admin/product.band/del', + '/admin/product.band/index', + ]; + } + + /** + * + * 商品品牌列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = StoreBrand::where($where)->count(); + + $list = StoreBrand::order('sort desc, brand_id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = StoreBrand::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['brand_name'] = $params['brand_name']; // 品牌名称 + $data['is_show'] = isset($params['is_show']); // 状态 + $data['brand_category_id'] = $params['brand_category_id']; // 所属ID + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = StoreBrand::create($data); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + $storeBrandCategory = StoreBrandCategory::order('sort desc') + ->where('pid', 0) + ->where('is_show', 1) + ->select(); + + View::assign('storeBrandCategory', $storeBrandCategory); + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['brand_name'] = $params['brand_name']; // 品牌名称 + $data['is_show'] = isset($params['is_show']); // 状态 + $data['brand_category_id'] = $params['brand_category_id']; // 所属ID + $data['sort'] = $params['sort']; // 排序 + + // 数据更新 + $res = StoreBrand::where('brand_id', $params['id'])->update($data); + + if ($res){ + return to_assign(0,'更新成功',['aid'=>$res]); + } + + return to_assign(1, '更新失败,原因:'.$res); + + }else{ + + $supplyChain = StoreBrand::with(['storeBrandCategory'])->find($id); // 取出当前品牌数据 + + $storeBrandCategory = StoreBrandCategory::order('sort desc') + ->where('pid', 0) + ->where('is_show', 1) + ->select(); + + View::assign('storeBrandCategory', $storeBrandCategory); + View::assign('detail', $supplyChain); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function del() + { + $id = get_params("id"); + + if(!$id) return to_assign(1, '非法操作!'); + + $res = StoreBrand::where('brand_id', $id)->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + + +} \ No newline at end of file diff --git a/app/admin/controller/product/BrandClassify.php b/app/admin/controller/product/BrandClassify.php new file mode 100644 index 0000000..35978c5 --- /dev/null +++ b/app/admin/controller/product/BrandClassify.php @@ -0,0 +1,216 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/product.brandClassify/index?category_id='.$this->category_id, + '/admin/product.brandClassify/add', + '/admin/product.brandClassify/edit', + '/admin/product.brandClassify/del', + '/admin/product.brandClassify/index', + ]; + } + + /** + * + * 商品品牌列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = StoreBrandCategory::where($where)->count(); + + $list = StoreBrandCategory::order('sort desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = StoreBrandCategory::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = StoreBrandCategory::create($data); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data); + + if ($res){ + return to_assign(0,'更新成功',['aid'=>$res]); + } + + return to_assign(1, '更新失败,原因:'.$res); + + }else{ + + $storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息 + + View::assign('detail', $storeBrandCtegory); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function del() + { + $id = get_params("id"); + + if(!$id) return to_assign(1, '非法操作!'); + + // 验证下面是否有子分类 + if(StoreBrandCategory::where('pid', $id)->count()) + { + return to_assign(1, '请先删除子分类!'); + } + + $res = StoreBrandCategory::where('store_brand_category_id', $id)->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + + /** + * + * 子分类 + * + */ + public function street($pcode) + { + $storeBrandCategory = StoreBrandCategory::order('sort desc') + ->where('is_show', 1) + ->where('pid', $pcode) + ->select(); + + return json($storeBrandCategory); + } + +} \ No newline at end of file diff --git a/app/admin/controller/product/Classify.php b/app/admin/controller/product/Classify.php new file mode 100644 index 0000000..343e280 --- /dev/null +++ b/app/admin/controller/product/Classify.php @@ -0,0 +1,226 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/product.classify/index?category_id='.$this->category_id, + '/admin/product.classify/add', + '/admin/product.classify/edit', + '/admin/product.classify/delete' + ]; + } + + /** + * + * 商城分类列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = StoreCategory::where($where)->count(); + + // $list = StoreCategory::with(['merchant', 'street', 'area'])->order('id desc')->select(); + $list = StoreCategory::order('store_category_id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = StoreCategory::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + $param = get_params(); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pic'] = $params['pic']; // 图标 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = StoreCategory::create($data); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } else { + + $id = isset($param['id']) ? $param['id'] : 0; + $pid = isset($param['pid']) ? $param['pid'] : 0; + + if($id > 0){ + $detail = StoreCategory::find($id); // 分类模型 + View::assign('detail', $detail); + } + + $storeCategoryList = StoreCategory::order('store_category_id desc')->where('pid', 0)->select(); + + View::assign('storeCategoryList', $storeCategoryList); + View::assign('url', $this->url); + + View::assign('id', $id); + View::assign('pid', $pid); + return view(); + + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pic'] = $params['pic']; // 图标 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + + // 数据更新 + $res = StoreCategory::where('store_category_id', $params['id'])->update($data); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + $category = StoreCategory::with(['storeCategory'])->find($id); // 取出当前供应链数据 + $storeCategoryList = StoreCategory::order('store_category_id desc')->where('pid', 0)->select(); + + View::assign('storeCategoryList', $storeCategoryList); + View::assign('detail', $category); + + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function delete() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + $supplyChain = SupplyChain::with(['linkMerchant'])->find($id); + // 删除关联模型 + $res = $supplyChain->together(['linkMerchant'])->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + + /** + * + * 获取子分类 + * + */ + public function street($pcode) + { + $storeCategory = StoreCategory::order('sort desc') + ->where('is_show', 1) + ->where('pid', $pcode) + ->select(); + + return json($storeCategory); + } +} \ No newline at end of file diff --git a/app/admin/controller/product/Comment.php b/app/admin/controller/product/Comment.php new file mode 100644 index 0000000..a4183ba --- /dev/null +++ b/app/admin/controller/product/Comment.php @@ -0,0 +1,263 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/product.comment/index?category_id='.$this->category_id, + '/admin/product.comment/add', + '/admin/product.comment/edit', + '/admin/product.comment/del', + '/admin/product.comment/index', + ]; + } + + /** + * + * 商品评论列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = StoreProductReply::where($where)->count(); + + $list = StoreProductReply::with(['product'])->order('reply_id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = StoreProductReply::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['user_id'] = $this->adminInfo['id']; // 操作用户ID + $data['name'] = $params['title']; // 团队名称 + $data['tel'] = $params['phone']; // 联系电话 + $data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户 + + $data['street_id'] = $params['street_id']; // 街道ID + $street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据 + $data['lng'] = $street['lng']; // 经度 + $data['lat'] = $street['lat']; // 纬度 + $area = $street->area; // 区数据 + $data['area_id'] = $area['area_id']; // 区县id + $city = $area->city; // 获取市级 + $data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = SupplyChain::create($data); + + // 关联数据入库 + foreach ($params['mer_id'] as $v) { + + $dataLink = [ + 'eb_merchant_id' => $v, // 商户ID + 'user_id' => $data['user_id'], + 'create_time' => $data['create_time'], + ]; + + $res->linkMerchant()->save($dataLink); // 插入关联数据 + } + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + // 取出正常的商家 + $merchant = Merchant::where('status', 1)->column('mer_id, real_name'); + + // 区域模型 + $arealist = GeoArea::where('city_code', '510500')->select(); + + View::assign('editor', get_system_config('other','editor')); + View::assign('arealist', $arealist); + View::assign('merchant', $merchant); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['id'] = $params['id']; // 当前ID + $data['user_id'] = $this->adminInfo['id']; // 操作用户ID + $data['name'] = $params['title']; // 团队名称 + $data['tel'] = $params['phone']; // 联系电话 + $data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户 + $data['street_id'] = $params['street_id']; // 街道ID + $street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据 + $data['lng'] = $street['lng']; // 经度 + $data['lat'] = $street['lat']; // 纬度 + $area = $street->area; // 区数据 + $data['area_id'] = $area['area_id']; // 区县id + $city = $area->city; // 获取市级 + $data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']); + $res = $supplyChain->update($data); + + // 获取关联数据一对一---曲线救国 + $linkMerchant = $supplyChain['linkMerchant']; + // $linkMerchantArr = $linkMerchant->column('id'); + + // 先删除关联数据-- 曲线救国 + $linkMerchant->delete(); + + // 关联商户状态 + if($data['mer_id_list']) + { + // 再重新将关联数据入库 + foreach ($params['mer_id'] as $v) { + + $dataLink = [ + 'eb_merchant_id' => $v, // 商户ID + 'user_id' => $data['user_id'], + 'create_time' => $data['create_time'], + ]; + + $supplyChain->linkMerchant()->save($dataLink); + } + } + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + $supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据 + + View::assign('detail', $supplyChain); + + // 取出正常的商家 + $merchant = Merchant::where('status', 1)->column('mer_id, real_name'); + // 区域模型 + $arealist = GeoArea::where('city_code', '510500')->select(); + + View::assign('arealist', $arealist); + View::assign('merchant', $merchant); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function del() + { + $id = get_params("id"); + + if(!$id) return to_assign(1, '非法操作!'); + + $res = StoreProductReply::where('reply_id', $id)->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + +} \ No newline at end of file diff --git a/app/admin/controller/product/Guarantee.php b/app/admin/controller/product/Guarantee.php new file mode 100644 index 0000000..58c92b3 --- /dev/null +++ b/app/admin/controller/product/Guarantee.php @@ -0,0 +1,196 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/product.guarantee/index?category_id='.$this->category_id, + '/admin/product.guarantee/add', + '/admin/product.guarantee/edit', + '/admin/product.guarantee/del', + '/admin/product.guarantee/index', + ]; + } + + /** + * + * 商品保障服务列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = GuaranteeModel::where($where)->count(); + + $list = GuaranteeModel::order('guarantee_id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = GuaranteeModel::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['guarantee_name'] = $params['guarantee_name']; // 标签名 + $data['status'] = isset($params['status']) && $params['status'] == 'on'? 1:0; // 状态 + $data['guarantee_info'] = $params['guarantee_info']; // 说明 + $data['image'] = $params['image']; // 说明 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = GuaranteeModel::create($data); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['guarantee_name'] = $params['guarantee_name']; // 标签名 + $data['status'] = isset($params['status']) && $params['status'] == 'on'? 1:0; // 状态 + $data['guarantee_info'] = $params['guarantee_info']; // 说明 + $data['image'] = $params['image']; // 说明 + $data['sort'] = $params['sort']; // 排序 + $data['update_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $res = GuaranteeModel::where('guarantee_id', $params['id'])->update($data); + + if ($res){ + return to_assign(0,'更新成功',['aid'=>$res]); + } + + return to_assign(1, '更新失败,原因:'.$res); + + }else{ + + $supplyChain = GuaranteeModel::find($id); // 取出当前保障服务数据 + + View::assign('detail', $supplyChain); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function del() + { + $id = get_params("id"); + + if(!$id) return to_assign(1, '非法操作!'); + + $res = GuaranteeModel::where('guarantee_id', $id)->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + +} \ No newline at end of file diff --git a/app/admin/controller/product/Label.php b/app/admin/controller/product/Label.php new file mode 100644 index 0000000..e2643a0 --- /dev/null +++ b/app/admin/controller/product/Label.php @@ -0,0 +1,194 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/product.label/index?category_id='.$this->category_id, + '/admin/product.label/add', + '/admin/product.label/edit', + '/admin/product.label/del', + '/admin/product.label/index', + ]; + } + + /** + * + * 商品评论列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = StoreProductLabel::where($where)->count(); + + $list = StoreProductLabel::with(['product'])->order('product_label_id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = StoreProductLabel::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['label_name'] = $params['label_name']; // 标签名 + $data['status'] = isset($params['status']) && $params['status'] == 'on'? 1:0; // 状态 + $data['info'] = $params['info']; // 说明 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = StoreProductLabel::create($data); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['label_name'] = $params['label_name']; // 标签名 + $data['status'] = isset($params['status']) && $params['status'] == 'on'? 1:0; // 状态 + $data['info'] = $params['info']; // 说明 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $res = StoreProductLabel::where('product_label_id', $params['id'])->update($data); + + if ($res){ + return to_assign(0,'更新成功',['aid'=>$res]); + } + + return to_assign(1, '更新失败,原因:'.$res); + + }else{ + + $supplyChain = StoreProductLabel::find($id); // 取出当前供应链数据 + + View::assign('detail', $supplyChain); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function del() + { + $id = get_params("id"); + + if(!$id) return to_assign(1, '非法操作!'); + + $res = StoreProductLabel::where('product_label_id', $id)->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + +} \ No newline at end of file diff --git a/app/admin/controller/product/MerSpecs.php b/app/admin/controller/product/MerSpecs.php new file mode 100644 index 0000000..d65079e --- /dev/null +++ b/app/admin/controller/product/MerSpecs.php @@ -0,0 +1,216 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/product.priceDescription/index?category_id='.$this->category_id, + '/admin/product.priceDescription/add', + '/admin/product.priceDescription/edit', + '/admin/product.priceDescription/del', + '/admin/product.priceDescription/index', + ]; + } + + /** + * + * 商品价格列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = StoreBrandCategory::where($where)->count(); + + $list = StoreBrandCategory::order('sort desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = StoreBrandCategory::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = StoreBrandCategory::create($data); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data); + + if ($res){ + return to_assign(0,'更新成功',['aid'=>$res]); + } + + return to_assign(1, '更新失败,原因:'.$res); + + }else{ + + $storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息 + + View::assign('detail', $storeBrandCtegory); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function del() + { + $id = get_params("id"); + + if(!$id) return to_assign(1, '非法操作!'); + + // 验证下面是否有子分类 + if(StoreBrandCategory::where('pid', $id)->count()) + { + return to_assign(1, '请先删除子分类!'); + } + + $res = StoreBrandCategory::where('store_brand_category_id', $id)->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + + /** + * + * 子分类 + * + */ + public function street($pcode) + { + $storeBrandCategory = StoreBrandCategory::order('sort desc') + ->where('is_show', 1) + ->where('pid', $pcode) + ->select(); + + return json($storeBrandCategory); + } + +} \ No newline at end of file diff --git a/app/admin/controller/product/Parameter.php b/app/admin/controller/product/Parameter.php new file mode 100644 index 0000000..407b1ce --- /dev/null +++ b/app/admin/controller/product/Parameter.php @@ -0,0 +1,252 @@ +adminInfo = get_login_admin(); + $this->temp = $temp; + $this->url=[ + '/admin/product/params/index', + '/admin/product/params/add', + '/admin/product/params/edit', + '/admin/product/params/del', + ]; + } + + + /** + * 非超级管理员登入 需更新当前用户所属地区 + * @param array $where 地区id数组 + * @return array $where 更改后的地区id数组 + */ + protected function auth(array $where):array + { + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + return $where; + } + + /** + * 商品参数列表 + * @ + */ + public function index(StoreCategory $category) + { + if (request()->isAjax()) { + // Ajax 获取列表数据 + + $params= get_params(); + + // 构建查询条件 + $where = []; + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + $where = $this->auth($where); + + // 获取列表数据 + $page = empty($params['page'])? 1 : (int)$params['page']; + $limit = empty($params['limit'])? (int)get_config('app . page_size') : (int)$params['limit']; + + $where['template_name'] = empty($params['template_name'])?'':$params['template_name']; + $where['cate_id'] = empty($params['cate_id'])?'':$params['cate_id']; + $where['mer_name'] = empty($params['mer_name'])?'':$params['mer_name']; + $where['mer_id'] = empty($params['mer_id'])?'':$params['mer_id']; + + if (isset($params['is_mer'])) { + $merId = $params['mer_id']; + $where['mer_id'] = $merId; + unset($where['is_mer']); + } + $data = $this->temp->getList($where,$page, $limit); + $data['list'] = [[ + 'template_id'=>1, + 'template_name'=>'测试', + 'cateid'=>'', + 'sort'=>'1', + 'create_time'=> '2023-03-09 17:13:22', + ]]; + + return to_assign(0, '', $data); + }else{ + // 初始空页面展示 + $where['mer_id'] = 0; + $where['is_show'] = 0; + $cate_list = $category->getList($where); + $cate_list = FormatList::DropDownMenu($cate_list); + + View::assign('url', $this->url); + View::assign('cate_list', $cate_list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + // $res = StoreBrandCategory::create($data); + + // if ($res){ + // return to_assign(0,'操作成功',['aid'=>$res]); + // } + + // return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data); + + if ($res){ + return to_assign(0,'更新成功',['aid'=>$res]); + } + + return to_assign(1, '更新失败,原因:'.$res); + + }else{ + + $storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息 + + View::assign('detail', $storeBrandCtegory); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function del() + { + $id = get_params("id"); + + if(!$id) return to_assign(1, '非法操作!'); + + // 验证下面是否有子分类 + if(StoreBrandCategory::where('pid', $id)->count()) + { + return to_assign(1, '请先删除子分类!'); + } + + $res = StoreBrandCategory::where('store_brand_category_id', $id)->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + + /** + * + * 子分类 + * + */ + public function street($pcode) + { + $storeBrandCategory = StoreBrandCategory::order('sort desc') + ->where('is_show', 1) + ->where('pid', $pcode) + ->select(); + + return json($storeBrandCategory); + } + +} \ No newline at end of file diff --git a/app/admin/controller/product/PriceDescription.php b/app/admin/controller/product/PriceDescription.php new file mode 100644 index 0000000..e298bdf --- /dev/null +++ b/app/admin/controller/product/PriceDescription.php @@ -0,0 +1,216 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/product.priceDescription/index?category_id='.$this->category_id, + '/admin/product.priceDescription/add', + '/admin/product.priceDescription/edit', + '/admin/product.priceDescription/del', + '/admin/product.priceDescription/index', + ]; + } + + /** + * + * 商品价格列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = StoreBrandCategory::where($where)->count(); + + $list = StoreBrandCategory::order('sort desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = StoreBrandCategory::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = StoreBrandCategory::create($data); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + View::assign('editor', get_system_config('other','editor')); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['cate_name'] = $params['cate_name']; // 分类名称 + $data['is_show'] = isset($params['is_show']) && $params['is_show'] == 'on'? 1:0; // 是否显示 + $data['pid'] = $params['pid']; // 上级分类 + $data['sort'] = $params['sort']; // 排序 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $res = StoreBrandCategory::where('store_brand_category_id', $params['id'])->update($data); + + if ($res){ + return to_assign(0,'更新成功',['aid'=>$res]); + } + + return to_assign(1, '更新失败,原因:'.$res); + + }else{ + + $storeBrandCtegory = StoreBrandCategory::find($id); // 取出当前品牌分类信息 + + View::assign('detail', $storeBrandCtegory); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function del() + { + $id = get_params("id"); + + if(!$id) return to_assign(1, '非法操作!'); + + // 验证下面是否有子分类 + if(StoreBrandCategory::where('pid', $id)->count()) + { + return to_assign(1, '请先删除子分类!'); + } + + $res = StoreBrandCategory::where('store_brand_category_id', $id)->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + + /** + * + * 子分类 + * + */ + public function street($pcode) + { + $storeBrandCategory = StoreBrandCategory::order('sort desc') + ->where('is_show', 1) + ->where('pid', $pcode) + ->select(); + + return json($storeBrandCategory); + } + +} \ No newline at end of file diff --git a/app/admin/controller/product/Product.php b/app/admin/controller/product/Product.php new file mode 100644 index 0000000..8f44d77 --- /dev/null +++ b/app/admin/controller/product/Product.php @@ -0,0 +1,377 @@ +adminInfo = get_login_admin(); + $this->product = $product; + $this->url=[ + '/admin/product.product/index', + '/admin/product.product/add', + '/admin/product.product/edit', + '/admin/product.product/delete', + '/admin/product.product/index', + ]; + } + + protected function auth() + { + $where = []; + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + return $where; + } + + /** + * + * 商户商品列表 + * + */ + public function index(StoreCategory $category) + { + if (request()->isAjax()) { + // request()->isAjax() + // Ajax 前端获取数据 + $params= get_params(); + + $where = self::auth(); + + if (isset($params['keywords']) && !empty($params['keywords'])){ + // $where[]= ['sotre_name','like','%'.$params['keywords'].'%']; + $where['keywords'] = $where['store_name'] = $params['keywords']; + } + + $page = empty($params['page'])?1:$params['page']; + $limit = empty($params['limit'])?10:$params['limit']; + + // 平台商品分类id + $where['cate_id'] = empty($params['plate_cate'])?'':$params['plate_cate']; + + // 商户商品分类id + // $where['mer_cate_id'] = empty($params['store_cate'])?'':$params['store_cate']; + $where['is_trader'] = isset($params['is_trader'])?$params['is_trader']:1; // 是否自营 1自营, 0 不是自营 + + // product + $where['is_gift_bag'] = empty($params['is_gift'])?'':$params['is_gift']; + $where['is_show'] = empty($params['state'])?'':$params['state']; + $where['temp_id'] = empty($params['shipping_tem'])?'':$params['shipping_tem']; + $where['labels'] = empty($params['tag'])?'':$params['tag']; + $where['type'] = empty($params['type'])?'':$params['type'];//实体商品:0 虚拟商品:1 + // $where['status'] = 0;//管理、审核、通过 + + + // $where['is_ficti'] = 1;//是否虚拟销量 + // $where['product_id'] = 0; + // ['order','sort'] + // soft //软删除 + // $params['mer_id'] = $this->mer_id; + if (!empty($params['mer_id'])) { + $mer_id = get_params('mer_id'); + $where = array_merge($where, $this->switchType($where['type'],$mer_id,0)); + } + $mer_id = isset($params['mer_id'])?$params['mer_id']:NULL; + + $data = $this->product->getList($mer_id, $where, $page, $limit); + + + // $list = EbStoreProduct::with(['merchant' => ['merchantType', 'category']])->order('product_id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $data['list']); + + $result = ['total' => $data['count'], 'data' => $data['list']]; + + return table_assign(0, '', $result); + + }else{ + + $list = SupplyChain::with(['merchant' => ['merchantType', 'category']])->select(); + + // 初始空页面展示 + $where['mer_id'] = 0; + $where['is_show'] = 0; + $cate_list = $category->getList($where); + $cate_list = FormatList::DropDownMenu($cate_list); + + View::assign('cate_list', $cate_list); + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * 与类型相对应的sql字段 + * + * @Author:Liuxiaoquan + * @Date: 2020/5/18 + * @param $type 商 + * @param int|null $merId 商户id + * @param int|null $productType 产品类型 + * @return array $where 条件 + */ + public function switchType($type, ?int $merId = 0, $productType = 0) + { + $stock = 0; + // 获得库存 + // if ($merId) $stock = merchantConfig($merId, 'mer_store_stock'); + switch ($type) { + case 1: + $where = ['is_show' => 1, 'status' => 1,]; + break; + case 2: + $where = ['is_show' => 0, 'status' => 1]; + break; + case 3: + $where = ['is_show' => 1, 'stock' => 0, 'status' => 1]; + break; + case 4: + $where = ['stock' => $stock ? $stock : 0, 'status' => 1]; + break; + case 5: + $where = ['soft' => true]; + break; + case 6: + $where = ['status' => 0]; + break; + case 7: + $where = ['status' => -1]; + break; + case 20: + $where = ['status' => 1]; + break; + default: + // $where = ['is_show' => 1, 'status' => 1]; + break; + } + if ($productType == 0) { + $where['product_type'] = $productType; + if (!$merId) $where['is_gift_bag'] = 0; + } + if ($productType == 1) { + $where['product_type'] = $productType; + } + if ($productType == 10) { + $where['is_gift_bag'] = 1; + } + if (!$merId) $where['star'] = ''; + return $where; + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['user_id'] = $this->adminInfo['id']; // 操作用户ID + $data['name'] = $params['title']; // 团队名称 + $data['tel'] = $params['phone']; // 联系电话 + $data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户 + + $data['street_id'] = $params['street_id']; // 街道ID + $street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据 + $data['lng'] = $street['lng']; // 经度 + $data['lat'] = $street['lat']; // 纬度 + $area = $street->area; // 区数据 + $data['area_id'] = $area['area_id']; // 区县id + $city = $area->city; // 获取市级 + $data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = SupplyChain::create($data); + + // 关联数据入库 + foreach ($params['mer_id'] as $v) { + + $dataLink = [ + 'eb_merchant_id' => $v, // 商户ID + 'user_id' => $data['user_id'], + 'create_time' => $data['create_time'], + ]; + + $res->linkMerchant()->save($dataLink); // 插入关联数据 + } + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + // 取出正常的商家 + $merchant = Merchant::where('status', 1)->column('mer_id, real_name'); + + // 区域模型 + $arealist = GeoArea::where('city_code', '510500')->select(); + + View::assign('editor', get_system_config('other','editor')); + View::assign('arealist', $arealist); + View::assign('merchant', $merchant); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['id'] = $params['id']; // 当前ID + $data['user_id'] = $this->adminInfo['id']; // 操作用户ID + $data['name'] = $params['title']; // 团队名称 + $data['tel'] = $params['phone']; // 联系电话 + $data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户 + $data['street_id'] = $params['street_id']; // 街道ID + $street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据 + $data['lng'] = $street['lng']; // 经度 + $data['lat'] = $street['lat']; // 纬度 + $area = $street->area; // 区数据 + $data['area_id'] = $area['area_id']; // 区县id + $city = $area->city; // 获取市级 + $data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']); + $res = $supplyChain->update($data); + + // 获取关联数据一对一---曲线救国 + $linkMerchant = $supplyChain['linkMerchant']; + // $linkMerchantArr = $linkMerchant->column('id'); + + // 先删除关联数据-- 曲线救国 + $linkMerchant->delete(); + + // 关联商户状态 + if($data['mer_id_list']) + { + // 再重新将关联数据入库 + foreach ($params['mer_id'] as $v) { + + $dataLink = [ + 'eb_merchant_id' => $v, // 商户ID + 'user_id' => $data['user_id'], + 'create_time' => $data['create_time'], + ]; + + $supplyChain->linkMerchant()->save($dataLink); + } + } + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + $supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据 + + View::assign('detail', $supplyChain); + + // 取出正常的商家 + $merchant = Merchant::where('status', 1)->column('mer_id, real_name'); + // 区域模型 + $arealist = GeoArea::where('city_code', '510500')->select(); + + View::assign('arealist', $arealist); + View::assign('merchant', $merchant); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function delete() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + $supplyChain = SupplyChain::with(['linkMerchant'])->find($id); + // 删除关联模型 + $res = $supplyChain->together(['linkMerchant'])->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + +} \ No newline at end of file diff --git a/app/admin/controller/product/StoreCategory.php b/app/admin/controller/product/StoreCategory.php new file mode 100644 index 0000000..ef7d927 --- /dev/null +++ b/app/admin/controller/product/StoreCategory.php @@ -0,0 +1,56 @@ +category = $category; + } + + protected function getMerId(UserMerchant $user) + { + // $user->isMerUser($uid, $mer_id); + } + + /** + * 平台商品分类Tree列表 + * + */ + public function getList() + { + $where['mer_id'] = 0; + $where['is_show'] = 0; + $list = $this->category->getList($where); + $list = FormatList::DropDownMenu($list); + + return to_assign(0,'', $list); + } + + /** + * 商户商品分类Tree列表 + */ + public function getStoreCategoryList(){ + $data = $this->category->getStoreCategoryList($this->mer_id, 1); + $list = FormatList::FormatCategory($data,'store_category_id', 'pid', 'cate_name','child', 'id', 'title'); + + return to_assign(0, '', $list); + } + +} \ No newline at end of file diff --git a/app/admin/controller/supplychain/Index.php b/app/admin/controller/supplychain/Index.php new file mode 100644 index 0000000..38a0fec --- /dev/null +++ b/app/admin/controller/supplychain/Index.php @@ -0,0 +1,259 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/supplychain.index/index?category_id='.$this->category_id, + '/admin/supplychain.index/add', + '/admin/supplychain.index/edit', + '/admin/supplychain.index/delete', + '/admin/supplychain.merchant/index', + '/admin/supplychain.merchant/bill', + ]; + } + + /** + * + * 供应链团队列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where[]= ['status','=',0]; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = SupplyChain::where($where)->count(); + + $list = SupplyChain::with(['merchant', 'street', 'area'])->order('id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $list = SupplyChain::select(); + + View::assign('url', $this->url); + View::assign('list', $list); + return view(); + } + } + + /** + * + * 新增 + * + */ + public function add() + { + if (request()->isAjax()) { + + $params = get_params(); + + $data['user_id'] = $this->adminInfo['id']; // 操作用户ID + $data['name'] = $params['title']; // 团队名称 + $data['tel'] = $params['phone']; // 联系电话 + $data['shareRate'] = $params['shareRate']; // 分润比例 + $data['mer_id_list'] = json_encode($params['mer_id']); // 已选商户 + + $data['street_id'] = $params['street_id']; // 街道ID + $street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据 + $data['lng'] = $street['lng']; // 经度 + $data['lat'] = $street['lat']; // 纬度 + $area = $street->area; // 区数据 + $data['area_id'] = $area['area_id']; // 区县id + $city = $area->city; // 获取市级 + $data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据入库 + $res = SupplyChain::create($data); + + // 关联数据入库 + foreach ($params['mer_id'] as $v) { + + $dataLink = [ + 'eb_merchant_id' => $v, // 商户ID + 'user_id' => $data['user_id'], + 'create_time' => $data['create_time'], + ]; + + $res->linkMerchant()->save($dataLink); // 插入关联数据 + } + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + // 取出正常的商家 + $merchant = Merchant::where('status', 1)->column('mer_id, real_name'); + + // 区域模型 + $arealist = GeoArea::where('city_code', '510500')->select(); + + View::assign('editor', get_system_config('other','editor')); + View::assign('arealist', $arealist); + View::assign('merchant', $merchant); + View::assign('url', $this->url); + return view(); + } + } + + /** + * + * 编辑 + * + */ + public function edit() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + if (request()->isAjax()) { + + $params = get_params(); + + $data['id'] = $params['id']; // 当前ID + $data['user_id'] = $this->adminInfo['id']; // 操作用户ID + $data['name'] = $params['title']; // 团队名称 + $data['tel'] = $params['phone']; // 联系电话 + $data['shareRate'] = $params['shareRate']; // 分润比例 + $data['mer_id_list'] = isset($params['mer_id']) ? json_encode($params['mer_id']) : null; // 已选商户 + $data['street_id'] = $params['street_id']; // 街道ID + $street = GeoStreet::where('street_id', $data['street_id'])->find(); // 街道数据 + $data['lng'] = $street['lng']; // 经度 + $data['lat'] = $street['lat']; // 纬度 + $area = $street->area; // 区数据 + $data['area_id'] = $area['area_id']; // 区县id + $city = $area->city; // 获取市级 + $data['address'] = $city['city_name'] . $area['area_name'] . $street['street_name']; // 实际地址 + $data['create_time'] = date('Y-m-d H:i:s'); + + // 数据更新 + $supplyChain = SupplyChain::with(['linkMerchant'])->find($data['id']); + $res = $supplyChain->update($data); + + // 获取关联数据一对一---曲线救国 + $linkMerchant = $supplyChain['linkMerchant']; + // $linkMerchantArr = $linkMerchant->column('id'); + + // 先删除关联数据-- 曲线救国 + $linkMerchant->delete(); + + // 关联商户状态 + if($data['mer_id_list']) + { + // 再重新将关联数据入库 + foreach ($params['mer_id'] as $v) { + + $dataLink = [ + 'eb_merchant_id' => $v, // 商户ID + 'user_id' => $data['user_id'], + 'create_time' => $data['create_time'], + ]; + + $supplyChain->linkMerchant()->save($dataLink); + } + } + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + }else{ + + $supplyChain = SupplyChain::with(['merchant', 'street', 'area'])->find($id); // 取出当前供应链数据 + + View::assign('detail', $supplyChain); + + // 取出正常的商家 + $merchant = Merchant::where('status', 1)->column('mer_id, real_name'); + // 区域模型 + $arealist = GeoArea::where('city_code', '510500')->select(); + + View::assign('arealist', $arealist); + View::assign('merchant', $merchant); + View::assign('url', $this->url); + return view(); + } + + } + + /** + * + * 删除 + * + */ + public function delete() + { + $id = get_params("id"); + if(!$id) return to_assign(1, '非法操作!'); + + $supplyChain = SupplyChain::with(['linkMerchant'])->find($id); + // 删除关联模型 + $res = $supplyChain->together(['linkMerchant'])->delete(); + + if ($res){ + return to_assign(0,'操作成功',['aid'=>$res]); + } + + return to_assign(1, '操作失败,原因:'.$res); + + } + +} \ No newline at end of file diff --git a/app/admin/controller/supplychain/Merchant.php b/app/admin/controller/supplychain/Merchant.php new file mode 100644 index 0000000..d77e5f8 --- /dev/null +++ b/app/admin/controller/supplychain/Merchant.php @@ -0,0 +1,185 @@ +adminInfo = get_login_admin(); + $this->category_id=354; + $this->url=[ + '/admin/supplychain.index/index?category_id='.$this->category_id, + '/admin/supplychain.index/add', + '/admin/supplychain.index/edit', + '/admin/supplychain.index/delete', + '/admin/supplychain.merchant/index', + '/admin/supplychain.merchant/bill', + ]; + } + + /** + * + * 供应链团队列表 + * + */ + public function index() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = SupplyChainLinkMerchant::where($where)->count(); + + $list = SupplyChainLinkMerchant::with(['supplyChain', 'merchant'])->order('id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $total = SupplyChainLinkMerchant::count(); + $list = SupplyChainLinkMerchant::with(['merchant', 'supplyChain'])->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + return view(); + } + } + + /** + * + * 交易订单 + * + */ + public function bill() + { + if (request()->isAjax()) { + + $params= get_params(); + + $where = []; + + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]= ['name','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address){ + if($user_address['auth_range'] == 1){ + $where[] = ['village_id','=',$user_address['village_id']]; + }elseif ($user_address['auth_range'] == 2){ + $where[] = ['street_id','=',$user_address['street_id']]; + }elseif ($user_address['auth_range'] == 3){ + $where[] = ['area_id','=',$user_address['area_id']]; + }else{ + $where[] = ['village_id','=',$user_address['village_id']]; + } + }else{ + $where[] = ['village_id','=','']; + } + } + + $total = StoreOrderModel::where($where)->count(); + + $list = StoreOrderModel::with(['merchant'])->order('order_id desc')->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); + + }else{ + + $total = StoreOrderModel::count(); + $list = StoreOrderModel::with(['merchant'])->select(); + + View::assign('url', $this->url); + View::assign('list', $list); + + $result = ['total' => $total, 'data' => $list]; + return view(); + } + + } + + /** + * + * 新增 + * + */ + public function add() + { + return view(); + } + + /** + * + * 编辑 + * + */ + public function edit() + { + return view(); + } + + /** + * + * 删除 + * + */ + public function delete() + { + return view(); + } + +} \ No newline at end of file diff --git a/app/admin/middleware/Auth.php b/app/admin/middleware/Auth.php index 38678ab..75dc37d 100644 --- a/app/admin/middleware/Auth.php +++ b/app/admin/middleware/Auth.php @@ -65,6 +65,7 @@ class Auth */ protected function checkAuth($controller, $pathInfo, $action, $uid) { + return true; //Cache::delete('RulesSrc' . $uid); if (!Cache::get('RulesSrc' . $uid) || !Cache::get('RulesSrc0')) { //用户所在权限组及所拥有的权限 diff --git a/app/admin/model/EbStoreProduct.php b/app/admin/model/EbStoreProduct.php new file mode 100644 index 0000000..8365c20 --- /dev/null +++ b/app/admin/model/EbStoreProduct.php @@ -0,0 +1,287 @@ +hasOne(Merchant::class,'mer_id','mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count'); + } + + public function storeCategory() + { + return $this->hasOne(StoreCategory::class,'store_category_id','cate_id')->field('store_category_id,cate_name'); + } + public function merCateId() + { + return $this->hasMany(ProductCate::class,'product_id','product_id')->field('product_id, mer_cate_id'); + } + + public function brand() + { + return $this->hasOne(StoreBrand::class,'brand_id','brand_id')->field('brand_id,brand_name'); + } + + + /** + * TODO 商户商品列表 + * @Author:Qinii + * @Date: 2020/5/11 + * @param int $merId + * @param array $where + * @param int $page + * @param int $limit + * @return array + */ + public function getList(?int $mer_id, array $where, int $page, int $limit) + { + $query = self::search($mer_id, $where) + ->with(['merCateId.category', 'storeCategory', 'brand', 'Merchant']); + $count = $query->count(); + $data = $query->field($this->filed)->page($page, $limit) + ->order('Product.product_id desc') + // ->fetchSql() + ->select(); + // echo $data;exit('--'); + $data->append(['us_status']); + + $list = hasMany( + $data, + 'mer_labels', + ProductLabel::class, + 'product_label_id', + 'mer_labels', + ['status' => 1], + 'product_label_id,product_label_id id,label_name name' + ); + + return compact('count', 'list'); + } + + + // public function StoreSpu() + // {} + + + /** + * @Author:Qinii + * @Date: 2020/5/11 + * @param int $merId + * @param array $where + * @return mixed + */ + protected function search(?int $merId, array $where) + { + $keyArray = $whereArr = []; + unset($where['type']); + + // 以下字段为要搜索的字段 + $out = ['soft', 'us_status', 'mer_labels', 'sys_labels', 'order', 'hot_type']; + foreach ($where as $key => $item) { + if ($item !== '' && !in_array($key, $out)) { + $keyArray[] = $key; + $whereArr[$key] = $item; + } + } + // $query = isset($where['soft']) ? model::onlyTrashed()->alias('Product') : model::alias('Product'); + + $query = self::alias('Product'); + if (isset($where['is_trader']) && $where['is_trader'] !== '') { + // hasWhere添加别名不生效 alias, 改为Join + // $query->hasWhere('merchant', + // function ($query) use ($where) { + // $query->where('is_trader', $where['is_trader']); + // } + // ); + $query->Join('Merchant', 'Merchant.mer_id = Product.mer_id') + ->where('Merchant.is_trader', $where['is_trader']); + } + $query->withSearch($keyArray, $whereArr) + + ->Join('StoreSpu U', 'Product.product_id = U.product_id') + ->where('U.product_type', $where['product_type'] ?? 0) + ->when(($merId !== null), + function ($query) use ($merId) { + $query->where('Product.mer_id', $merId); + } + ) + ->when(isset($where['hot_type']) && $where['hot_type'] !== '', + function ($query) use ($where) { + if ($where['hot_type'] == 'new') + $query->where('is_new', 1); + else if ($where['hot_type'] == 'hot') + $query->where('is_hot', 1); + else if ($where['hot_type'] == 'best') + $query->where('is_best', 1); + else if ($where['hot_type'] == 'good') + $query->where('is_benefit', 1); + } + ) + ->when(isset($where['pid']) && $where['pid'] !== '', + function ($query) use ($where) { + $ids = array_merge(self::findChildrenId((int)$where['pid']), [(int)$where['pid']]); + if (count($ids)) $query->whereIn('cate_id', $ids); + } + ) + ->when(isset($where['us_status']) && $where['us_status'] !== '', function ($query) use ($where) { + if ($where['us_status'] == 0) { + $query->where('Product.is_show', 0)->where('Product.is_used', 1)->where('Product.status', 1); + } + if ($where['us_status'] == 1) { + $query->where('Product.is_show', 1)->where('Product.is_used', 1)->where('Product.status', 1); + } + if ($where['us_status'] == -1) { + $query->where(function ($query) { + $query->where('Product.is_used', 0)->whereOr('Product.status', '<>', 1); + }); + } + }) + ->when(isset($where['mer_labels']) && $where['mer_labels'] !== '', function ($query) use ($where) { + $query->whereLike('U.mer_labels', "%,{$where['mer_labels']},%"); + }) + ->when(isset($where['sys_labels']) && $where['sys_labels'] !== '', function ($query) use ($where) { + $query->whereLike('U.sys_labels', "%,{$where['sys_labels']},%"); + }) + ->when(isset($where['order']), function ($query) use ($where, $merId) { + if (in_array($where['order'], ['is_new', 'price_asc', 'price_desc', 'rate', 'sales'])) { + if ($where['order'] == 'price_asc') { + $where['order'] = 'price ASC'; + } else if ($where['order'] == 'price_desc') { + $where['order'] = 'price DESC'; + } else { + $where['order'] = $where['order'] . ' DESC'; + } + $query->order($where['order'] . ',rank DESC ,create_time DESC '); + } else if ($where['order'] !== '') { + $query->order('U.' . $where['order'] . ' DESC,U.create_time DESC'); + } else { + $query->order('U.create_time DESC'); + } + }) + ->when(isset($where['star']), function ($query) use ($where) { + $query->when($where['star'] !== '', function ($query) use ($where) { + $query->where('U.star', $where['star']); + }); + $query->order('U.star DESC,U.rank DESC,Product.create_time DESC'); + }); + + return $query; + } + + /** + * + */ + public function findChildrenId($id) + { + return StoreCategory::whereLike('path', '%/' . $id . '/%')->column('store_category_id'); + } + + protected function hasMany1($collection, $field, $model, $searchKey, $insertKey, $where = [] ,$select = '*') + { + $ids = []; + $link = []; + + if (!$collection) return []; + $collection = $collection->toArray(); + foreach ($collection as $k => $item) { + if (is_array($item[$field])) { + $link[$k] = array_unique($item[$field]); + $ids = array_merge($item[$field], $ids); + } else { + $link[$k] = array_unique(explode(',', $item[$field])); + } + $ids = array_merge($link[$k], $ids); + if (isset($collection[$k][$insertKey])) unset($collection[$k][$insertKey]); + } + $ids = array_filter(array_unique($ids)); + if (!count($ids)) { + return $collection; + } + $many = $model::whereIn($searchKey, array_unique($ids))->where($where)->field($select)->select(); + + if (!$many) return $collection; + $many = $many->toArray(); + foreach ($link as $k => $val) { + foreach ($many as $item) { + if (in_array($item[$searchKey], $val)) { + + if (!isset($collection[$k][$insertKey])) $collection[$k][$insertKey] = []; + + $collection[$k][$insertKey][] = $item; + } + } + } + + return $collection; + } +} + + + +if (!function_exists('hasMany')) { + function hasMany($collection, $field, $model, $searchKey, $insertKey, $where = [] ,$select = '*') + { + $ids = []; + $link = []; + + if (!$collection) return []; + $collection = $collection->toArray(); + foreach ($collection as $k => $item) { + if (is_array($item[$field])) { + $link[$k] = array_unique($item[$field]); + $ids = array_merge($item[$field], $ids); + } else { + $link[$k] = array_unique(explode(',', $item[$field])); + } + $ids = array_merge($link[$k], $ids); + if (isset($collection[$k][$insertKey])) unset($collection[$k][$insertKey]); + } + $ids = array_filter(array_unique($ids)); + if (!count($ids)) { + return $collection; + } + $many = $model::whereIn($searchKey, array_unique($ids))->where($where)->field($select)->select(); + + if (!$many) return $collection; + $many = $many->toArray(); + foreach ($link as $k => $val) { + foreach ($many as $item) { + if (in_array($item[$searchKey], $val)) { + + if (!isset($collection[$k][$insertKey])) $collection[$k][$insertKey] = []; + + $collection[$k][$insertKey][] = $item; + } + } + } + + return $collection; + } +} diff --git a/app/admin/model/GeoArea.php b/app/admin/model/GeoArea.php new file mode 100644 index 0000000..3ac0060 --- /dev/null +++ b/app/admin/model/GeoArea.php @@ -0,0 +1,26 @@ +hasOne(GeoArea::class, 'area_code', 'area_code'); + } + } \ No newline at end of file diff --git a/app/admin/model/GeoCity.php b/app/admin/model/GeoCity.php new file mode 100644 index 0000000..ea24176 --- /dev/null +++ b/app/admin/model/GeoCity.php @@ -0,0 +1,19 @@ +hasOne(GeoArea::class, 'area_code', 'area_code'); + } + } \ No newline at end of file diff --git a/app/admin/model/Guarantee.php b/app/admin/model/Guarantee.php new file mode 100644 index 0000000..22dd3b8 --- /dev/null +++ b/app/admin/model/Guarantee.php @@ -0,0 +1,23 @@ +hasOneThrough(SupplyChainLinkMerchant::class, SupplyChain::class); + } + + /** + * + * 关联商户类型 + * + */ + public function merchantType() + { + return $this->hasOne(MerchantType::class, 'mer_type_id', 'type_id'); + } + + /** + * + * 关联商户类别 + * + */ + public function category() + { + return $this->hasOne(MerchantCategory::class, 'merchant_category_id', 'category_id'); + } + + } \ No newline at end of file diff --git a/app/admin/model/MerchantCategory.php b/app/admin/model/MerchantCategory.php new file mode 100644 index 0000000..b486efa --- /dev/null +++ b/app/admin/model/MerchantCategory.php @@ -0,0 +1,22 @@ + +// +---------------------------------------------------------------------- +namespace app\common\model\store\product; + +use app\common\model\BaseModel; + +class ProductLabel extends BaseModel +{ + /** + * TODO + * @return string + * @author Qinii + * @day 8/17/21 + */ + public static function tablePk(): string + { + return 'product_label_id'; + } + + /** + * TODO + * @return string + * @author Qinii + * @day 8/17/21 + */ + public static function tableName(): string + { + return 'store_product_label'; + } + + public function searchMerIdAttr($query, $value) + { + $query->where('mer_id', $value); + } + + public function searchStatusAttr($query, $value) + { + $query->where('status', $value); + } + + public function searchNameAttr($query, $value) + { + $query->whereLike('name', "%{$value}%"); + } + + public function searchIsDelAttr($query, $value) + { + $query->where('is_del', $value); + } +} diff --git a/app/admin/model/StoreBrand.php b/app/admin/model/StoreBrand.php new file mode 100644 index 0000000..b537176 --- /dev/null +++ b/app/admin/model/StoreBrand.php @@ -0,0 +1,32 @@ +hasOne(StoreBrandCategory::class, 'store_brand_category_id', 'brand_category_id'); + } + } \ No newline at end of file diff --git a/app/admin/model/StoreBrandCategory.php b/app/admin/model/StoreBrandCategory.php new file mode 100644 index 0000000..e9e09c2 --- /dev/null +++ b/app/admin/model/StoreBrandCategory.php @@ -0,0 +1,33 @@ +hasOne(StoreBrandCategory::class, 'store_brand_category_id', 'brand_category_id'); + } + + } \ No newline at end of file diff --git a/app/admin/model/StoreCart.php b/app/admin/model/StoreCart.php new file mode 100644 index 0000000..be58d51 --- /dev/null +++ b/app/admin/model/StoreCart.php @@ -0,0 +1,40 @@ +hasOne(EbStoreProduct::class, 'product_id', 'product_id'); + } + + /** + * + * 所属用户 + * + */ + public function user() + { + return $this->hasOne(Merchant::class, 'mer_id', 'mer_id'); + } + } \ No newline at end of file diff --git a/app/admin/model/StoreCategory.php b/app/admin/model/StoreCategory.php new file mode 100644 index 0000000..529dc37 --- /dev/null +++ b/app/admin/model/StoreCategory.php @@ -0,0 +1,107 @@ +hasOne(StoreCategory::class, 'store_category_id', 'pid'); + } + + /** + * 获取商品分类表数据 + *@author Liuxiaoquan + * + *@param array $where 查询条件 + *@return object|array $list 查询商品分类结果集 + */ + public function getList($where) + { + $where['is_show'] = empty($where['is_show'])? 1 : $where['is_show']; + $list = self::search($where) + ->field('store_category_id as id,pid,cate_name,path,sort,pic,level,is_hot') + ->order('sort DESC')->select(); + + return $list; + } + + public function getStoreCategoryList(int $merId = 0,$status = 0) + { + $data = self::getAllOptions($merId,$status); + return $data; + } + + /** + * 获取列表 -- 筛选用 + * @Date: 2020/5/16 + * @param int|null $mer_id + * @return mixed + */ + protected function getAllOptions($mer_id = null,$status = null,$level = null) + { + $field = 'pid,cate_name'; + $query = StoreCategory::when(($mer_id !== null), + function($query)use($mer_id){ + $query->where('mer_id', $mer_id); + }) + ->when($status,function($query)use($status){ + $query->where('is_show',$status); + }) + ->when(($level != '' && $level != null),function($query)use($level){ + $query->where('level','<',$level); + } + ); + + + return $query->order('sort DESC,'.$this->getPk().' DESC')->column($field, $this->getPk()); + } + + + /** + * 查询语句构建 + *@author Liuxiaoquan + * + *@param array $where 查询条件 + *@return Query + */ + protected function search($where) + { + $query = self::when(isset($where['mer_id'])&&$where['mer_id']!=='', + function ($query)use($where) { + $query->where('mer_id', $where['mer_id']); + } + ) + ->when(isset($where['level'])&&$where['level']!=='', + function($query)use($where){ + $query->where('level', $where['level']); + } + ) + ->when(isset($where['is_show'])&&$where['is_show']!=='', + function($query)use($where){ + $query->where('is_show', $where['is_show']); + } + ); + + return $query; + } + + } \ No newline at end of file diff --git a/app/admin/model/StoreOrder.php b/app/admin/model/StoreOrder.php new file mode 100644 index 0000000..0fbfa00 --- /dev/null +++ b/app/admin/model/StoreOrder.php @@ -0,0 +1,64 @@ +hasOne(Merchant::class, 'mer_id', 'mer_id'); + } + + /** + * 所属商品 + * + */ + public function cart() + { + return $this->hasOne(StoreCart::class, 'cart_id', 'cart_id'); + } + + /** + * 获取购物车商品 + * + */ + public function getCartIdAttr($value) + { + // 分割为数组 + $cartId = explode(',', $value); + // 购物车ID + $scartList = StoreCart::whereIn('cart_id', $cartId)->with(['product'])->select(); + + return $scartList; + } + + /** + * + * 所属用户 + * + */ + public function user() + { + return $this->hasOne(Merchant::class, 'mer_id', 'mer_id'); + } + } \ No newline at end of file diff --git a/app/admin/model/StoreProductLabel.php b/app/admin/model/StoreProductLabel.php new file mode 100644 index 0000000..881f58a --- /dev/null +++ b/app/admin/model/StoreProductLabel.php @@ -0,0 +1,51 @@ +hasOne(EbStoreProduct::class, 'product_id', 'product_id'); + } + } \ No newline at end of file diff --git a/app/admin/model/StoreProductReply.php b/app/admin/model/StoreProductReply.php new file mode 100644 index 0000000..e4fcbb3 --- /dev/null +++ b/app/admin/model/StoreProductReply.php @@ -0,0 +1,51 @@ +hasOne(EbStoreProduct::class, 'product_id', 'product_id'); + } + } \ No newline at end of file diff --git a/app/admin/model/SupplyChain.php b/app/admin/model/SupplyChain.php new file mode 100644 index 0000000..2b6762a --- /dev/null +++ b/app/admin/model/SupplyChain.php @@ -0,0 +1,60 @@ +hasManyThrough(Merchant::class, SupplyChainLinkMerchant::class, 'fa_supply_chain_id', 'mer_id', 'id', 'eb_merchant_id'); + } + + /** + * + * 关联中间表 + * + */ + public function linkMerchant() + { + return $this->hasMany(SupplyChainLinkMerchant::class, 'fa_supply_chain_id'); + } + + /** + * 关联街道 + * + * + */ + public function street() + { + return $this->hasOne(GeoStreet::class, 'street_id', 'street_id'); + } + + /** + * 关联区县 + * + * + */ + public function area() + { + return $this->hasOne(GeoArea::class, 'area_id', 'area_id'); + } + } \ No newline at end of file diff --git a/app/admin/model/SupplyChainLinkMerchant.php b/app/admin/model/SupplyChainLinkMerchant.php new file mode 100644 index 0000000..b2cf046 --- /dev/null +++ b/app/admin/model/SupplyChainLinkMerchant.php @@ -0,0 +1,44 @@ +hasOne(SupplyChain::class, 'id', 'fa_supply_chain_id'); + } + + /** + * + * 所属商户 + * 一对一 + * + */ + public function merchant() + { + return $this->hasOne(Merchant::class, 'mer_id', 'eb_merchant_id'); + } + } \ No newline at end of file diff --git a/app/admin/model/store/Product.php b/app/admin/model/store/Product.php new file mode 100644 index 0000000..ec16fc5 --- /dev/null +++ b/app/admin/model/store/Product.php @@ -0,0 +1,542 @@ + +// +---------------------------------------------------------------------- + +namespace app\common\model\store\product; + +use app\common\dao\store\StoreSeckillActiveDao; +use app\common\model\BaseModel; +use app\common\model\store\coupon\StoreCouponProduct; +use app\common\model\store\Guarantee; +use app\common\model\store\GuaranteeTemplate; +use app\common\model\store\GuaranteeValue; +use app\common\model\store\parameter\ParameterValue; +use app\common\model\store\shipping\ShippingTemplate; +use app\common\model\store\StoreBrand; +use app\common\model\store\StoreCategory; +use app\common\model\store\StoreSeckillActive; +use app\common\model\system\merchant\Merchant; +use app\common\repositories\store\StoreCategoryRepository; +use crmeb\services\VicWordService; +use Darabonba\GatewaySpi\Models\InterceptorContext\request; +use think\db\BaseQuery; +use think\facade\Db; +use think\model\concern\SoftDelete; + +/** + * TODO: + */ +class Product extends BaseModel +{ + use SoftDelete; + + + protected $deleteTime = 'is_del'; + protected $defaultSoftDelete = 0; + + + /** + * @Author:Qinii + * @Date: 2020/5/8 + * @return string + */ + public static function tablePk(): string + { + return 'product_id'; + } + + /** + * @Author:Qinii + * @Date: 2020/5/8 + * @return string + */ + public static function tableName(): string + { + return 'store_product'; + } + + /* + * ----------------------------------------------------------------------------------------------------------------- + * 属性 + * ----------------------------------------------------------------------------------------------------------------- + */ + public function getSliderImageAttr($value) + { + return $value ? explode(',',$value) : []; + } + public function getGiveCouponIdsAttr($value) + { + return $value ? explode(',',$value) : []; + } + public function getMaxExtensionAttr($value) + { + if($this->extension_type){ + $org_extension = ($this->attrValue()->order('extension_two DESC')->value('extension_one')); + } else { + $org_extension = bcmul(($this->attrValue()->order('price DESC')->value('price')) , systemConfig('extension_one_rate'),2); + } + $spreadUser = (request()->isLogin() && request()->userType() == 1 ) ? request()->userInfo() : null; + if ($spreadUser && $spreadUser->brokerage_level > 0 && $spreadUser->brokerage && $spreadUser->brokerage->extension_one_rate > 0) { + $org_extension = bcmul($org_extension, 1 + $spreadUser->brokerage->extension_one_rate, 2); + } + return $org_extension; + } + public function getMinExtensionAttr($value) + { + if($this->extension_type){ + $org_extension = ($this->attrValue()->order('extension_two ASC')->value('extension_two')); + } else { + $org_extension = bcmul(($this->attrValue()->order('price ASC')->value('price')) , systemConfig('extension_one_rate'),2); + } + $spreadUser = (request()->isLogin() && request()->userType() == 1 ) ? request()->userInfo() : null; + if ($spreadUser && $spreadUser->brokerage_level > 0 && $spreadUser->brokerage && $spreadUser->brokerage->extension_one_rate > 0) { + $org_extension = bcmul($org_extension, 1 + $spreadUser->brokerage->extension_one_rate, 2); + } + return $org_extension; + } + + public function check() + { + if(!$this || !$this->is_show || !$this->is_used || !$this->status || $this->is_del || !$this->mer_status) return false; + return true; + } + + /** + * TODO 秒杀商品结束时间 + * @return false|int + * @author Qinii + * @day 2020-08-15 + */ + public function getEndTimeAttr() + { + if($this->product_type !== 1) return true; + $day = date('Y-m-d',time()); + $_day = strtotime($day); + $end_day = strtotime($this->seckillActive['end_day']); + if($end_day >= $_day) + return strtotime($day.$this->seckillActive['end_time'].':00:00'); + if($end_day < strtotime($day)) + return strtotime(date('Y-m-d',$end_day).$this->seckillActive['end_time'].':00:00'); + } + + /** + * TODO 秒杀商品状态 + * @return array|int + * @author Qinii + * @day 2020-08-19 + */ + public function getSeckillStatusAttr() + { + if($this->product_type !== 1) return true; + $day = strtotime(date('Y-m-d',time())); + $_h = date('H',time()); + $start_day = strtotime($this->seckillActive['start_day']); + $end_day = strtotime($this->seckillActive['end_day']); + if(!$this->seckillActive) return ''; + if($this->seckillActive['status'] !== -1){ + //还未开始 + if($start_day > time() || $this->is_show !== 1)return 0; + //已结束 + if($end_day < $day) return -1; + //开始 - 结束 + if($start_day <= $day && $day <= $end_day){ + //未开始 + if($this->seckillActive['start_time'] > $_h) return 0; + //已结束 + if($this->seckillActive['end_time'] <= $_h) return -1; + //进行中 + if($this->seckillActive['start_time'] <= $_h && $this->seckillActive['end_time'] > $_h) return 1; + } + } + //已结束 + return -1; + + } + + public function getImageAttr($value) + { + if (is_int(strpos($value, 'http'))){ + return $value; + }else{ + return rtrim(systemConfig('site_url'),'/') .$value; + } + } + + public function getTopReplyAttr() + { + $res = ProductReply::where('product_id',$this->product_id)->where('is_del',0)->with(['orderProduct'])->field('reply_id,uid,nickname,merchant_reply_content,avatar,order_product_id,product_id,product_score,service_score,postage_score,comment,pics,rate,create_time') + ->order('sort DESC,create_time DESC')->limit(1)->find(); + if(!$res) return null; + if ($res['orderProduct']) + $res['sku'] = $res['orderProduct']['cart_info']['productAttr']['sku']; + unset($res['orderProduct']); + if (strlen($res['nickname']) > 1) { + $str = mb_substr($res['nickname'],0,1) . '*'; + if (strlen($res['nickname']) > 2) { + $str .= mb_substr($res['nickname'], -1,1); + } + $res['nickname'] = $str; + } + + return $res; + } + + public function getUsStatusAttr() + { + return ($this->status == 1) ? ($this->is_used == 1 ? ( $this->is_show ? 1 : 0 ) : -1) : -1; + } + + public function getGuaranteeTemplateAttr() + { + $gua = GuaranteeTemplate::where('guarantee_template_id',$this->guarantee_template_id)->where('status',1)->where('is_del',0)->find(); + if(!$gua) return []; + $guarantee_id = GuaranteeValue::where('guarantee_template_id',$this->guarantee_template_id)->column('guarantee_id'); + return Guarantee::where('guarantee_id','in',$guarantee_id)->where('status',1)->where('is_del',0)->select(); + } + + public function getMaxIntegralAttr() + { + if(systemConfig('integral_status') && merchantConfig($this->mer_id,'mer_integral_status')){ + $price = ($this->attrValue()->order('price DESC')->value('price')); + $rate = ($this->integral_rate < 0) ? merchantConfig($this->mer_id,'mer_integral_rate') : $this->integral_rate; + $rate = $rate < 0 ? $rate / 100 : 0; + return bcmul($price ,$rate,2); + } + return '0'; + } + + public function getHotRankingAttr() + { + if ($this->product_type == 0) { + $where = [ + 'is_show' => 1, + 'status' => 1, + 'is_used' => 1, + 'product_type' => 0, + 'mer_status' => 1, + 'is_gift_bag' => 0, + 'cate_id' => $this->cate_id + ]; + self::where($where)->order('sales DESC'); + } + } + + /** + * TODO 商品参数 + * @author Qinii + * @day 2022/11/24 + */ + public function getParamsAttr() + { + if(in_array($this->product_type,[0,2])) { + $product_id = $this->product_id; + } else { + $product_id = $this->old_product_id; + } + return ParameterValue::where('product_id',$product_id)->order('parameter_value_id ASC')->select(); + } + + public function getParamTempIdAttr($value) + { + return $value ? explode(',',$value) : $value; + } + + /* + * ----------------------------------------------------------------------------------------------------------------- + * 关联模型 + * ----------------------------------------------------------------------------------------------------------------- + */ + public function merCateId() + { + return $this->hasMany(ProductCate::class,'product_id','product_id')->field('product_id,mer_cate_id'); + } + public function attr() + { + return $this->hasMany(ProductAttr::class,'product_id','product_id'); + } + public function attrValue() + { + return $this->hasMany(ProductAttrValue::class,'product_id','product_id'); + } + public function oldAttrValue() + { + return $this->hasMany(ProductAttrValue::class,'product_id','old_product_id'); + } + public function content() + { + return $this->hasOne(ProductContent::class,'product_id','product_id'); + } + protected function temp() + { + return $this->hasOne(ShippingTemplate::class,'shipping_template_id','temp_id'); + } + public function storeCategory() + { + return $this->hasOne(StoreCategory::class,'store_category_id','cate_id')->field('store_category_id,cate_name'); + } + public function merchant() + { + return $this->hasOne(Merchant::class,'mer_id','mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count'); + } + public function reply() + { + return $this->hasMany(ProductReply::class,'product_id','product_id')->order('create_time DESC'); + } + public function brand() + { + return $this->hasOne(StoreBrand::class,'brand_id','brand_id')->field('brand_id,brand_name'); + } + public function seckillActive() + { + return $this->hasOne(StoreSeckillActive::class,'product_id','product_id'); + } + public function issetCoupon() + { + return $this->hasOne(StoreCouponProduct::class, 'product_id', 'product_id')->alias('A') + ->rightJoin('StoreCoupon B', 'A.coupon_id = B.coupon_id')->where(function (BaseQuery $query) { + $query->where('B.is_limited', 0)->whereOr(function (BaseQuery $query) { + $query->where('B.is_limited', 1)->where('B.remain_count', '>', 0); + }); + })->where(function (BaseQuery $query) { + $query->where('B.is_timeout', 0)->whereOr(function (BaseQuery $query) { + $time = date('Y-m-d H:i:s'); + $query->where('B.is_timeout', 1)->where('B.start_time', '<', $time)->where('B.end_time', '>', $time); + }); + })->field('A.product_id,B.*')->where('status', 1)->where('type', 1)->where('send_type', 0)->where('is_del', 0) + ->order('sort DESC,coupon_id DESC')->hidden(['is_del', 'status']); + } + public function assist() + { + return $this->hasOne(ProductAssist::class,'product_id','product_id'); + } + public function productGroup() + { + return $this->hasOne(ProductGroup::class,'product_id','product_id'); + } + public function guarantee() + { + return $this->hasOne(GuaranteeTemplate::class,'guarantee_template_id','guarantee_template_id')->where('status',1)->where('is_del',0); + } + + + /** + * TODO 是否是会员 + * @return bool + * @author Qinii + * @day 2023/1/4 + */ + public function getIsVipAttr() + { + if (request()->isLogin()) { + if (request()->userType() == 1) { + $userInfo = request()->userInfo(); + return $userInfo->is_svip ? true : false; + } else { + return true; + } + } + return false; + } + /** + * TODO 是否展示会员价 + * @return bool + * @author Qinii + * @day 2023/1/4 + */ + public function getShowSvipPriceAttr() + { + if ($this->mer_svip_status != 0 && (systemConfig('svip_show_price') != 1 || $this->is_vip) && $this->svip_price_type > 0 ) { + return true; + } + return false; + } + + + /** + * TODO 是否显示会员价等信息 + * @return array + * @author Qinii + * @day 2022/11/24 + */ + public function getShowSvipInfoAttr() + { + $res = [ + 'show_svip' => true, //是否展示会员入口 + 'is_svip' => false, //当前用户是否是会员 + 'show_svip_price' => false, //是否展示会员价 + 'save_money' => 0, //当前商品会员优化多少钱 + ]; + if ($this->product_type == 0) { + if (!systemConfig('svip_switch_status')) { + $res['show_svip'] = false; + } else { + $res['is_svip'] = $this->is_vip; + if ($this->show_svip_price) { + $res['show_svip_price'] = true; + $res['save_money'] = bcsub($this->price, $this->svip_price, 2); + } + } + } + return $res; + } + + /** + * TODO 获取会员价 + * @return int|string + * @author Qinii + * @day 2023/1/4 + */ + public function getSvipPriceAttr() + { + if ($this->product_type == 0 && $this->mer_svip_status != 0 && $this->show_svip_price) { + //默认比例 + if ($this->svip_price_type == 1) { + $rate = merchantConfig($this->mer_id,'svip_store_rate'); + $svip_store_rate = $rate > 0 ? bcdiv($rate,100,2) : 0; + $price = $this->attrValue()->order('price ASC')->value('price'); + return bcmul($price,$svip_store_rate,2); + } + //自定义 + if ($this->svip_price_type == 2) { + return $this->getData('svip_price'); + } + } + return 0; + } + + + /* + * ----------------------------------------------------------------------------------------------------------------- + * 搜索器 + * ----------------------------------------------------------------------------------------------------------------- + */ + public function searchMerCateIdAttr($query, $value) + { + $cate_ids = (StoreCategory::where('path','like','%/'.$value.'/%'))->column('store_category_id'); + $cate_ids[] = intval($value); + $product_id = ProductCate::whereIn('mer_cate_id',$cate_ids)->column('product_id'); + $query->whereIn('Product.product_id',$product_id); + } + public function searchKeywordAttr($query, $value) + { + if (!$value) return; + if (is_numeric($value)) { + $query->whereLike("Product.store_name|Product.keyword|bar_code|Product.product_id", "%{$value}%"); + } else { + $word = app()->make(VicWordService::class)->getWord($value); + $query->where(function ($query) use ($word, $value) { + foreach ($word as $item) { + $query->whereOr('Product.store_name|Product.keyword', 'LIKE', "%$item%"); + } + $query->order(Db::raw('REPLACE(Product.store_name,\'' . $value . '\',\'\')')); + }); + } + } + public function searchStatusAttr($query, $value) + { + if($value === -1){ + $query->where('Product.status', 'in',[-1,-2]); + }else { + $query->where('Product.status',$value); + } + } + public function searchCateIdAttr($query, $value) + { + $query->where('cate_id',$value); + } + public function searchCateIdsAttr($query, $value) + { + $query->whereIn('cate_id',$value); + } + public function searchIsShowAttr($query, $value) + { + $query->where('is_show',$value); + } + public function searchPidAttr($query, $value) + { + $cateId = app()->make(StoreCategoryRepository::class)->allChildren(intval($value)); + $query->whereIn('cate_id', $cateId); + } + public function searchStockAttr($query, $value) + { + $value ? $query->where('stock','<=', $value) : $query->where('stock', $value); + } + public function searchIsNewAttr($query, $value) + { + $query->where('is_new',$value); + } + public function searchPriceAttr($query, $value) + { + if(empty($value[0]) && !empty($value[1])) + $query->where('price','<',$value[1]); + if(!empty($value[0]) && empty($value[1])) + $query->where('price','>',$value[0]); + if(!empty($value[0]) && !empty($value[1])) + $query->whereBetween('price',[$value[0],$value[1]]); + } + public function searchBrandIdAttr($query, $value) + { + $query->whereIn('brand_id',$value); + } + public function searchIsGiftBagAttr($query, $value) + { + $query->where('is_gift_bag',$value); + } + public function searchIsGoodAttr($query, $value) + { + $query->where('is_good',$value); + } + public function searchIsUsedAttr($query, $value) + { + $query->where('is_used',$value); + } + public function searchProductTypeAttr($query, $value) + { + $query->where('Product.product_type',$value); + } + public function searchSeckillStatusAttr($query, $value) + { + $product_id = (new StoreSeckillActiveDao())->getStatus($value)->column('product_id'); + $query->whereIn('Product.product_id',$product_id); + } + public function searchStoreNameAttr($query, $value) + { + $query->where('Product.store_name','like','%'.$value.'%'); + } + public function searchMerStatusAttr($query, $value) + { + $query->where('mer_status',$value); + } + public function searchProductIdAttr($query, $value) + { + $query->where('Product.product_id',$value); + } + public function searchPriceOnAttr($query, $value) + { + $query->where('price','>=',$value); + } + public function searchPriceOffAttr($query, $value) + { + $query->where('price','<=',$value); + } + public function searchisFictiAttr($query, $value) + { + $query->where('type',$value); + } + public function searchGuaranteeTemplateIdAttr($query, $value) + { + $query->whereIn('guarantee_template_id',$value); + } + public function searchTempIdAttr($query, $value) + { + $query->whereIn('Product.temp_id',$value); + } +} diff --git a/app/admin/model/store/ProductCate.php b/app/admin/model/store/ProductCate.php new file mode 100644 index 0000000..bd5cbc6 --- /dev/null +++ b/app/admin/model/store/ProductCate.php @@ -0,0 +1,32 @@ + +// +---------------------------------------------------------------------- + +namespace app\admin\model\store; + +use think\Model; +use app\admin\model\StoreCategory; + +class ProductCate extends Model +{ + protected $connection = 'shop'; + protected $table = 'eb_store_product_cate'; + + public function category() + { + return $this->hasOne(StoreCategory::class,'store_category_id','mer_cate_id')->field('store_category_id, cate_name'); + } + + public function searchProductIdAttr($query, $value) + { + $query->where('product_id',$value); + } +} diff --git a/app/admin/model/store/paramter/Parameter.php b/app/admin/model/store/paramter/Parameter.php new file mode 100644 index 0000000..c290a29 --- /dev/null +++ b/app/admin/model/store/paramter/Parameter.php @@ -0,0 +1,59 @@ + +// +---------------------------------------------------------------------- + +namespace app\admin\model\store\paramter; + +use think\Model; + +class Parameter extends Model +{ + protected $connection = 'shop'; + protected $pk = 'parameter_id'; + + + // public static function tablePk(): string + // { + // return 'parameter_id'; + // } + + // public static function tableName(): string + // { + // return 'parameter'; + // } + + public function searchTemplateIdAttr($query, $value) + { + $query->where('template_id',$value); + } + + /** + * TODO 搜索 + * @param $where + */ + public function getSearch(array $where) + { + foreach ($where as $key => $item) { + if ($item !== '') { + $keyArray[] = $key; + $whereArr[$key] = $item; + } + } + // var_dump($where); + $class = get_called_class(); + if(empty($keyArray)){ + return $class::self(); + }else{ + return $class::withSearch($keyArray, $whereArr); + } + } + +} diff --git a/app/admin/model/store/paramter/ParameterTemplate.php b/app/admin/model/store/paramter/ParameterTemplate.php new file mode 100644 index 0000000..0d16e07 --- /dev/null +++ b/app/admin/model/store/paramter/ParameterTemplate.php @@ -0,0 +1,129 @@ +hasOne(Merchant::class,'mer_id','mer_id'); + } + + public function parameter() + { + return $this->hasMany(Parameter::class,'template_id','template_id'); + } + + public function cateId() + { + return $this->hasMany(Relevance::class,'left_id','template_id')->where('type', 'product_params_cate'); + } + + public function searchCateIdAttr($query, $value) + { + $id = Relevance::where('right_id',$value)->where('type', 'product_params_cate')->column('left_id'); + $query->where('template_id','in',$id); + } + + public function searchTemplateNameAttr($query, $value) + { + $query->whereLike('template_name',"%{$value}%"); + } + + public function searchTemplateIdsAttr($query, $value) + { + $query->whereIn('template_id',$value); + } + + public function searchMerIdAttr($query, $value) + { + $query->where('mer_id',$value); + } + + public function searchMerNameAttr($query, $value) + { + $value = Merchant::whereLike('mer_name',"%{$value}%")->coupon('mer_id'); + $query->whereIn('mer_id',$value); + } + + public function searchIsMerAttr($query, $value) + { + if ($value == 1) { + $query->where('mer_id','>',0); + } else { + $query->where('mer_id',0); + } + } + + + public function getList($where, $page, $limit) + { + $paramterModel = new Parameter(); + $query = self::getSearch($where)->field('template_id,mer_id,template_name,sort,create_time') + ->with([ + 'cateId' => function($query){ + $query->with(['category' =>function($query) { + $query->field('store_category_id,cate_name'); + }]); + }, + 'merchant' => function($query) { + $query->field('mer_id,mer_name'); + } +// 'parameter' =>function($query){ +// $query->field('parameter_id,template_id,name,value,sort')->order('sort DESC'); +// } + ]) + ->order('sort DESC,create_time DESC'); + $count = $query->count(); + $list = $query->page($page, $limit)->select(); + + return compact('count', 'list'); + } + + +/** + * TODO 搜索 + * @param $where + */ + public static function getSearch(array $where) + { + foreach ($where as $key => $item) { + if ($item !== '') { + $keyArray[] = $key; + $whereArr[$key] = $item; + } + } + + if(empty($keyArray)){ + return new self; + }else{ + return self::withSearch($keyArray, $whereArr); + } + } + +} \ No newline at end of file diff --git a/app/admin/model/store/paramter/ParameterValue.php b/app/admin/model/store/paramter/ParameterValue.php new file mode 100644 index 0000000..7ee9033 --- /dev/null +++ b/app/admin/model/store/paramter/ParameterValue.php @@ -0,0 +1,35 @@ + +// +---------------------------------------------------------------------- + +namespace app\common\model\store\parameter; + +use app\common\model\BaseModel; + +class ParameterValue extends BaseModel +{ + + + public static function tablePk(): string + { + return 'parameter_attr_id'; + } + + public static function tableName(): string + { + return 'parameter_value'; + } + + public function parameter() + { + return $this->hasOne(Parameter::class,'parameter_id','parameter_id'); + } +} diff --git a/app/admin/model/user/UserMerchant.php b/app/admin/model/user/UserMerchant.php new file mode 100644 index 0000000..7f88115 --- /dev/null +++ b/app/admin/model/user/UserMerchant.php @@ -0,0 +1,157 @@ +hasOne(User::class, 'uid', 'uid'); + } + + /** + * @param $value + * @return array + * @author xaboy + * @day 2020-05-09 + */ + public function getLabelIdAttr($value) + { + return $value ? explode(',', $value) : []; + } + + /** + * @param $value + * @return string + * @author xaboy + * @day 2020-05-09 + */ + public function setLabelIdAttr($value) + { + return implode(',', $value); + } + + public function getAuthLabelAttr() + { + return app()->make(UserLabel::class)->whereIn('label_id', $this->label_id)->where('mer_id', $this->mer_id)->where('type', 1)->column('label_id'); + } + + + + /** + * @return string + * @author xaboy + * @day 2020/10/20 + */ + protected function getModel(): string + { + return UserMerchant::class; + } + + /** + * @param $uid + * @param $mer_id + * @return bool + * @author xaboy + * @day 2020/10/20 + */ + public function isMerUser($uid, $mer_id) + { + return $this->existsWhere(compact('uid', 'mer_id')); + } + + /** + * @param $uid + * @param $mer_id + * @return int + * @throws \think\db\exception\DbException + * @author xaboy + * @day 2020/10/20 + */ + public function updateLastTime($uid, $mer_id) + { + return UserMerchant::getDB()->where(compact('uid', 'mer_id'))->update([ + 'last_time' => date('Y-m-d H:i:s') + ]); + } + + /** + * @param array $where + * @return mixed + * @author xaboy + * @day 2020/10/20 + */ + public function search(array $where) + { + return UserMerchant::getDB()->alias('A')->leftJoin('User B', 'A.uid = B.uid') + ->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) { + $query->where('A.mer_id', $where['mer_id']); + })->when(isset($where['nickname']) && $where['nickname'], function (BaseQuery $query) use ($where) { + return $query->where('B.nickname', 'like', '%' . $where['nickname'] . '%'); + })->when(isset($where['sex']) && $where['sex'] !== '', function (BaseQuery $query) use ($where) { + return $query->where('B.sex', intval($where['sex'])); + })->when(isset($where['is_promoter']) && $where['is_promoter'] !== '', function (BaseQuery $query) use ($where) { + return $query->where('B.is_promoter', $where['is_promoter']); + })->when(isset($where['uids']), function (BaseQuery $query) use ($where) { + return $query->whereIn('A.uid', $where['uids']); + })->when(isset($where['user_time_type']) && $where['user_time_type'] !== '' && $where['user_time'] != '', function ($query) use ($where) { + if ($where['user_time_type'] == 'visit') { + getModelTime($query, $where['user_time'], 'A.last_time'); + } + if ($where['user_time_type'] == 'add_time') { + getModelTime($query, $where['user_time'], 'A.create_time'); + } + })->when(isset($where['pay_count']) && $where['pay_count'] !== '', function ($query) use ($where) { + if ($where['pay_count'] == -1) { + $query->where('A.pay_num', 0); + } else { + $query->where('A.pay_num', '>', $where['pay_count']); + } + })->when(isset($where['label_id']) && $where['label_id'] !== '', function (BaseQuery $query) use ($where) { + return $query->whereRaw('CONCAT(\',\',A.label_id,\',\') LIKE \'%,' . $where['label_id'] . ',%\''); + })->when(isset($where['user_type']) && $where['user_type'] !== '', function (BaseQuery $query) use ($where) { + return $query->where('B.user_type', $where['user_type']); + })->where('A.status', 1); + } + + public function numUserIds($mer_id, $min, $max = null) + { + return UserMerchant::getDB()->where('mer_id', $mer_id)->where('pay_num', '>=', $min)->when(!is_null($max), function ($query) use ($max) { + $query->where('pay_num', '<=', $max); + })->group('uid')->column('uid'); + } + + public function priceUserIds($mer_id, $min, $max = null) + { + return UserMerchant::getDB()->where('mer_id', $mer_id)->where('pay_price', '>=', $min)->when(!is_null($max), function ($query) use ($max, $min) { + $query->where('pay_price', $min == $max ? '<=' : '<', $max); + })->group('uid')->column('uid'); + } +} diff --git a/app/admin/route/app.php b/app/admin/route/app.php new file mode 100644 index 0000000..adb04fc --- /dev/null +++ b/app/admin/route/app.php @@ -0,0 +1,16 @@ + +// +---------------------------------------------------------------------- +use think\facade\Route; + +Route::get('home', function () { + return 'hello,ThinkPHP6!'; +}); + diff --git a/app/admin/route/menu.php b/app/admin/route/menu.php new file mode 100644 index 0000000..1c8cba7 --- /dev/null +++ b/app/admin/route/menu.php @@ -0,0 +1,56 @@ +name('systemMerchantMenuIndex')->option([ + '_alias' => '商户菜单/权限表单', + '_auth' => false, + '_form' => 'systemMerchantMenuIndex', + ]); + Route::get('lst', '/lst')->name('systemMerchantMenuGetLst')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限列表', + ]); + + Route::post('add', '/add')->name('systemMerchantMenuCreate')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限添加', + ]); + Route::post('edit/:id', '/edit')->name('systemMerchantMenuUpdate')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限编辑', + ]); + Route::get('addform', '/AddForm')->name('systemMerchantMenuCreateForm')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限添加表单', + '_auth' => false, + '_form' => 'systemMerchantMenuCreate', + ]); + Route::get('editform', '/editform')->name('systemMerchantMenuUpdateForm')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限编辑表单', + '_auth' => false, + '_form' => 'systemMerchantMenuUpdate', + ]); + Route::delete('del/:id', '/del')->name('systemMerchantMenuDelete')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限删除', + ]); + })->prefix('merchant.system.auth.Menu')->option([ + '_path' => '/merchant/menu', + '_auth' => true, + ]); + +}); +// ->middleware(AllowOriginMiddleware::class) +// ->middleware(AdminTokenMiddleware::class, true) +// ->middleware(AdminAuthMiddleware::class) +// ->middleware(LogMiddleware::class); diff --git a/app/admin/route/merchant.php b/app/admin/route/merchant.php new file mode 100644 index 0000000..9a13da9 --- /dev/null +++ b/app/admin/route/merchant.php @@ -0,0 +1,194 @@ +name('systemMerchantCategoryLst')->option([ + '_alias' => '商户分类列表', + ]); + // Route::get('category_lst', '/lst')->option([ + // '_alias' => '商户分类列表', + // '_auth' => false, + // ]); + Route::post('add', '/create')->name('systemMerchantCategoryCreate')->option([ + '_alias' => '商户分类添加', + ]); + Route::get('form', '/createForm')->name('systemMerchantCategoryCreateForm')->option([ + '_alias' => '商户分类添加表单', + '_auth' => false, + '_form' => 'systemMerchantCategoryCreate', + ]); + Route::delete('del/:id', '/delete')->name('systemMerchantCategoryDelete')->option([ + '_alias' => '商户分类删除', + ]); + Route::post('edit/:id', '/update')->name('systemMerchantCategoryUpdate')->option([ + '_alias' => '商户分类编辑', + ]); + Route::get('edit/form/:id', '/updateForm')->name('systemMerchantCategoryUpdateForm')->option([ + '_alias' => '商户分类编辑表单', + '_auth' => false, + '_form' => 'systemMerchantCategoryUpdate', + ]); + Route::get('options', '/getOptions')->option([ + '_alias' => '商户分类筛选', + '_auth' => false, + ]); + })->prefix('merchant.system.merchant.MerchantCategory')->option([ + '_path' => '/merchant/classify', + '_auth' => true, + ]); + + //入驻申请列表 + Route::group('merchant/intention', function () { + Route::get('index', '/index')->name('systemMerchantIntentionLst')->option([ + '_alias' => '列表', + ]); + + Route::get('lst', '/lst')->name('systemMerchantIntentionLst')->option([ + '_alias' => '列表', + ]); + Route::post('status', '/switchStatus')->name('systemMerchantIntentionStatus')->option([ + '_alias' => '审核', + ]); + Route::delete('delete', '/delete')->name('systemMerchantIntentionDelete')->option([ + '_alias' => '删除', + ]); + Route::get('markform', '/markform')->name('systemMerchantIntentionMarkForm')->option([ + '_alias' => '备注', + '_auth' => false, + '_form' => 'systemMerchantIntentionMark', + ]); + Route::get('statusform', '/statusForm')->name('systemMerchantIntentionStatusForm')->option([ + '_alias' => '申请商户', + '_auth' => false, + '_form' => 'systemMerchantIntentionStatus', + ]); + + Route::post('mark', '/setmark')->name('systemMerchantIntentionMark')->option([ + '_alias' => '备注', + ]); + Route::get('excel', '/excel'); + })->prefix('merchant.system.merchant.MerchantIntention')->option([ + '_path' => '/merchant/application', + '_auth' => true, + ]); + + // 店铺类型 + Route::group('/merchant/type',function(){ + Route::get('index', '/index')->name('systemMerchantTypeLst')->option([ + '_alias' => '列表', + ]); + Route::get('lst', '/lst')->name('systemMerchantTypeLst')->option([ + '_alias' => '列表', + ]); + Route::get('read', '/read')->name('systemMerchantTypeDetail')->option([ + '_alias' => '详情', + ]); + Route::get('form', '/form')->name('systemMerchantTypeAdd')->option([ + '_alias' => '添加/编辑页', + ]); + Route::post('add', '/add')->name('systemMerchantTypeAdd')->option([ + '_alias' => '添加', + ]); + Route::put('edit', '/edit')->name('systemMerchantTypeUpdate')->option([ + '_alias' => '编辑', + ]); + Route::delete('del', '/del')->name('systemMerchantTypeDelete')->option([ + '_alias' => '删除', + ]); + Route::get('mark/:id', '/markForm')->name('systemMerchantTypeMarkForm')->option([ + '_alias' => '备注', + '_auth' => false, + '_form' => 'systemMerchantTypeMark', + ]); + Route::post('mark', '/mark')->name('systemMerchantTypeMark')->option([ + '_alias' => '备注', + ]); + + Route::get('descr', '/description')->name('systemMerchantTypeDescrForm')->option([ + '_alias' => '店铺类型说明', + ]); + Route::post('description', '/description')->name('systemMerchantTypeDescr')->option([ + '_alias' => '店铺类型说明', + ]); + + })->prefix('merchant.system.merchant.MerchantType')->option([ + '_path' => '/merchant/type', + '_auth' => true, + ]); + + + //店铺保证金 + Route::group('/margin', function(){ + + // 主页 + Route::get('index', '/index')->name('systemMerchantMarginIndex' + )->option([ + '_alias'=>'主页列表 ', + ]); + + //缴纳记录 + Route::get('lst', '/lst')->name('systemMerchantMarginLst')->option([ + '_alias' => '缴纳记录', + ]); + //扣费记录页 + Route::get('read', '/GetMarginLstForm')->name('systemMarginList')->option([ + '_alias' => '扣费记录页', + ]); + //扣费记录帐单接口 + Route::get('reductlst', '/GetMarginLst')->name('systemMarginList')->option([ + '_alias' => '扣费记录', + ]); + + //扣除保证金 + Route::get('form', '/setMarginForm')->name('systemMarginSetForm')->option([ + '_alias' => '扣除保证金表单', + '_auth' => false, + '_form' => 'systemMarginSet', + ]); + Route::post('reduct', '/setMargin')->name('systemMarginSet')->option([ + '_alias' => '扣除保证金', + ]); + })->prefix('merchant.system.merchant.MerchantMargin')->option([ + '_path' => '/margin', + '_auth' => true, + ]); + + + // 保证金退还 + Route::group('margin/refund', function(){ + //退款申请 + Route::get('refund/lst', 'financial.Financial/getMarginLst')->name('systemMarginRefundList')->option([ + '_alias' => '退款申请列表', + ]); + Route::get('refund/show/:id', 'financial.Financial/refundShow')->name('systemMarginRefundShow')->option([ + '_alias' => '退款申请详情', + ]); + + // //审核 + Route::get('refund/status/:id/form', 'financial.Financial/statusForm')->name('systemMarginRefundSwitchStatusForm')->option([ + '_alias' => '审核表单', + '_auth' => false, + '_form' => 'systemMarginRefundSwitchStatus', + ]); + Route::post('refund/status/:id', 'financial.Financial/switchStatus')->name('systemMarginRefundSwitchStatus')->append(['type' => 1])->option([ + '_alias' => '审核', + ]); + + // //备注 + Route::get('refund/mark/:id/form', 'financial.Financial/markMarginForm')->name('systemMarginRefundMarkForm')->option([ + '_alias' => '备注表单', + '_auth' => false, + '_form' => 'systemMarginRefundMark', + ]); + Route::post('refund/mark/:id', 'financial.Financial/mark')->name('systemMarginRefundMark')->option([ + '_alias' => '备注', + ]); + }); +}); diff --git a/app/admin/route/merchant/menu.php b/app/admin/route/merchant/menu.php new file mode 100644 index 0000000..c1ef28e --- /dev/null +++ b/app/admin/route/merchant/menu.php @@ -0,0 +1,82 @@ + +// +---------------------------------------------------------------------- + +use think\facade\Route; +use app\common\middleware\AdminAuthMiddleware; +use app\common\middleware\AdminTokenMiddleware; +use app\common\middleware\AllowOriginMiddleware; +use app\common\middleware\LogMiddleware; + +Route::group(function () { + + //权限管理 + // Route::group('system/menu', function () { + // Route::get('lst', '/getList')->name('systemMenuGetLst')->option([ + // '_alias' => '平台菜单/权限列表', + // ]); + // Route::get('create/form', '/createForm')->name('systemMenuCreateForm')->option([ + // '_alias' => '平台菜单/权限添加表单', + // '_auth' => false, + // '_form' => 'systemMenuCreate', + // ]); + // Route::get('update/form/:id', '/updateForm')->name('systemMenuUpdateForm')->option([ + // '_alias' => '平台菜单/权限编辑表单', + // '_auth' => false, + // '_form' => 'systemMenuUpdate', + // ]); + // Route::post('create', '/create')->name('systemMenuCreate')->option([ + // '_alias' => '平台菜单/权限添加', + // ]); + // Route::post('update/:id', '/update')->name('systemMenuUpdate')->option([ + // '_alias' => '平台菜单/权限编辑', + // ]); + // Route::delete('delete/:id', '/delete')->name('systemMenuDelete')->option([ + // '_alias' => '平台菜单/权限删除', + // ]); + // })->prefix('admin.system.auth.Menu')->option([ + // '_path' => '/setting/menu', + // '_auth' => true, + // ]); + + //商户权限管理 + Route::group('merchant/menu', function () { + Route::get('lst', '/getList')->name('systemMerchantMenuGetLst')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限列表', + ]); + Route::get('create/form', '/createForm')->name('systemMerchantMenuCreateForm')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限添加表单', + '_auth' => false, + '_form' => 'systemMerchantMenuCreate', + ]); + Route::get('update/form/:id', '/updateForm')->name('systemMerchantMenuUpdateForm')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限编辑表单', + '_auth' => false, + '_form' => 'systemMerchantMenuUpdate', + ]); + Route::post('create', '/create')->name('systemMerchantMenuCreate')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限添加', + ]); + Route::post('update/:id', '/update')->name('systemMerchantMenuUpdate')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限编辑', + ]); + Route::delete('delete/:id', '/delete')->name('systemMerchantMenuDelete')->append(['merchant' => 1])->option([ + '_alias' => '商户菜单/权限删除', + ]); + })->prefix('admin.system.auth.Menu')->option([ + '_path' => '/merchant/system', + '_auth' => true, + ]); + +}); +// ->middleware(AllowOriginMiddleware::class) +// ->middleware(AdminTokenMiddleware::class, true) +// ->middleware(AdminAuthMiddleware::class) +// ->middleware(LogMiddleware::class); diff --git a/app/admin/route/merchant/merchant.php b/app/admin/route/merchant/merchant.php new file mode 100644 index 0000000..72a9505 --- /dev/null +++ b/app/admin/route/merchant/merchant.php @@ -0,0 +1,246 @@ + +// +---------------------------------------------------------------------- + +use think\facade\Route; + +Route::group(function () { + + //商户分类 + Route::group('system/merchant', function () { + Route::get('category/lst', '/lst')->name('systemMerchantCategoryLst')->option([ + '_alias' => '商户分类列表', + ]); + Route::get('category_lst', '/lst')->option([ + '_alias' => '商户分类列表', + '_auth' => false, + ]); + Route::post('category', '/create')->name('systemMerchantCategoryCreate')->option([ + '_alias' => '商户分类添加', + ]); + Route::get('category/form', '/createForm')->name('systemMerchantCategoryCreateForm')->option([ + '_alias' => '商户分类添加表单', + '_auth' => false, + '_form' => 'systemMerchantCategoryCreate', + ]); + Route::delete('category/:id', '/delete')->name('systemMerchantCategoryDelete')->option([ + '_alias' => '商户分类删除', + ]); + Route::post('category/:id', '/update')->name('systemMerchantCategoryUpdate')->option([ + '_alias' => '商户分类编辑', + ]); + Route::get('category/form/:id', '/updateForm')->name('systemMerchantCategoryUpdateForm')->option([ + '_alias' => '商户分类编辑表单', + '_auth' => false, + '_form' => 'systemMerchantCategoryUpdate', + ]); + Route::get('category/options', '/getOptions')->option([ + '_alias' => '商户分类筛选', + '_auth' => false, + ]); + })->prefix('admin.system.merchant.MerchantCategory')->option([ + '_path' => '/merchant/classify', + '_auth' => true, + ]); + + //申请列表 + Route::group('merchant/intention', function () { + Route::get('lst', '/lst')->name('systemMerchantIntentionLst')->option([ + '_alias' => '列表', + ]); + Route::post('status/:id', '/switchStatus')->name('systemMerchantIntentionStatus')->option([ + '_alias' => '审核', + ]); + Route::delete('delete/:id', '/delete')->name('systemMerchantIntentionDelete')->option([ + '_alias' => '删除', + ]); + Route::get('mark/:id/form', '/form')->name('systemMerchantIntentionMarkForm')->option([ + '_alias' => '备注', + '_auth' => false, + '_form' => 'systemMerchantIntentionMark', + ]); + Route::get('status/:id/form', '/statusForm')->name('systemMerchantIntentionStatusForm')->option([ + '_alias' => '申请商户', + '_auth' => false, + '_form' => 'systemMerchantIntentionStatus', + ]); + + Route::post('mark/:id', '/mark')->name('systemMerchantIntentionMark')->option([ + '_alias' => '备注', + ]); + Route::get('excel', '/excel'); + })->prefix('admin.system.merchant.MerchantIntention')->option([ + '_path' => '/merchant/application', + '_auth' => true, + ]); + + //商户管理 + Route::group('system/merchant', function () { + Route::get('create/form', '.Merchant/createForm')->name('systemMerchantCreateForm')->option([ + '_alias' => '商户列表', + ]); + Route::get('count', '.Merchant/count')->name('systemMerchantCount')->option([ + '_alias' => '商户列表统计', + ]); + Route::get('lst', '.Merchant/lst')->name('systemMerchantLst')->option([ + '_alias' => '商户列表', + ]); + Route::post('create', '.Merchant/create')->name('systemMerchantCreate')->option([ + '_alias' => '商户添加', + ]); + Route::get('update/form/:id', '.Merchant/updateForm')->name('systemMerchantUpdateForm')->option([ + '_alias' => '商户编辑表单', + '_auth' => false, + '_form' => 'systemMerchantUpdate', + ]); + Route::post('update/:id', '.Merchant/update')->name('systemMerchantUpdate')->option([ + '_alias' => '商户编辑', + ]); + Route::post('status/:id', '.Merchant/switchStatus')->name('systemMerchantStatus')->option([ + '_alias' => '商户修改推荐', + ]); + Route::post('close/:id', '.Merchant/switchClose')->name('systemMerchantClose')->option([ + '_alias' => '商户开启/关闭', + ]); + Route::delete('delete/:id', '.Merchant/delete')->name('systemMerchantDelete')->option([ + '_alias' => '商户删除', + ]); + Route::post('password/:id', '.MerchantAdmin/password')->name('systemMerchantAdminPassword')->option([ + '_alias' => '商户修改密码', + ]); + Route::get('password/form/:id', '.MerchantAdmin/passwordForm')->name('systemMerchantAdminPasswordForm')->option([ + '_alias' => '商户修改密码表单', + '_auth' => false, + '_form' => 'systemMerchantAdminPassword', + ]); + Route::post('login/:id', '.Merchant/login')->name('systemMerchantLogin')->option([ + '_alias' => '商户登录', + ]); + Route::get('changecopy/:id/form', '.Merchant/changeCopyNumForm')->name('systemMerchantChangeCopyForm')->option([ + '_alias' => '修改采集商品次数表单', + '_auth' => false, + '_form' => 'systemMerchantChangeCopy', + ]); + Route::post('changecopy/:id', '.Merchant/changeCopyNum')->name('systemMerchantChangeCopy')->option([ + '_alias' => '修改采集商品次数', + ]); + })->prefix('admin.system.merchant')->option([ + '_path' => '/merchant/list', + '_auth' => true, + '_append'=> [ + [ + '_name' =>'uploadImage', + '_path' =>'/merchant/list', + '_alias' => '上传图片', + '_auth' => true, + ], + [ + '_name' =>'systemAttachmentLst', + '_path' =>'/merchant/list', + '_alias' => '图片列表', + '_auth' => true, + ], + ] + ]); + + // 店铺类型 + Route::group('merchant/type', function () { + Route::get('lst', '/lst')->name('systemMerchantTypeLst')->option([ + '_alias' => '列表', + ]); + Route::post('create', '/create')->name('systemMerchantTypeCreate')->option([ + '_alias' => '添加', + ]); + Route::post('update/:id', '/update')->name('systemMerchantTypeUpdate')->option([ + '_alias' => '编辑', + ]); + Route::delete('delete/:id', '/delete')->name('systemMerchantTypeDelete')->option([ + '_alias' => '删除', + ]); + Route::get('mark/:id', '/markForm')->name('systemMerchantTypeMarkForm')->option([ + '_alias' => '备注', + '_auth' => false, + '_form' => 'systemMerchantTypeMark', + ]); + Route::post('mark/:id', '/mark')->name('systemMerchantTypeMark')->option([ + '_alias' => '备注', + ]); + + Route::get('detail/:id', '/detail')->name('systemMerchantTypeDetail')->option([ + '_alias' => '备注', + ]); + + Route::get('options', '/options')->option([ + '_alias' => '筛选', + '_auth' => false, + ]); + Route::get('mer_auth', '/mer_auth')->option([ + '_alias' => '权限', + '_auth' => false, + ]); + })->prefix('admin.system.merchant.MerchantType')->option([ + '_path' => '/merchant/type', + '_auth' => true, + ]); + + //保证金 + Route::group('margin', function () { + //缴纳记录 + Route::get('lst', 'merchant.MerchantMargin/lst')->name('systemMerchantMarginLst')->option([ + '_alias' => '缴纳记录', + ]); + //扣费记录 + Route::get('list/:id', 'merchant.MerchantMargin/getMarginLst')->name('systemMarginList')->option([ + '_alias' => '扣费记录', + ]); + + //扣除保证金 + Route::get('set/:id/form', 'merchant.MerchantMargin/setMarginForm')->name('systemMarginSetForm')->option([ + '_alias' => '扣除保证金表单', + '_auth' => false, + '_form' => 'systemMarginSet', + ]); + Route::post('set', 'merchant.MerchantMargin/setMargin')->name('systemMarginSet')->option([ + '_alias' => '扣除保证金', + ]); + + //退款申请 + Route::get('refund/lst', 'financial.Financial/getMarginLst')->name('systemMarginRefundList')->option([ + '_alias' => '退款申请列表', + ]); + Route::get('refund/show/:id', 'financial.Financial/refundShow')->name('systemMarginRefundShow')->option([ + '_alias' => '退款申请详情', + ]); + + //审核 + Route::get('refund/status/:id/form', 'financial.Financial/statusForm')->name('systemMarginRefundSwitchStatusForm')->option([ + '_alias' => '审核表单', + '_auth' => false, + '_form' => 'systemMarginRefundSwitchStatus', + ]); + Route::post('refund/status/:id', 'financial.Financial/switchStatus')->name('systemMarginRefundSwitchStatus')->append(['type' => 1])->option([ + '_alias' => '审核', + ]); + + //备注 + Route::get('refund/mark/:id/form', 'financial.Financial/markMarginForm')->name('systemMarginRefundMarkForm')->option([ + '_alias' => '备注表单', + '_auth' => false, + '_form' => 'systemMarginRefundMark', + ]); + Route::post('refund/mark/:id', 'financial.Financial/mark')->name('systemMarginRefundMark')->option([ + '_alias' => '备注', + ]); + })->prefix('admin.system.')->option([ + '_path' => '/merchant/deposit_list', + '_auth' => true, + ]); + +}); diff --git a/app/admin/route/product.php b/app/admin/route/product.php new file mode 100644 index 0000000..c138d1f --- /dev/null +++ b/app/admin/route/product.php @@ -0,0 +1,304 @@ +name('merchantStoreParameterTemplateLst')->option([ + '_alias' => '列表', + ]); + Route::get('detail/:id', '/detail')->name('merchantStoreParameterTemplateDetail')->option([ + '_alias' => '详情', + ]); + Route::delete('delete/:id', '/delete')->name('merchantStoreParameterTemplateDelete')->option([ + '_alias' => '删除', + ]); + Route::get('add', '/add')->name('merchantStoreParameterTemplateCreate')->option([ + '_alias' => '添加', + ]); + Route::post('update/:id', '/update')->name('merchantStoreParameterTemplateUpdate')->option([ + '_alias' => '编辑', + ]); + Route::get('select', '/select')->option([ + '_alias' => '筛选列表', + '_auth' => false, + ]); + // Route::get('temp/show', '/show')->option([ + // '_alias' => '参数', + // '_auth' => false, + // ]); + })->prefix('product.Parameter')->option([ + '_path' => '/product/params', + '_auth' => true, + ]); + + //商品 + Route::group('store/product', function () { + Route::get('config', '/config')->option([ + '_alias' => '配置', + '_auth' => false, + ]); + Route::get('lst_filter', '/getStatusFilter')->name('merchantStoreProductLstFilter')->option([ + '_alias' => '头部统计', + ]); + Route::get('lst', '/lst')->name('merchantStoreProductLst')->option([ + '_alias' => '列表', + ]); + Route::get('list', '/lst')->option([ + '_alias' => '列表', + '_auth' => false, + ]); + Route::post('create', '/create')->name('merchantStoreProductCreate')->option([ + '_alias' => '添加', + ]); + Route::get('detail/:id', '/detail')->name('merchantStoreProductDetail')->option([ + '_alias' => '详情', + ]); + Route::get('temp_key', '/temp_key')->name('merchantStoreProductTempKey')->option([ + '_alias' => '上传视频配置', + ]); + Route::post('update/:id', '/update')->name('merchantStoreProductUpdate')->option([ + '_alias' => '编辑', + ]); + Route::post('free_trial/:id', '/freeTrial')->name('merchantStoreProductFreeTrial')->option([ + '_alias' => '免审编辑', + ]); + Route::delete('delete/:id', '/delete')->name('merchantStoreProductDelete')->option([ + '_alias' => '删除', + ]); + Route::delete('destory/:id', '/destory')->name('merchantStoreProductDestory')->option([ + '_alias' => '加入回收站', + ]); + Route::post('restore/:id', '/restore')->name('merchantStoreProductRestore')->option([ + '_alias' => '恢复', + ]); + Route::post('status/:id', '/switchStatus')->name('merchantStoreProductSwitchStatus')->option([ + '_alias' => '上下架', + ]); + Route::post('batch_status', '/batchShow')->name('merchantStoreProductSwitchBatchStatus')->option([ + '_alias' => '批量上下架', + ]); + Route::post('batch_temp', '/batchTemplate')->name('merchantStoreProductSwitchBatchTemplate')->option([ + '_alias' => '批量设置运费模板', + ]); + Route::post('batch_labels', '/batchLabels')->name('merchantStoreProductSwitchBatchLabels')->option([ + '_alias' => '批量设置标签', + ]); + Route::post('batch_hot', '/batchHot')->name('merchantStoreProductSwitchBatchHot')->option([ + '_alias' => '批量设置推荐', + ]); + Route::post('batch_ext', '/batchExtension')->name('merchantStoreProductSwitchBatchExtension')->option([ + '_alias' => '批量设置推荐', + ]); + Route::post('batch_svip', '/batchSvipType')->name('merchantStoreProductSwitchBatchSvipType')->option([ + '_alias' => '批量设置会员价', + ]); + Route::post('sort/:id', '/updateSort')->name('merchantStoreProductUpdateSort')->option([ + '_alias' => '排序', + ]); + Route::post('preview', '/preview')->name('merchantStoreProductPreview')->option([ + '_alias' => '预览', + ]); + Route::post('labels/:id', '/setLabels')->name('merchantStoreProductLabels')->option([ + '_alias' => '标签', + ]); + Route::get('attr_value/:id', '/getAttrValue')->name('merchantStoreProductAttrValue')->option([ + '_alias' => '获取规格', + ]); + })->prefix('merchant.store.product.Product')->option([ + '_path' => '/product/list', + '_auth' => true, + '_append'=> [ + [ + '_name' =>'merchantUploadImage', + '_path' =>'/product/list', + '_alias' => '上传图片', + '_auth' => true, + ], + [ + '_name' =>'merchantAttachmentLst', + '_path' =>'/product/list', + '_alias' => '图片列表', + '_auth' => true, + ], + + ] + ]); + + + //商品分类 + Route::group('store/category', function () { + Route::get('create/form', '/createForm')->name('merchantStoreCategoryCreateForm')->option([ + '_alias' => '添加表单', + '_auth' => false, + '_form' => 'merchantStoreCategoryCreate', + ]); + Route::get('update/form/:id', '/updateForm')->name('merchantStoreCategoryUpdateForm')->option([ + '_alias' => '编辑表单', + '_auth' => false, + '_form' => 'merchantStoreCategoryUpdate', + ]); + Route::post('update/:id', '/update')->name('merchantStoreCategoryUpdate')->option([ + '_alias' => '编辑', + ]); + Route::get('lst', '/lst')->name('merchantStoreCategoryLst')->option([ + '_alias' => '列表', + ]); + Route::get('detail/:id', '/detail')->name('merchantStoreCategoryDtailt')->option([ + '_alias' => '详情', + ]); + Route::post('create', '/create')->name('merchantStoreCategoryCreate')->option([ + '_alias' => '添加', + ]); + Route::delete('delete/:id', '/delete')->name('merchantStoreCategoryDelete')->option([ + '_alias' => '删除', + ]); + Route::post('status/:id', '/switchStatus')->name('merchantStoreCategorySwitchStatus')->option([ + '_alias' => '修改状态', + ]); + Route::get('list', '/getList')->option([ + '_alias' => '筛选', + '_auth' => false, + ])->append(['type' => 1]); + Route::get('select', '/getStoreCategoryList')->option([ + '_alias' => '', + '_auth' => false, + ]); + Route::get('brandlist', '/BrandList')->option([ + '_alias' => '品牌列表', + '_auth' => false, + ]); + })->prefix('product.StoreCategory')->option([ + '_path' => '/product/classify', + '_auth' => true, + '_append'=> [ + [ + '_name' =>'merchantUploadImage', + '_path' =>'/product/classify', + '_alias' => '上传图片', + '_auth' => true, + ], + [ + '_name' =>'merchantAttachmentLst', + '_path' =>'/product/classify', + '_alias' => '图片列表', + '_auth' => true, + ], + ] + ]); + + //品牌分类 + Route::group('store/brand/category', function () { + Route::get('create/form', '/createForm')->name('systemStoreBrandCategoryCreateForm')->option([ + '_alias' => '添加表单', + '_auth' => false, + '_form' => 'systemStoreBrandCategoryCreate', + ]); + Route::get('update/form/:id', '/updateForm')->name('systemStoreBrandCategoryUpdateForm')->option([ + '_alias' => '编辑表单', + '_auth' => false, + '_form' => 'systemStoreBrandCategoryUpdate', + ]); + Route::post('update/:id', '/update')->name('systemStoreBrandCategoryUpdate')->option([ + '_alias' => '编辑', + ]); + Route::get('lst', '/lst')->name('systemStoreBrandCategoryLst')->option([ + '_alias' => '列表', + ]); + Route::get('detail/:id', '/detail')->name('systemStoreBrandCategoryDtailt')->option([ + '_alias' => '详情', + ]); + Route::post('create', '/create')->name('systemStoreBrandCategoryCreate')->option([ + '_alias' => '添加', + ]); + Route::delete('delete/:id', '/delete')->name('systemStoreBrandCategoryDelete')->option([ + '_alias' => '删除', + ]); + Route::post('status/:id', '/switchStatus')->name('systemStoreBrandCategorySwitchStatus')->option([ + '_alias' => '修改状态', + ]); + })->prefix('admin.store.StoreBrandCategory')->option([ + '_path' => '/product/band/brandClassify', + '_auth' => true, + ]); + + //品牌 + Route::group('store/brand', function () { + Route::get('create/form', '/createForm')->name('systemStoreBrandCreateForm')->option([ + '_alias' => '添加表单', + '_auth' => false, + '_form' => 'systemStoreBrandCreate', + ]); + Route::get('update/form/:id', '/updateForm')->name('systemStoreBrandUpdateForm')->option([ + '_alias' => '编辑表单', + '_auth' => false, + '_form' => 'systemStoreBrandUpdate', + ]); + Route::get('lst', '/lst')->name('systemStoreBrandLst')->option([ + '_alias' => '列表', + ]); + Route::post('status/:id', '/switchStatus')->name('systemStoreBrandSwithStatus')->option([ + '_alias' => '修改状态', + ]); + Route::post('create', '/create')->name('systemStoreBrandCreate')->option([ + '_alias' => '添加', + ]); + Route::post('update/:id', '/update')->name('systemStoreBrandUpdate')->option([ + '_alias' => '编辑', + ]); + Route::delete('delete/:id', '/delete')->name('systemStoreBrandDelete')->option([ + '_alias' => '删除', + ]); + })->prefix('admin.store.StoreBrand')->option([ + '_path' => '/product/band/brandList', + '_auth' => true, + ]); + + //商品标签 + Route::group('product/label', function () { + Route::get('lst', '/lst')->name('merchantStoreProductLabelLst')->option([ + '_alias' => '列表', + ]); + Route::get('create/form', '/createForm')->name('merchantStoreProductLabelCreateForm')->option([ + '_alias' => '添加表单', + '_auth' => false, + '_form' => 'merchantStoreProductLabelCreate', + ]); + Route::post('create', '/create')->name('merchantStoreProductLabelCreate')->option([ + '_alias' => '添加', + ]); + Route::get('update/:id/form', '/updateForm')->name('merchantStoreProductLabelUpdateForm')->option([ + '_alias' => '编辑表单', + '_auth' => false, + '_form' => 'merchantStoreProductLabelUpdate', + ]); + Route::post('update/:id', '/update')->name('merchantStoreProductLabelUpdate')->option([ + '_alias' => '编辑', + ]); + Route::get('detail/:id', '/detail')->name('merchantStoreProductLabelDetail')->option([ + '_alias' => '详情', + ]); + Route::delete('delete/:id', '/delete')->name('merchantStoreProductLabelDelete')->option([ + '_alias' => '删除', + ]); + Route::post('status/:id', '/switchWithStatus')->name('merchantStoreProductLabelStatus')->option([ + '_alias' => '修改状态', + ]); + Route::get('option', '/getOptions')->option([ + '_alias' => '筛选', + '_auth' => false, + ]); + + })->prefix('merchant.store.product.ProductLabel')->option([ + '_path' => '/product/label', + '_auth' => true, + ]); +}); \ No newline at end of file diff --git a/app/admin/route/system.php b/app/admin/route/system.php new file mode 100644 index 0000000..3c58937 --- /dev/null +++ b/app/admin/route/system.php @@ -0,0 +1,26 @@ +name('systemAgreeKeyLsy')->option([ + '_alias' => '协议列表', + ]); + + Route::get(':key', '/getAgree')->name('systemAgreeDetail')->option([ + '_alias'=> '协议', + '_auth' => false, + '_form' => 'systemAgreeSave', + ]); + + Route::post(':key', '/saveAgree')->name('systemAgreeSave')->option([ + '_alias' => '协议保存', + '_init' => [ \crmeb\services\UpdateAuthInit::class,'agreement'], + ]); + +})->prefix('admin.system.Cache')->option([ + '_path' => '/setting/agreements', + '_auth' => true, +]); \ No newline at end of file diff --git a/app/admin/view/merchant/system/auth/menu/add.html b/app/admin/view/merchant/system/auth/menu/add.html new file mode 100644 index 0000000..2b494c5 --- /dev/null +++ b/app/admin/view/merchant/system/auth/menu/add.html @@ -0,0 +1,150 @@ +{extend name="common/base" /} + +{block name="body"} +
+

功能菜单/节点

+ {if condition="$id eq 0"} + + + + + + + + + + + + + + + + + + + + + + + +
父级菜单/节点* + + + 左侧菜单显示* + + + +
菜单/节点名称* + + + 操作日志名称* + + +
菜单/节点URL + + 菜单排序 + +
菜单图标 + + 如:bi-gear[查看图标] +
+ {else/} + + + + + + + + + + + + + + + + + + + + + + + +
父级菜单/节点* + + + 左侧菜单显示* + + + +
菜单/节点名称* + + + 操作日志名称* + + +
菜单/节点URL + + 菜单排序 + +
菜单图标 + + [查看图标] +
+ {/if} +
+ + + +
+
+{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/auth/menu/index.html b/app/admin/view/merchant/system/auth/menu/index.html new file mode 100644 index 0000000..b47809f --- /dev/null +++ b/app/admin/view/merchant/system/auth/menu/index.html @@ -0,0 +1,93 @@ +{extend name="common/base"/} + +{block name="body"} +
+
+ +
+
+
+
+
+{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/descr/index.html b/app/admin/view/merchant/system/merchant/descr/index.html new file mode 100644 index 0000000..7e86548 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/descr/index.html @@ -0,0 +1,135 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ + + + + + + + + +
店铺说明
+ +
+
+ + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/intention/lst.html b/app/admin/view/merchant/system/merchant/intention/lst.html new file mode 100644 index 0000000..8389bb8 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/intention/lst.html @@ -0,0 +1,332 @@ +{extend name="common/base"/} + +{block name="body"} + + +
+ + + +
+ +
+
+ +
+ +
+ +
+
+ + + + + + + + +
+
+
+ +
+ +
+
+ +
+
-
+
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + + + + +
+
+
+
+ +
+
+ +
+ +
+
+
+ + + +
+ +
+ + +
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+
+
+ +
+ + +
+
+ + + +
+ + + + + + +{/block} + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/intention/mark.html b/app/admin/view/merchant/system/merchant/intention/mark.html new file mode 100644 index 0000000..960b7dc --- /dev/null +++ b/app/admin/view/merchant/system/merchant/intention/mark.html @@ -0,0 +1,57 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

备注

+ + + + +
+ + +
+
+ + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/margin/edit.html b/app/admin/view/merchant/system/merchant/margin/edit.html new file mode 100644 index 0000000..dc722a9 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/margin/edit.html @@ -0,0 +1,116 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

保证金扣费

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
商户名称* + + +
商户ID + +
商户剩余保证金 + + + 单位:元
保证金扣除金额* + + 单位:元
保证金扣除原因* + +
+ +
+ + +
+
+{/block} + + + +{block name="script"} + + + +{/block} + diff --git a/app/admin/view/merchant/system/merchant/margin/list.html b/app/admin/view/merchant/system/merchant/margin/list.html new file mode 100644 index 0000000..2e94988 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/margin/list.html @@ -0,0 +1,523 @@ +{extend name="common/base"/} + +{block name="body"} + + +
+ + + +
+ +
+
+ +
+ +
+
+ + + + + + + +
+
+
+ +
+ +
+
+ +
+
-
+
+ +
+
+
+ +
+ +
+ +
+
+ +
+ + +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ + +
+ +
+ +
+
+
+ + + + +
+
+ + + + + +
+
    +
  • 缴存保证金
  • +
  • 退回保证金
  • +
+
+ + +
+ +
+
+ + +
+
+ +
+
+ +
+
+
+ + + + +
+ + + + + + + + + +{/block} + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/margin/read.html b/app/admin/view/merchant/system/merchant/margin/read.html new file mode 100644 index 0000000..1192e1c --- /dev/null +++ b/app/admin/view/merchant/system/merchant/margin/read.html @@ -0,0 +1,102 @@ +{extend name="common/base"/} + +{block name="body"} + +
+ +
+
    +
  • 扣费记录
  • +
+
+ + +
+ +
+
+
+
+ +
+ +{/block} + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/margin/read_refund.html b/app/admin/view/merchant/system/merchant/margin/read_refund.html new file mode 100644 index 0000000..6bb7943 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/margin/read_refund.html @@ -0,0 +1,63 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

查看店铺类型

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
店铺类型名称
店铺类型要求 + +
店铺保证金
店铺权限 + + +
其它说明 + +
创建时间 + {$detail.create_time} +
修改时间 + {$detail.update_time} +
+
+{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/type/add.html b/app/admin/view/merchant/system/merchant/type/add.html new file mode 100644 index 0000000..e2ecbc6 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/type/add.html @@ -0,0 +1,209 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加店铺类型

+ + + + + + + + + + + + + + + + + + + + + + + + + +
店铺类型名称* + +
店铺类型要求 + +
店铺保证金 + + + + + + + + + +
+
+ + +
+
+ + 单位:元
+
店铺权限* +
+
+
其它说明 + +
+ +
+ + +
+
+{/block} + + + +{block name="script"} + + + +{/block} + diff --git a/app/admin/view/merchant/system/merchant/type/index.html b/app/admin/view/merchant/system/merchant/type/index.html new file mode 100644 index 0000000..c5a0624 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/type/index.html @@ -0,0 +1,138 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ + + + + +{/block} + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/merchant/system/merchant/type/read.html b/app/admin/view/merchant/system/merchant/type/read.html new file mode 100644 index 0000000..1145f28 --- /dev/null +++ b/app/admin/view/merchant/system/merchant/type/read.html @@ -0,0 +1,63 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

查看店铺类型

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
店铺类型名称
店铺类型要求 + +
店铺保证金
店铺权限 + + +
其它说明 + +
创建时间 + {$detail.create_time} +
修改时间 + {$detail.update_time} +
+
+{/block} + \ No newline at end of file diff --git a/app/admin/view/product/Label/add.html b/app/admin/view/product/Label/add.html new file mode 100644 index 0000000..4465a02 --- /dev/null +++ b/app/admin/view/product/Label/add.html @@ -0,0 +1,102 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + +
标签名称* + +
说明 + +
排序 + + +
+ +
+ +
+
+
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/Label/edit.html b/app/admin/view/product/Label/edit.html new file mode 100644 index 0000000..cf1d79e --- /dev/null +++ b/app/admin/view/product/Label/edit.html @@ -0,0 +1,97 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + +
标签名称* + +
说明 + +
排序 + + +
+ +
+ +
+
+
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/Label/index.html b/app/admin/view/product/Label/index.html new file mode 100644 index 0000000..f764ee9 --- /dev/null +++ b/app/admin/view/product/Label/index.html @@ -0,0 +1,157 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/band/add.html b/app/admin/view/product/band/add.html new file mode 100644 index 0000000..cd6974f --- /dev/null +++ b/app/admin/view/product/band/add.html @@ -0,0 +1,167 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + + + +
上级分类* + + + +
+ +
+
+
+
+
品牌名称* + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/band/edit.html b/app/admin/view/product/band/edit.html new file mode 100644 index 0000000..e764766 --- /dev/null +++ b/app/admin/view/product/band/edit.html @@ -0,0 +1,165 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + +
上级分类* + + + +
+ +
+
+
+
+
品牌名称* + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/band/index.html b/app/admin/view/product/band/index.html new file mode 100644 index 0000000..4c48c45 --- /dev/null +++ b/app/admin/view/product/band/index.html @@ -0,0 +1,152 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/brand_classify/add.html b/app/admin/view/product/brand_classify/add.html new file mode 100644 index 0000000..d452070 --- /dev/null +++ b/app/admin/view/product/brand_classify/add.html @@ -0,0 +1,122 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + +
上级分类* + + +
分类名称 + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/brand_classify/edit.html b/app/admin/view/product/brand_classify/edit.html new file mode 100644 index 0000000..abc9fed --- /dev/null +++ b/app/admin/view/product/brand_classify/edit.html @@ -0,0 +1,119 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + +
上级分类* + + +
分类名称 + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/brand_classify/index.html b/app/admin/view/product/brand_classify/index.html new file mode 100644 index 0000000..d31b0cc --- /dev/null +++ b/app/admin/view/product/brand_classify/index.html @@ -0,0 +1,126 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+ +
+
+
+
+
+ + + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/classify/add.html b/app/admin/view/product/classify/add.html new file mode 100644 index 0000000..8468a58 --- /dev/null +++ b/app/admin/view/product/classify/add.html @@ -0,0 +1,108 @@ +{extend name="common/base" /} + +{block name="body"} +
+

添加分类

+ + + + + + + + + + + + + + + + + + + + + +
上级分类* + +
分类名称* + + +
分类图片 +
+ +
+ + +
+
+
排序 + + +
+ +
+ +
+
+
+ +
+ + + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/classify/edit.html b/app/admin/view/product/classify/edit.html new file mode 100644 index 0000000..5e4547b --- /dev/null +++ b/app/admin/view/product/classify/edit.html @@ -0,0 +1,144 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + + + + + + + +
上级分类* + +
+
+
+
+ +
+ +
+
+
分类图片 +
+ +
+ + +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/classify/index.html b/app/admin/view/product/classify/index.html new file mode 100644 index 0000000..3d8837c --- /dev/null +++ b/app/admin/view/product/classify/index.html @@ -0,0 +1,143 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+ +
+
+
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/comment/add.html b/app/admin/view/product/comment/add.html new file mode 100644 index 0000000..b4b9888 --- /dev/null +++ b/app/admin/view/product/comment/add.html @@ -0,0 +1,200 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

关联商户

+ + + + + + + + + + + + + + + + + + + + + + + + +
选择商户 +
+ +
+
+
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
请选择所在地址* +
+ +
+
+ +
+
+
+
+
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/comment/edit.html b/app/admin/view/product/comment/edit.html new file mode 100644 index 0000000..2ebf4e4 --- /dev/null +++ b/app/admin/view/product/comment/edit.html @@ -0,0 +1,188 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + + + +
选择商户 +
+ +
+
+
+
+
+ +
+ +
+
+
+
+ +
+ + +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/comment/index.html b/app/admin/view/product/comment/index.html new file mode 100644 index 0000000..b369315 --- /dev/null +++ b/app/admin/view/product/comment/index.html @@ -0,0 +1,200 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/guarantee/add.html b/app/admin/view/product/guarantee/add.html new file mode 100644 index 0000000..00125f1 --- /dev/null +++ b/app/admin/view/product/guarantee/add.html @@ -0,0 +1,129 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + + + + + +
服务条款* + +
服务内容描述 + +
服务条款图标 +
+ +
+ + +
+
+
+
+ +
+ +
+
+
排序 + +
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/guarantee/edit.html b/app/admin/view/product/guarantee/edit.html new file mode 100644 index 0000000..a3386d0 --- /dev/null +++ b/app/admin/view/product/guarantee/edit.html @@ -0,0 +1,122 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + + + + +
服务条款* + +
服务内容描述 + +
服务条款图标 +
+ +
+ + +
+
+
+
+ +
+ +
+
+
排序 + +
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/guarantee/index.html b/app/admin/view/product/guarantee/index.html new file mode 100644 index 0000000..876d6e5 --- /dev/null +++ b/app/admin/view/product/guarantee/index.html @@ -0,0 +1,182 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/mer_specs/add.html b/app/admin/view/product/mer_specs/add.html new file mode 100644 index 0000000..cd6974f --- /dev/null +++ b/app/admin/view/product/mer_specs/add.html @@ -0,0 +1,167 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + + + +
上级分类* + + + +
+ +
+
+
+
+
品牌名称* + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/mer_specs/edit.html b/app/admin/view/product/mer_specs/edit.html new file mode 100644 index 0000000..e764766 --- /dev/null +++ b/app/admin/view/product/mer_specs/edit.html @@ -0,0 +1,165 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + +
上级分类* + + + +
+ +
+
+
+
+
品牌名称* + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/mer_specs/index.html b/app/admin/view/product/mer_specs/index.html new file mode 100644 index 0000000..4c48c45 --- /dev/null +++ b/app/admin/view/product/mer_specs/index.html @@ -0,0 +1,152 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/parameter/add.html b/app/admin/view/product/parameter/add.html new file mode 100644 index 0000000..10d3b1a --- /dev/null +++ b/app/admin/view/product/parameter/add.html @@ -0,0 +1,178 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + + + + +
参数模板名称* + +
排序 + +
+ + + + + + + + + + + + + + + + + +
参数名称参数值排序操作
+ + + + + + + 删除 +
+ +
+
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/parameter/edit.html b/app/admin/view/product/parameter/edit.html new file mode 100644 index 0000000..e764766 --- /dev/null +++ b/app/admin/view/product/parameter/edit.html @@ -0,0 +1,165 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + +
上级分类* + + + +
+ +
+
+
+
+
品牌名称* + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/parameter/index.html b/app/admin/view/product/parameter/index.html new file mode 100644 index 0000000..f2173cd --- /dev/null +++ b/app/admin/view/product/parameter/index.html @@ -0,0 +1,195 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+
+ +
+ + +
+ +
+ + + + + +
+ 平台分类 + + +
+
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/price_description/add.html b/app/admin/view/product/price_description/add.html new file mode 100644 index 0000000..cd6974f --- /dev/null +++ b/app/admin/view/product/price_description/add.html @@ -0,0 +1,167 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + + + +
上级分类* + + + +
+ +
+
+
+
+
品牌名称* + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/price_description/edit.html b/app/admin/view/product/price_description/edit.html new file mode 100644 index 0000000..e764766 --- /dev/null +++ b/app/admin/view/product/price_description/edit.html @@ -0,0 +1,165 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + +
上级分类* + + + +
+ +
+
+
+
+
品牌名称* + +
+
+ +
+ +
+
+
排序 + +
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/price_description/index.html b/app/admin/view/product/price_description/index.html new file mode 100644 index 0000000..4c48c45 --- /dev/null +++ b/app/admin/view/product/price_description/index.html @@ -0,0 +1,152 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/product/add.html b/app/admin/view/product/product/add.html new file mode 100644 index 0000000..b4b9888 --- /dev/null +++ b/app/admin/view/product/product/add.html @@ -0,0 +1,200 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

关联商户

+ + + + + + + + + + + + + + + + + + + + + + + + +
选择商户 +
+ +
+
+
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
请选择所在地址* +
+ +
+
+ +
+
+
+
+
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/product/edit.html b/app/admin/view/product/product/edit.html new file mode 100644 index 0000000..2ebf4e4 --- /dev/null +++ b/app/admin/view/product/product/edit.html @@ -0,0 +1,188 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + + + +
选择商户 +
+ +
+
+
+
+
+ +
+ +
+
+
+
+ +
+ + +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/product/index.back.html b/app/admin/view/product/product/index.back.html new file mode 100644 index 0000000..d3dced9 --- /dev/null +++ b/app/admin/view/product/product/index.back.html @@ -0,0 +1,437 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+ +
+ + +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ + + +
+
+ + +
+
+ +
+ +
+ + +
+ +
+ + +
+
+ + +
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/product/product/index.html b/app/admin/view/product/product/index.html new file mode 100644 index 0000000..7a9d803 --- /dev/null +++ b/app/admin/view/product/product/index.html @@ -0,0 +1,449 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
    +
  • 出售中的商品
  • +
  • 仓库中的商品
  • +
  • 已售罄的商品
  • +
  • 警戒库存
  • +
  • 待审核商品
  • +
  • 审核未通过商品
  • +
  • 回收站商品
  • +
+
+ + +
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+ +
+ + +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+ + + +
+
+ + +
+
+ +
+ +
+ + +
+ +
+ + +
+
+ + +
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/index/add.html b/app/admin/view/supplychain/index/add.html new file mode 100644 index 0000000..0e5787b --- /dev/null +++ b/app/admin/view/supplychain/index/add.html @@ -0,0 +1,210 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

关联商户

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
选择商户 +
+ +
+
+
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
请选择所在地址* +
+ +
+
+ +
+
+
+
+
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/index/edit.html b/app/admin/view/supplychain/index/edit.html new file mode 100644 index 0000000..0ed608a --- /dev/null +++ b/app/admin/view/supplychain/index/edit.html @@ -0,0 +1,218 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+ +

编辑

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
选择商户 +
+ +
+
+
+ +
+ {volist name='detail.merchant' id='vo'} + + {/volist} +
+
+
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
请选择所在地址* +
+ +
+
+ +
+
+
+
+
+
+ + + +
+
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/index/index.html b/app/admin/view/supplychain/index/index.html new file mode 100644 index 0000000..ac0d49c --- /dev/null +++ b/app/admin/view/supplychain/index/index.html @@ -0,0 +1,208 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/index/read.html b/app/admin/view/supplychain/index/read.html new file mode 100644 index 0000000..3fffad9 --- /dev/null +++ b/app/admin/view/supplychain/index/read.html @@ -0,0 +1,67 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

详情

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
标题*
简介* + +
内容 + +
坐标 +

经度:{$detail.lng}

+

纬度:{$detail.lat}

+ +
运输距离 + {volist name='farmers' id='vo'} +

距离 {$vo.title} {$vo.juli} 公里

+ {/volist} +
+
+{/block} + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/merchant/add.html b/app/admin/view/supplychain/merchant/add.html new file mode 100644 index 0000000..a408038 --- /dev/null +++ b/app/admin/view/supplychain/merchant/add.html @@ -0,0 +1,138 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

添加

+ + + + + + + + + + + + + + + + + + + +
所属区域* +
+ +
+
姓名* + + 负责人头像 +
+ +
+ + +
+
+
职务* + + 电话* + +
+
+ + +
+ +
+{/block} + + + +{block name="script"} + + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/merchant/bill.html b/app/admin/view/supplychain/merchant/bill.html new file mode 100644 index 0000000..d1e1ab5 --- /dev/null +++ b/app/admin/view/supplychain/merchant/bill.html @@ -0,0 +1,280 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/merchant/edit.html b/app/admin/view/supplychain/merchant/edit.html new file mode 100644 index 0000000..a27228d --- /dev/null +++ b/app/admin/view/supplychain/merchant/edit.html @@ -0,0 +1,133 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

编辑

+ + + + + + + + + + + + + + + + + + +
所属区域* +
+ +
+
姓名* + + 负责人头像 +
+ +
+ + +
+
+
职务* + + 电话* + +
+
+ + + +
+
+{/block} + + + +{block name="script"} + + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/merchant/index.html b/app/admin/view/supplychain/merchant/index.html new file mode 100644 index 0000000..0ec5f85 --- /dev/null +++ b/app/admin/view/supplychain/merchant/index.html @@ -0,0 +1,259 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/supplychain/merchant/read.html b/app/admin/view/supplychain/merchant/read.html new file mode 100644 index 0000000..3fffad9 --- /dev/null +++ b/app/admin/view/supplychain/merchant/read.html @@ -0,0 +1,67 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

详情

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
标题*
简介* + +
内容 + +
坐标 +

经度:{$detail.lng}

+

纬度:{$detail.lat}

+ +
运输距离 + {volist name='farmers' id='vo'} +

距离 {$vo.title} {$vo.juli} 公里

+ {/volist} +
+
+{/block} + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/api/BaseController.php b/app/api/BaseController.php index bea59e9..823bf71 100644 --- a/app/api/BaseController.php +++ b/app/api/BaseController.php @@ -83,52 +83,62 @@ abstract class BaseController //每页显示数据量 $this->pageSize = Request::param('page_size', \think\facade\Config::get('app.page_size')); - $token = Request::header('x-Token'); - if ($token) { - if (strpos($token, 'Bearer') === 0){ - $token = trim(substr($token, 6)); - } - if (count(explode('.', $token)) != 3) { - return json(['code'=>404,'msg'=>'非法请求']); - } - $config = get_system_config('token'); - //var_dump($config);exit; - try { - JWT::$leeway = 60;//当前时间减去60,把时间留点余地 - $decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式,这里要和签发的时候对应 +// 暂时去除 ----------------------------------------------------- +// $token = Request::header('x-Token'); +// if ($token) { +// if (strpos($token, 'Bearer') === 0){ +// $token = trim(substr($token, 6)); +// } +// if (count(explode('.', $token)) != 3) { +// return json(['code'=>404,'msg'=>'非法请求']); +// } +// $config = get_system_config('token'); - //return (array)$decoded; -// $decoded_array = json_decode(json_encode($decoded),TRUE); -// $jwt_data = $decoded_array['data']; +// return json($token); +// JWT::$leeway = 60;//当前时间减去60,把时间留点余地 +// $decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式,这里要和签发的时候对应 - $user=Db::connect('shop')->name('nk_user')->where('user_id',$decoded->jti[0])->find(); - if (!$user){ - return json(['code'=>403,'msg'=>'签名错误']); - return false; - } - $user = Db::table('fa_user')->where('id',$user['n_user_id'])->find(); - //$request->uid = $jwt_data['userid']; - define('JWT_UID', $user['id']); -// $response = $next($request); -// return $response; - //return $next($request); - } catch(\Firebase\JWT\SignatureInvalidException $e) { //签名不正确 - return json(['code'=>403,'msg'=>'签名错误']); - }catch(\Firebase\JWT\BeforeValidException $e) { // 签名在某个时间点之后才能用 - return json(['code'=>401,'msg'=>'token失效']); - }catch(\Firebase\JWT\ExpiredException $e) { // token过期 - return json(['code'=>401,'msg'=>'token已过期']); - }catch(Exception $e) { //其他错误 - return json(['code'=>404,'msg'=>'非法请求']); - }catch(\UnexpectedValueException $e) { //其他错误 - return json(['code'=>404,'msg'=>'非法请求']); - } catch(\DomainException $e) { //其他错误 - return json(['code'=>404,'msg'=>'非法请求']); - } - }else{ - define('JWT_UID', ''); - } +// return $decoded->jti[0]; +// exit; +// //var_dump($config);exit; +// try { +// JWT::$leeway = 60;//当前时间减去60,把时间留点余地 +// $decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式,这里要和签发的时候对应 + +// //return (array)$decoded; +// // $decoded_array = json_decode(json_encode($decoded),TRUE); +// // $jwt_data = $decoded_array['data']; + +// $user=Db::connect('shop')->name('nk_user')->where('user_id',$decoded->jti[0])->find(); +// if (!$user){ +// return json(['code'=>403,'msg'=>'签名错误']); +// return false; +// } +// $user = Db::table('fa_user')->where('id',$user['n_user_id'])->find(); +// //$request->uid = $jwt_data['userid']; +// define('JWT_UID', $user['id']); +// // $response = $next($request); +// // return $response; +// //return $next($request); +// } catch(\Firebase\JWT\SignatureInvalidException $e) { //签名不正确 +// return json(['code'=>403,'msg'=>'签名错误']); +// }catch(\Firebase\JWT\BeforeValidException $e) { // 签名在某个时间点之后才能用 +// return json(['code'=>401,'msg'=>'token失效']); +// }catch(\Firebase\JWT\ExpiredException $e) { // token过期 +// return json(['code'=>401,'msg'=>'token已过期']); +// }catch(Exception $e) { //其他错误 +// return json(['code'=>404,'msg'=>'非法请求']); +// }catch(\UnexpectedValueException $e) { //其他错误 +// return json(['code'=>404,'msg'=>'非法请求']); +// } catch(\DomainException $e) { //其他错误 +// return json(['code'=>404,'msg'=>'非法请求']); +// } +// }else{ +// define('JWT_UID', ''); +// } + +// 暂时去除 ----------------------------------------------------- } /** diff --git a/app/api/controller/Article.php b/app/api/controller/Article.php index 5659497..f3fe1f4 100644 --- a/app/api/controller/Article.php +++ b/app/api/controller/Article.php @@ -41,8 +41,8 @@ class Article extends BaseController unset($where[1]); } //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -54,7 +54,7 @@ class Article extends BaseController } // 登录返回村名和村地址 $cun_arr['cun_name'] = Db::table('fa_geo_village')->where('village_id', $find['village_id'])->value('village_name'); - $cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name'); + $cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->value('address_name'); }else{ $cun_arr = []; } @@ -183,8 +183,8 @@ class Article extends BaseController unset($where[1]); } // 如果登录 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -312,8 +312,8 @@ class Article extends BaseController ['status', '=', 1], ]; //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -497,7 +497,7 @@ class Article extends BaseController // if (!$res) { // return $this->apiError($valdate->getError()); // } - $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->where('status', 1)->find(); + $useraddress = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->where('status', 1)->find(); $data = []; if ($useraddress) { @@ -507,7 +507,7 @@ class Article extends BaseController } $data['end_time'] = date('Y-m-d H:i:s', strtotime('+1 day')); $data['view_time'] = date('Y-m-d H:i:s'); - $data['user_id'] = JWT_UID;//添加用户的id + $data['user_id'] = $this->request->uid;//添加用户的id $data['category_id'] = $input['category_id'];//大分类id $data['category_type'] = $input['category_type'];//小分类id $data['title'] = $input['title'];//标题 @@ -518,7 +518,7 @@ class Article extends BaseController $data['image'] = $input['image'];//封面 $data['is_vote'] =empty($input['is_vote'])?0:$input['is_vote'];//是否投票 if ($input['category_id']==150){ - $name=Db::table('fa_szxc_information_usermsg')->where('user_id',JWT_UID)->value('name'); + $name=Db::table('fa_szxc_information_usermsg')->where('user_id',$this->request->uid)->value('name'); $data['title'] = '来自于'.$name.'的一键求救'; } $res = Db::table('fa_article')->insertGetId($data); @@ -575,7 +575,7 @@ class Article extends BaseController $data['describe'] = empty($input['describe'])?'':$input['describe'];//简介 $data['image'] = $input['image'];//封面 $data['is_vote'] = $input['is_vote'];//是否投票 - $input['update_user_id'] = JWT_UID;//更新用户的id + $input['update_user_id'] = $this->request->uid;//更新用户的id $res = Db::table('fa_article')->where('id', $id)->update($data); if ($input['is_vote'] == 1) { @@ -596,8 +596,8 @@ class Article extends BaseController { // $model = Db::table('fa_article'); //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -650,12 +650,12 @@ class Article extends BaseController { // $model = Db::table('fa_article'); //根据个人id进行查询 - $where[] = ['a.user_id','=',JWT_UID]; + $where[] = ['a.user_id','=',$this->request->uid]; $where[] = ['b.is_read','=','0']; $which = []; //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $www[] = ['a.village', '=', $find['village_id']]; @@ -665,7 +665,7 @@ class Article extends BaseController $www[] = ['a.county', '=', $find['area_id']]; } } - $which['user_id'] = JWT_UID; + $which['user_id'] = $this->request->uid; } $yishi = Db::table('fa_article')->alias('a')->join(['fa_article_vote_side_tables' => 'b'],'a.id=b.article_id')->where($www)->where('a.category_id',162)->whereTime('b.end_time', '>', date('Y-m-d H:i:s'))->count(); $maodun = Db::table('fa_article')->alias('a')->join(['fa_article_comment' => 'b'],'a.id=b.vote_id')->where('a.is_solve', 1)->where($where)->where('a.category_id',147)->count(); @@ -708,8 +708,8 @@ class Article extends BaseController } //根据个人村id进行查询 - if (JWT_UID) { - $find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find(); + if ($this->request->uid) { + $find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->request->uid)->find(); if ($find) { if ($find['auth_range']==1){ $where[] = ['village', '=', $find['village_id']]; @@ -721,7 +721,7 @@ class Article extends BaseController } // 登录返回村名和村地址 $cun_arr['cun_name'] = Db::table('fa_geo_village')->where('village_id', $find['village_id'])->value('village_name'); - $cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name'); + $cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->value('address_name'); }else{ $cun_arr = []; } diff --git a/app/api/controller/Geo.gc.php b/app/api/controller/Geo.gc.php new file mode 100644 index 0000000..55e48b1 --- /dev/null +++ b/app/api/controller/Geo.gc.php @@ -0,0 +1,96 @@ + ['except' => ['province','city','area','street','village','brigade'] ] + ]; + + /** + * 省 + */ + public function province(){ + $res = Db::table('fa_geo_province')->where(['switch'=>1]) + ->field('province_id id,province_code code,province_name name') + ->select(); + $this->apiSuccess('OK',$res); + } + + /** + * 市 + */ + public function city(){ + $pcode = get_params('pcode'); + // $pcode = '130000'; + if(!$pcode) $this->apiError('请先选择省份'); + $res = Db::table('fa_geo_city')->where(['switch'=>1,'province_code'=>$pcode]) + ->field('city_id id,city_code code,city_name name') + ->select(); + $this->apiSuccess('OK',$res); + } + + /** + * 区 + */ + public function area(){ + $pcode = get_params('pcode'); + // $pcode = '140100'; + if(!$pcode) $this->apiError('请先选择城市'); + $res = Db::table('fa_geo_area')->where(['switch'=>1,'city_code'=>$pcode]) + ->field('area_id id,area_code code,area_name name') + ->select(); + $this->apiSuccess('OK',$res); + } + + /** + * 街道 + */ + public function street(){ + $pcode = get_params('pcode'); + // $pcode = '410102'; + if(!$pcode) $this->apiError('请先选择区/县'); + $res = Db::table('fa_geo_street')->where(['switch'=>1,'area_code'=>$pcode]) + ->field('street_id id,street_code code,street_name name') + ->select(); + $this->apiSuccess('OK',$res); + } + + /** + * 村 + */ + public function village(){ + $pcode = get_params('pcode'); + // $pcode = '410102'; + if(!$pcode) $this->apiError('请先选择镇/街道'); + $res = Db::table('fa_geo_village')->where(['switch'=>1,'street_code'=>$pcode]) + ->field('village_id id,village_code code,village_name name') + ->select(); + $this->apiSuccess('OK',$res); + } + + /** + * 大队 + */ + public function brigade(){ + + $res = Db::table('fa_geo_brigade') + ->select(); + $this->apiSuccess('OK',$res); + } + + +} diff --git a/app/api/controller/Geo.php b/app/api/controller/Geo.php index 55e48b1..1480db5 100644 --- a/app/api/controller/Geo.php +++ b/app/api/controller/Geo.php @@ -1,96 +1,129 @@ - ['except' => ['province','city','area','street','village','brigade'] ] - ]; - - /** - * 省 - */ - public function province(){ - $res = Db::table('fa_geo_province')->where(['switch'=>1]) - ->field('province_id id,province_code code,province_name name') - ->select(); - $this->apiSuccess('OK',$res); - } - - /** - * 市 - */ - public function city(){ - $pcode = get_params('pcode'); - // $pcode = '130000'; - if(!$pcode) $this->apiError('请先选择省份'); - $res = Db::table('fa_geo_city')->where(['switch'=>1,'province_code'=>$pcode]) - ->field('city_id id,city_code code,city_name name') - ->select(); - $this->apiSuccess('OK',$res); - } - - /** - * 区 - */ - public function area(){ - $pcode = get_params('pcode'); - // $pcode = '140100'; - if(!$pcode) $this->apiError('请先选择城市'); - $res = Db::table('fa_geo_area')->where(['switch'=>1,'city_code'=>$pcode]) - ->field('area_id id,area_code code,area_name name') - ->select(); - $this->apiSuccess('OK',$res); - } - - /** - * 街道 - */ - public function street(){ - $pcode = get_params('pcode'); - // $pcode = '410102'; - if(!$pcode) $this->apiError('请先选择区/县'); - $res = Db::table('fa_geo_street')->where(['switch'=>1,'area_code'=>$pcode]) - ->field('street_id id,street_code code,street_name name') - ->select(); - $this->apiSuccess('OK',$res); - } - - /** - * 村 - */ - public function village(){ - $pcode = get_params('pcode'); - // $pcode = '410102'; - if(!$pcode) $this->apiError('请先选择镇/街道'); - $res = Db::table('fa_geo_village')->where(['switch'=>1,'street_code'=>$pcode]) - ->field('village_id id,village_code code,village_name name') - ->select(); - $this->apiSuccess('OK',$res); - } - - /** - * 大队 - */ - public function brigade(){ - - $res = Db::table('fa_geo_brigade') - ->select(); - $this->apiSuccess('OK',$res); - } - - -} +市->区->街道/农村->大队 + */ +namespace app\api\controller; + + +use app\api\BaseController; +use app\api\middleware\Auth; +use app\common\model\geo\GeoProvince as GeoProvinceModel; +use app\common\model\geo\GeoCity as GeoCityModel; +use app\common\model\geo\GeoArea as GeoAreaModel; +use app\common\model\geo\GeoStreet as GeoStreetModel; +use app\common\model\geo\GeoVillage as GeoVillageModel; +use app\common\model\geo\GeoBrigade as GeoBrigadeModel; + + +/** + * 首页接口 + */ +class Geo extends BaseController +{ + + /** + * 控制器中间件 [不需要鉴权] + * @var array + */ + protected $middleware = [ + Auth::class => ['except' => ['Province','City','Area','Street','Village', 'Brigade','test']] + ]; + + /** + * 省 + * + * echo json + */ + function Province(GeoProvinceModel $province){ + $list = $province::Get(); + + $this->apiSuccess('OK',$list); + } + + /** + * 市 + * + * @param $pcode 码 + * + * @echo json + */ + function City(GeoCityModel $city){ + $pcode = get_params('pcode'); + // $pcode = '130000'; + if(!$pcode) $this->apiError('请先选择省份'); + + $list = $city::Get($pcode); + + $this->apiSuccess('OK',$list); + } + + /** + * 区 + * + * @param $pcode 码 + * + * echo json + */ + function Area(GeoAreaModel $area){ + $pcode = get_params('pcode'); + // $pcode = '140100'; + if(!$pcode) $this->apiError('请先选择城市'); + + $list = $area::Get($pcode); + + $this->apiSuccess('OK',$list); + } + + /** + * 镇/街道 + * + * @param $pcode 码 + * + * echo json + */ + function Street(GeoStreetModel $street){ + $pcode = get_params('pcode'); + // $pcode = '410102'; + if(!$pcode) $this->apiError('请先选择镇/街道'); + + $list = $street::Get($pcode); + + $this->apiSuccess('OK',$list); + } + + /** + * 村 + * + * @param $pcode 码 + * + * echo json + */ + function Village(GeoVillageModel $village){ + $pcode = get_params('pcode'); + // $pcode = '410102'; + if(!$pcode) $this->apiError('请先选择镇/街道'); + + $list = $village::Get($pcode); + + $this->apiSuccess('OK',$list); + } + + + /** + * 大队 + * + * @param $pcode 码 + * + * echo json + */ + function Brigade(GeoBrigadeModel $brigade) { + $list = $brigade::Get(); + + $this->apiSuccess('OK',$list); + } + +} \ No newline at end of file diff --git a/app/api/controller/User.php b/app/api/controller/User.php index 513804a..aa4346b 100644 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -29,9 +29,9 @@ class User extends BaseController * 会员中心. */ public function index() - { - $user = Db::table('fa_user')->where('id',JWT_UID)->find(); - $user_msg = Db::table('fa_szxc_information_usermsg')->where('user_id',JWT_UID)->field('id,name,address_name,phone')->find(); + { + $user = Db::table('fa_user')->where('id', $this->request->uid)->find(); + $user_msg = Db::table('fa_szxc_information_usermsg')->where('user_id', $this->request->uid)->field('id,name,address_name,phone')->find(); $this->apiSuccess('', [ 'nickname' => $user['nickname'], 'phone'=>$user_msg['phone'], @@ -472,7 +472,7 @@ class User extends BaseController // 获取实名认证信息 public function get_shiming(){ - $uid = JWT_UID; + $uid = $this->request->uid; $is_have = Db::table('cms_szxc_user_authentication')->where('user_id',$uid)->find(); if($is_have){ $this->apiSuccess('获取成功',$is_have); @@ -483,7 +483,7 @@ class User extends BaseController // 获取后台账号信息 public function get_backstage(){ - $uid = JWT_UID; + $uid = $this->request->uid; $admin = Db::table('cms_admin')->where('user_id',$uid)->find(); if($admin){ $data['url'] = 'https://nk.lihaink.cn'; diff --git a/app/api/controller/Userinfo.php b/app/api/controller/Userinfo.php index a3da625..7617a8b 100644 --- a/app/api/controller/Userinfo.php +++ b/app/api/controller/Userinfo.php @@ -94,16 +94,17 @@ class Userinfo extends BaseController public function Binding() { $post = get_params(); - if(!$post['idcard'] || !$post['area_id'] || !$post['street_id'] || !$post['village_id'] || !$post['name']){ $this->apiError('缺少参数'); } if($post['phone'] == 'undefined'){ $this->apiError('手机号错误'); } + $where['id'] = $this->request->uid; $post['user_id'] = $this->request->uid; $user = Db::table('fa_user')->where($where)->field('id,nickname,group_id,mobile,avatar,username,createtime,score')->find(); + // 已绑定 if ($user) { Db::startTrans(); diff --git a/app/api/controller/Village.php b/app/api/controller/Village.php index 27cd03d..f0981ec 100644 --- a/app/api/controller/Village.php +++ b/app/api/controller/Village.php @@ -664,7 +664,7 @@ class Village extends BaseController }) ->withAttr('is_dz', function ($value, $data) { // 判断redis - $user_id = JWT_UID; + $user_id = $this->request->uid; if($user_id){ $name = $user_id . $data['id']; $is_zan = Cache::store('redis')->get($name); diff --git a/app/api/middleware.php b/app/api/middleware.php index 91dea02..e695fbe 100644 --- a/app/api/middleware.php +++ b/app/api/middleware.php @@ -6,4 +6,6 @@ return [ //验证勾股cms是否完成安装 \app\home\middleware\Install::class, \app\api\middleware\AllowOriginMiddleware::class, + \app\api\middleware\Auth::class, + ]; \ No newline at end of file diff --git a/app/api/middleware/Auth.php b/app/api/middleware/Auth.php index 6b55e8c..bfe148d 100644 --- a/app/api/middleware/Auth.php +++ b/app/api/middleware/Auth.php @@ -27,11 +27,12 @@ class Auth if (count(explode('.', $token)) != 3) { return json(['code'=>404,'msg'=>'非法请求']); } + try { JWT::$leeway = 60;//当前时间减去60,把时间留点余地 $decoded = JWT::decode($token, new Key('ae47e94a7dcd1fdfacb499b60e361a8d', 'HS256')); //HS256方式,这里要和签发的时候对应 $user=Db::connect('shop')->name('nk_user')->where('user_id',$decoded->jti[0])->find(); - if ($user &&$user['n_user_id']!=0){ + if ($user && $user['n_user_id']!=0){ $request->uid=$user['n_user_id']; }else{ $request->uid=$this->addUser($decoded->jti[0],$user); @@ -61,41 +62,41 @@ class Auth $msg=Db::table('fa_szxc_information_usermsg')->where('phone',$user['account'])->find(); Db::startTrans(); try { - if ($msg){ - $users=Db::table('fa_user')->where('id',$msg['user_id'])->find(); - if (!$nk_user){ + if ($msg){ + $users=Db::table('fa_user')->where('id',$msg['user_id'])->find(); + if (!$nk_user){ + $datas=[ + 'user_id'=>$user['uid'], + 'n_user_id'=>$msg['user_id'], + 'group_id'=>$users['group_id'] + ]; + Db::connect('shop')->name('nk_user')->insert($datas); + }else{ + Db::connect('shop')->name('nk_user')->where('id',$nk_user['id'])->update(['user_id'=>$user['uid'],'group_id'=>$users['group_id']]); + } + }else{ + $time=time(); + $user_data=[ + 'openid'=>'wx'.$time, + 'group_id'=>1, + 'username'=>'wx'.$time, + 'nickname'=>'微信用户'.$time, + 'avatar'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230104/32a639be4ee32349705e947fbbd1e114.png', + 'level'=>1, + 'prevtime'=>$time, + 'jointime'=>$time, + 'createtime'=>$time, + 'updatetime'=>$time, + 'status'=>'normal' + ]; + $n_user_id= Db::table('fa_user')->insertGetId($user_data); $datas=[ 'user_id'=>$user['uid'], - 'n_user_id'=>$msg['user_id'], - 'group_id'=>$users['group_id'] + 'n_user_id'=>$n_user_id, + 'group_id'=>1 ]; Db::connect('shop')->name('nk_user')->insert($datas); - }else{ - Db::connect('shop')->name('nk_user')->where('id',$nk_user['id'])->update(['user_id'=>$user['uid'],'group_id'=>$users['group_id']]); - } - }else{ - $time=time(); - $user_data=[ - 'openid'=>'wx'.$time, - 'group_id'=>1, - 'username'=>'wx'.$time, - 'nickname'=>'微信用户'.$time, - 'avatar'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230104/32a639be4ee32349705e947fbbd1e114.png', - 'level'=>1, - 'prevtime'=>$time, - 'jointime'=>$time, - 'createtime'=>$time, - 'updatetime'=>$time, - 'status'=>'normal' - ]; - $n_user_id= Db::table('fa_user')->insertGetId($user_data); - $datas=[ - 'user_id'=>$user['uid'], - 'n_user_id'=>$n_user_id, - 'group_id'=>1 - ]; - Db::connect('shop')->name('nk_user')->insert($datas); - return $n_user_id; + return $n_user_id; } Db::commit(); } catch (\Exception $e) { diff --git a/app/common/controller/FormatList.php b/app/common/controller/FormatList.php new file mode 100644 index 0000000..991e56b --- /dev/null +++ b/app/common/controller/FormatList.php @@ -0,0 +1,77 @@ + $v) { + if ($v['pid'] == $pid) { + $v['title'] = ''; + if ($pid != 0) { + $v['title'] = $space[$level] . $v['title']; + } + /*将该类别的数据放入list中*/ + $list[] = $v; + self::DropDownMenu($data, $v['id'],$level); + } + } + + return $list; + } +} \ No newline at end of file diff --git a/app/common/model/geo/GeoArea.php b/app/common/model/geo/GeoArea.php new file mode 100644 index 0000000..c1ca65e --- /dev/null +++ b/app/common/model/geo/GeoArea.php @@ -0,0 +1,26 @@ +1,'city_code'=>$pcode]) + ->field('area_id id,area_code code,area_name name') + ->select(); + + return $list; + } + + +} \ No newline at end of file diff --git a/app/common/model/geo/GeoBrigade.php b/app/common/model/geo/GeoBrigade.php new file mode 100644 index 0000000..ec7385a --- /dev/null +++ b/app/common/model/geo/GeoBrigade.php @@ -0,0 +1,22 @@ +1,'province_code'=>$pcode]) + ->field('city_id id,city_code code,city_name name') + ->select(); + + return $list; + } + + +} \ No newline at end of file diff --git a/app/common/model/geo/GeoProvince.php b/app/common/model/geo/GeoProvince.php new file mode 100644 index 0000000..5d5d161 --- /dev/null +++ b/app/common/model/geo/GeoProvince.php @@ -0,0 +1,31 @@ +belongsToMany(User::class,'fa_geo_city','user_id','role_id'); + // } + + /** + * 省 + */ + static function Get(){ + $res = self::where(['switch'=>1]) + ->field('province_id id,province_code code,province_name name') + ->select(); + + return $res; + } + +} \ No newline at end of file diff --git a/app/common/model/geo/GeoStreet.php b/app/common/model/geo/GeoStreet.php new file mode 100644 index 0000000..cf9b998 --- /dev/null +++ b/app/common/model/geo/GeoStreet.php @@ -0,0 +1,23 @@ +1,'area_code'=>$pcode]) + ->field('street_id id,street_code code,street_name name') + ->select(); + + return $list; + } +} \ No newline at end of file diff --git a/app/common/model/geo/GeoVillage.php b/app/common/model/geo/GeoVillage.php new file mode 100644 index 0000000..20d98f1 --- /dev/null +++ b/app/common/model/geo/GeoVillage.php @@ -0,0 +1,25 @@ +1,'street_code'=>$pcode]) + ->field('village_id id,village_code code,village_name name') + ->select(); + + return $list; + } +} \ No newline at end of file diff --git a/app/common/model/merchant/system/Relevance.php b/app/common/model/merchant/system/Relevance.php new file mode 100644 index 0000000..e2681b9 --- /dev/null +++ b/app/common/model/merchant/system/Relevance.php @@ -0,0 +1,104 @@ +hasOne(User::class,'uid','left_id'); + } + + public function focus() + { + return $this->hasOne(User::class,'uid','right_id'); + } + + public function community() + { + return $this->hasOne(Community::class,'community_id','right_id') + ->bind(['community_id','title','image','start','uid','create_time','count_start','author','is_type']); + } + + public function getIsStartAttr() + { + return self::where('left_id', $this->right_id) + ->where('right_id',$this->left_id) + ->where('type', 'fans') + ->count() > 0; + } + + public function spu() + { + return $this->hasOne(Spu::class, 'spu_id','right_id'); + } + public function merchant() + { + return $this->hasOne(Merchant::class, 'mer_id','right_id'); + } + + public function category() + { + return $this->hasOne(StoreCategory::class, 'store_category_id','right_id'); + } + + + public function auth() + { + return $this->hasOne(Menu::class, 'menu_id','right_id'); + } + + public function searchLeftIdAttr($query, $value) + { + $query->where('left_id', $value); + } + + public function searchRightIdAttr($query, $value) + { + $query->where('right_id', $value); + } + + public function searchTypeAttr($query, $value) + { + $query->where('type', $value); + } + +} diff --git a/app/common/model/merchant/system/auth/Menu.php b/app/common/model/merchant/system/auth/Menu.php new file mode 100644 index 0000000..82aaff3 --- /dev/null +++ b/app/common/model/merchant/system/auth/Menu.php @@ -0,0 +1,108 @@ +field('menu_id as id,pid, sort, route as src,icon,menu_name as title,is_show as status, is_menu as menu') + ->order('sort DESC,menu_id ASC'); + if (isset($where['pid'])) $query->where('pid', (int)$where['pid']); + if (isset($where['keyword'])) $query->whereLike('menu_name|route', "%{$where['keyword']}%"); + if (isset($where['is_menu'])) $query->where('is_menu', (int)$where['is_menu']); + + // 查询记录总行数 + $count = $query->count(); + + if (isset($where['offset'])) $query->page($where['offset'])->limit($where['limit']); + + // 隐藏指定字段 + $list = $query->hidden(['update_time', 'path'])->select()->toArray(); + // 合并为一个数组并返回 + $data = compact('count', 'list'); + + return $data; + } + + /** + * 获取指定行数据 + * + * @return array $row + */ + function Find($id) { + $row = self::where('menu_id', $id) + ->field('menu_id as id,pid, sort, route as src,icon,menu_name as title,is_show as status, is_menu as menu') + ->find(); + + return $row; + } + + /** + * 添加 + */ + function Add() {} + + /** + * 更新 + */ + function modify() + { + return true; + } + + /** + * 删除指定菜单项 + * 由于有三种结果,建议用 try{}catch() 捕获 + * + * @return bool||throw Exception + */ + function Del($id) + { + $count = self::where(["pid" => $id])->count(); + if ($count > 0) { + throw new ValidateException('该节点下还有子节点,无法删除'); + return false; + } + if (self::delete($id) !== false) { + clear_cache('adminRules'); + add_log('delete', $id, []); + throw new ValidateException('删除节点成功'); + } else { + throw new ValidateException('删除失败'); + return false; + } + return true; + } + +} diff --git a/app/common/model/merchant/system/auth/Role.php b/app/common/model/merchant/system/auth/Role.php new file mode 100644 index 0000000..97c3196 --- /dev/null +++ b/app/common/model/merchant/system/auth/Role.php @@ -0,0 +1,14 @@ +hasOne(MerchantType::class, 'mer_type_id', 'type_id'); + } + + public function typeName() + { + return $this->merchantType()->bind(['type_name']); + } + + /** + * 扣除保证金 + *@param array $data [mer_id] => 75 + [number] => 2 + [mer_name] => teert + [margin] => 10 + [mark] => qweqer + [title] => 保证金扣除 + [balance] => 8.00 + *@return + */ + public function SetMargin($data) + { + $merchant = $this->GetMerchantById($data['mer_id']); + + if ($merchant->is_margin !== 10) { + throw new ValidateException('商户未支付保证金或已申请退款'); + } + if ($data['number'] < 0) { + throw new ValidateException('扣除保证金额不能小于0'); + } + + if (bccomp($merchant->margin, $data['number'], 2) == -1) { + throw new ValidateException('扣除保证金额不足'); + } + + $data['balance'] = bcsub($merchant->margin, $data['number'], 2); + + Merchant::transaction(function () use ($merchant, $data) { + $merchant->margin = $data['balance']; + $merchant->save(); + $bill = new UserBillModel(); + $bill->Bill(0, 'mer_margin', $data['type'], 0, $data); + }); + + // return []; + } + + /** + * 查询指定商户信息 + */ + public function GetMerchantById($mer_id) + { + $merchant = Merchant::where('mer_id', $mer_id)->find(); + + return $merchant; + } +} diff --git a/app/common/model/merchant/system/merchant/MerchantAdmin.php b/app/common/model/merchant/system/merchant/MerchantAdmin.php new file mode 100644 index 0000000..03ec84b --- /dev/null +++ b/app/common/model/merchant/system/merchant/MerchantAdmin.php @@ -0,0 +1,14 @@ +hasOne(MerchantCategory::class, 'merchant_category_id', 'merchant_category_id'); + } + + protected function merchantType() + { + return $this->hasOne(MerchantType::class, 'mer_type_id', 'mer_type_id'); + } + + + /** + * 查询入驻申请列表 + */ + public function GetList(array $where, $page, $limit) + { + $query = self::search($where); + + $count = $query->count(); + $list = $query->page($page, $limit)->order('create_time DESC , status ASC')->with(['merchantCategory', 'merchantType'])->select(); + + return compact('count', 'list'); + } + + + /** + * 查询条件组合 + * @param array $where 查询条件 + * @return mixed $query + */ + protected function search(array $where) + { + $query = self::when(isset($where['mer_id']) && $where['mer_id'] !== '', + function ($query) use ($where) { + $query->where('mer_id', $where['mer_id']); + }) + ->when(isset($where['uid']) && $where['uid'] !== '', + function ($query) use ($where) { + $query->where('uid', $where['uid']); + }) + ->when(isset($where['status']) && $where['status'] !== '', + function ($query) use ($where) { + $query->where('status', (int)$where['status']); + }) + ->when(isset($where['mer_intention_id']) && $where['mer_intention_id'] !== '', + function ($query) use ($where) { + $query->where('mer_intention_id', $where['mer_intention_id']); + }) + ->when(isset($where['category_id']) && $where['category_id'] !== '', + function ($query) use ($where) { + $query->where('merchant_category_id', $where['category_id']); + }) + ->when(isset($where['type_id']) && $where['type_id'] !== '', + function ($query) use ($where) { + $query->where('mer_type_id', $where['type_id']); + }) + ->when(isset($where['keyword']) && $where['keyword'] !== '', + function ($query) use ($where) { + $query->where('mer_name|phone|mark', 'like', '%' . $where['keyword'] . '%'); + }) + ->when(isset($where['date']) && $where['date'] !== '', + function ($query) use ($where) { + getModelTime($query, $where['date']); + } + ) + ->where('is_del', 0); + + return $query; + } + + public function Edit($id, $data) + { + $rows = self::where('mer_intention_id',$id)->update($data); + return $rows; + } + + public function form($id, $data) + { + $this->getModel()::getDB()->where($this->getPk(), $id)->update(['status' => $data['status'], 'mark' => $data['mark']]); + } + + public function GetWhereCount($mer_intention_id) + { + $count = self::where(['mer_intention_id' => $mer_intention_id, 'is_del' => 0])->fetchSql()->count(); + + return $count; + } +} diff --git a/app/common/model/merchant/system/merchant/MerchantType.php b/app/common/model/merchant/system/merchant/MerchantType.php new file mode 100644 index 0000000..569a134 --- /dev/null +++ b/app/common/model/merchant/system/merchant/MerchantType.php @@ -0,0 +1,144 @@ +order('mer_type_id DESC') + ->page($page) + ->limit($limit) + ->order('mer_type_id DESC')->paginate($rows, false,[ + 'query' => [], //url额外参数 + // 'total' => '', //最大数量 + // 'fragment' => '', //url锚点 + // 'var_page' => 'page', //分页变量 + ]); + + return $data; + } + + /** + * 查询指定店铺类型数据 + * + * @param int $page 过滤字段条件 + * @param int $limit 菜单类型: 0商城平台菜单 1商户菜单 + * + * @return array|object + */ + function Find(int $id) + { + if (empty($id)) { + throw new ValidateException('未传递参数'); + return []; + } + $row = self::where('mer_type_id', $id)->field('mer_type_id as id,type_name,margin,type_info,description,is_margin,create_time,update_time')->find(); + + return $row; + } + + /** + * 新增店铺类型数据 + * + * @param int $page 过滤字段条件 + * @param int $limit 菜单类型: 0商城平台菜单 1商户菜单 + * + * @return array|object + */ + function Add(array $set_data) { + if (empty($set_data['type_name'])) { + return 0; + } + $batch['type_name'] = $set_data['type_name']; + $batch['description'] = empty($set_data['description'])?"":$set_data['description']; + $batch['is_margin'] = empty($set_data['is_margin']); + if (!empty($set_data['is_margin'])) { + $batch['margin'] = empty($set_data['margin'])?0:$set_data['margin']; + } + $batch['type_info'] = empty($set_data['type_info'])?'':$set_data['type_info']; + $batch['create_time'] = date('Y-m-d H:i:s',time()); + $batch['update_time'] = date('Y-m-d H:i:s',time()); + + $rows = self::insert($batch); + + return $rows; + } + + /** + * 更新指定店铺类型数据 + * + * @param int $page 过滤字段条件 + * @param int $limit 菜单类型: 0商城平台菜单 1商户菜单 + * + * @return array|object + */ + function Edit(int $id, array $set_data) { + if (empty($id) || empty($set_data['type_name'])) { + throw new ValidateException('未传递参数'); + return 0; + } + + $batch['type_name'] = $set_data['type_name']; + $batch['description'] = empty($set_data['description'])?"":$set_data['description']; + $batch['is_margin'] = empty($set_data['is_margin']); + if (!empty($set_data['is_margin'])) { + $batch['margin'] = empty($set_data['margin'])?0:$set_data['margin']; + } + $batch['type_info'] = empty($set_data['type_info'])?'':$set_data['type_info']; + $batch['update_time'] = date('Y-m-d H:i:s',time()); + + $rows = self::update($batch)->where('mer_type_id', $id)->limit(1); + + return $rows; + } + + /** + * 删除指定店铺类型数据 + * + * @param int $page 过滤字段条件 + * @param int $limit 菜单类型: 0商城平台菜单 1商户菜单 + * + * @return array|object + */ + function Del(int $id) { + if (empty($id)) { + throw new ValidateException('未传递参数'); + return 0; + } + $rows = self::where('mer_type_id', $id)->delete(); + + return $rows; + } + + +} diff --git a/app/common/model/merchant/system/serve/ServeMeal.php b/app/common/model/merchant/system/serve/ServeMeal.php new file mode 100644 index 0000000..b971529 --- /dev/null +++ b/app/common/model/merchant/system/serve/ServeMeal.php @@ -0,0 +1,14 @@ +hasOne(Merchant::class,'mer_id','mer_id'); + } + + // 关联用户表 + public function userInfo() + { + return $this->hasOne(User::class,'mer_id','ud'); + } + + function GetList($where, int $page, int $limit) + { + $where['is_del'] = 0; + + $query = self::Search($where)->with([ + 'merchant' => function($query){ + $query->with(['merchantType']); + $query->field('mer_id,mer_name,is_trader,mer_avatar,type_id,mer_phone,mer_address,is_margin,margin,real_name,ot_margin'); + } + ])->order('ServeOrder.create_time DESC'); + + $count = $query->count(); + $list = $query->page((int)$page, (int)$limit)->select(); + + return compact('count','list'); + } + + + /** + * @param ServeOrderRepository $orderRepository + * + * @return \think\response\Json + */ + public function Search($where):Query + { + $query = self::hasWhere('merchant',function($query) use($where) { + + $query->when(isset($where['keyword']) && $where['keyword'] !== '', + function ($query) use($where){ + $query->whereLike('mer_keyword|real_name|mer_name',"%{$where['keyword']}%"); + } + ); + $query->when(isset($where['is_trader']) && $where['is_trader'] !== '', + function ($query) use($where){ + $query->where('is_trader',$where['is_trader']); + } + ); + $query->when(isset($where['category_id']) && $where['category_id'] !== '', + function ($query) use($where){ + $query->where('category_id',$where['category_id']); + } + ); + $query->when(isset($where['type_id']) && $where['type_id'] !== '', + function ($query) use($where){ + $query->where('type_id',$where['type_id']); + } + ); + $query->where('is_del',0); + }); + + $query->when(isset($where['type']) && $where['type'] !== '', + function ($query) use($where){ + $query->where('ServeOrder.type',$where['type']); + } + ); + + $query->when(isset($where['date']) && $where['date'] !== '', + function ($query) use($where){ + getModelTime($query,$where['date'],'ServeOrder.create_time'); + } + ); + + $query->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use($where){ + $query->where('ServeOrder.mer_id',$where['mer_id']); + }); + + $query->when(isset($where['status']) && $where['status'] !== '', function ($query) use($where){ + $query->where('ServeOrder.status',$where['status']); + }); + + $query->when(isset($where['is_del']) && $where['is_del'] !== '', function ($query) use($where){ + $query->where('ServeOrder.is_del',$where['is_del']); + }); + + return $query; + } +} diff --git a/app/common/model/merchant/user/User.php b/app/common/model/merchant/user/User.php new file mode 100644 index 0000000..a0031f5 --- /dev/null +++ b/app/common/model/merchant/user/User.php @@ -0,0 +1,15 @@ + '佣金转入余额', + 'brokerage/order_one' => '获得一级推广佣金', + 'brokerage/order_two' => '获得二级推广佣金', + 'brokerage/refund_one' => '退还一级佣金', + 'brokerage/refund_two' => '退还二级佣金', + 'integral/cancel' => '退回积分', + 'integral/deduction' => '购买商品', + 'integral/lock' => '下单赠送积分', + 'integral/refund' => '订单退款', + 'integral/refund_lock' => '扣除赠送积分', + 'integral/sign_integral' => '签到赠送积分', + 'integral/spread' => '邀请好友', + 'integral/sys_dec' => '系统减少积分', + 'integral/sys_inc' => '系统增加积分', + 'integral/timeout' => '积分过期', + 'mer_integral/deduction' => '积分抵扣', + 'mer_integral/refund' => '订单退款', + 'mer_lock_money/order' => '商户佣金冻结', + 'now_money/brokerage' => '佣金转入余额', + 'now_money/pay_product' => '购买商品', + 'now_money/presell' => '支付预售尾款', + 'now_money/recharge' => '余额充值', + 'now_money/sys_dec_money' => '系统减少余额', + 'now_money/sys_inc_money' => '系统增加余额', + ]; + + + /** + * TODO: 短信通知待开发 + * 创建用户帐单 + * + * @param int $uid + * @param string $category + * @param string $type + * @param int $pm + * @param array $data + * @return BaseDao|Model + */ + public function Bill(int $uid, string $category, string $type, int $pm, array $data) + { + $data['category'] = $category; + $data['type'] = $type; + $data['uid'] = $uid; + $data['pm'] = $pm; + $bill = self::create($data); + if($category == 'now_money'){ + // 暂不发短信 + // Queue::push(SendSmsJob::class,['tempId' => 'USER_BALANCE_CHANGE','id' => $bill->bill_id]); + } + return $bill; + } + + + // protected function getModel(): string + // { + // return UserBill::class; + // } + + /** + * 获取查询用户保证金帐单记录 + * @param array $where 查询条件 + * @param int $page 当前页 + * @param int $limit 每页记录数 + * + * @return array + */ + public function GetList($where, $page, $limit) + { + $query = self::SearchJoin($where)->order('a.create_time DESC'); + $count = $query->count(); + $list = $query->page($page, $limit)->select(); + + return compact('count', 'list'); + } + + /** + * @param array $where + * @param $data + * @return int + * @throws \think\db\exception\DbException + * @author xaboy + * @day 2020/6/22 + */ + public function updateBill(array $where, $data) + { + return UserBill::where($where)->limit(1)->update($data); + } + + + /** + * 查询历史佣金记录 + * + * @param $time + * @return \think\Collection + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author xaboy + * @day 2020/6/22 + */ + public function getTimeoutBrokerageBill($time) + { + return UserBill::where('create_time', '<=', $time)->where('category', 'brokerage') + ->whereIn('type', ['order_one', 'order_two'])->with('user')->where('status', 0)->select(); + } + + /** + * 查询历史积分记录 + */ + public function getTimeoutIntegralBill($time) + { + return UserBill::where('create_time', '<=', $time)->where('category', 'integral') + ->where('type', 'lock')->with('user')->where('status', 0)->select(); + } + + public function getTimeoutMerchantMoneyBill($time) + { + return UserBill::where('create_time', '<=', $time)->where('category', 'mer_computed_money')->where('type','order') + ->where('status', 0)->select(); + } + + public function refundMerchantMoney($order_id, $type, $mer_id) + { + return UserBill::where('link_id', $order_id)->where('mer_id', $mer_id) + ->where('category', 'mer_refund_money')->where('type', $type)->sum('number'); + } + + public function merchantLickMoney($merId = null) + { + $lst = UserBill::where('category', 'mer_lock_money')->when($merId, function ($query, $val) { + $query->where('mer_id', $val); + })->where('status', 0)->select()->toArray(); + $lockMoney = 0; + if (count($lst)) { + $lockMoney = -1 * UserBill::whereIn('link_id', array_column($lst, 'link_id')) + ->where('category', 'mer_refund_money')->sum('number'); + } + foreach ($lst as $bill) { + $lockMoney = bcadd($lockMoney, $bill['number'], 2); + } + $lockMoney = bcadd($lockMoney, UserBill::getDB() + ->where('category', 'mer_computed_money')->when($merId, function ($query, $val) { + $query->where('mer_id', $val); + })->where('status', 0)->where('type', 'order')->sum('number'), 2); + return $lockMoney; + } + + /** + * @param $uid + * @return float + * @author xaboy + * @day 2020/6/22 + */ + public function lockBrokerage($uid) + { + $lst = UserBill::where('category', 'brokerage') + ->whereIn('type', ['order_one', 'order_two'])->where('uid', $uid)->where('status', 0)->field('link_id,number')->select()->toArray(); + $refundPrice = 0; + if (count($lst)) { + $refundPrice = -1 * UserBill::whereIn('link_id', array_column($lst, 'link_id'))->where('uid', $uid) + ->where('category', 'brokerage')->whereIn('type', ['refund_two', 'refund_one'])->sum('number'); + } + foreach ($lst as $bill) { + $refundPrice = bcadd($refundPrice, $bill['number'], 2); + } + return $refundPrice; + } + + public function lockIntegral($uid = null, $order_id = null) + { + $lst = UserBill::where('category', 'integral') + ->where('type', 'lock')->when($order_id, function ($query, $order_id) { + $query->where('link_id', $order_id); + })->when($uid, function ($query, $uid) { + $query->where('uid', $uid); + })->where('status', 0)->field('link_id,number')->select()->toArray(); + $lockIntegral = 0; + if (count($lst)) { + $lockIntegral = -1 * UserBill::whereIn('link_id', array_column($lst, 'link_id'))->where('uid', $uid) + ->where('category', 'integral')->where('type', 'refund_lock')->sum('number'); + } + foreach ($lst as $bill) { + $lockIntegral = bcadd($lockIntegral, $bill['number'], 0); + } + return $lockIntegral; + } + + public function deductionIntegral($uid) + { + return UserBill::where('uid', $uid) + ->where('category', 'integral')->where('type', 'deduction')->sum('number'); + } + + public function totalGainIntegral($uid) + { + return UserBill::where('uid', $uid) + ->where('category', 'integral')->where('pm', 1)->whereNotIn('type', ['refund', 'cancel'])->sum('number'); + } + + /** + * @param $uid + * @return float + * @author xaboy + * @day 2020/6/22 + */ + public function totalBrokerage($uid) + { + return bcsub(UserBill::where('category', 'brokerage') + ->whereIn('type', ['order_one', 'order_two'])->where('uid', $uid)->sum('number'), + UserBill::where('uid', $uid) + ->where('category', 'brokerage')->whereIn('type', ['refund_two', 'refund_one'])->sum('number'), 2); + } + + /** + * @param $uid + * @return float + * @author xaboy + * @day 2020/6/22 + */ + public function yesterdayBrokerage($uid) + { + return getModelTime(UserBill::where('category', 'brokerage') + ->whereIn('type', ['order_one', 'order_two'])->where('uid', $uid), 'yesterday')->sum('number'); + } + + /** + * @param array $where + * @return \think\db\BaseQuery + * @author xaboy + * @day 2020/6/22 + */ + public function search(array $where) + { + return UserBill::when(isset($where['now_money']) && in_array($where['now_money'], [0, 1, 2]), function ($query) use ($where) { + if ($where['now_money'] == 0) + $query->where('category', 'now_money')->whereIn('type', ['pay_product', 'recharge', 'sys_inc_money', 'sys_dec_money', 'brokerage', 'presell', 'refund']); + else if ($where['now_money'] == 1) + $query->where('category', 'now_money')->whereIn('type', ['pay_product', 'sys_dec_money', 'presell']); + else if ($where['now_money'] == 2) + $query->where('category', 'now_money')->whereIn('type', ['recharge', 'sys_inc_money', 'brokerage', 'refund']); + }) + ->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) { + $query->where('uid', $where['uid'])->where('mer_id', 0); + }) + ->when(isset($where['pm']) && $where['pm'] !== '', function ($query) use ($where) { + $query->where('pm', $where['pm']); + }) + ->when(isset($where['category']) && $where['category'] !== '', function ($query) use ($where) { + $query->where('category', $where['category']); + }) + ->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) { + $query->where('status', $where['status']); + }) + ->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) { + getModelTime($query, $where['date'], 'create_time'); + }) + ->when(isset($where['day']) && $where['day'] !== '', function ($query) use ($where) { + $query->whereDay('create_time', $where['day']); + }) + ->when(isset($where['month']) && $where['month'] !== '', function ($query) use ($where) { + $query->whereMonth('create_time', $where['month']); + }) + ->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where) { + $data = explode('/', $where['type'], 2); + if (count($data) > 1) { + $query->where('category', $data[0])->where('type', $data[1]); + } else { + $query->where('type', $where['type']); + } + }) + ->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) { + $query->where('mer_id', $where['mer_id']); + }) + ->when(isset($where['link_id']) && $where['link_id'] !== '', function ($query) use ($where) { + $query->where('link_id', $where['link_id']); + }); + } + + public function userNowMoneyIncTotal($uid) + { + return $this->search(['uid' => $uid, 'now_money' => 2])->sum('number'); + } + + /** + * 查询用户帐单 + * @param array $where 查询条件 + * @return Query + */ + public function SearchJoin(array $where) + { + $query = UserBill::alias('a')->leftJoin('User b', 'a.uid = b.uid') + ->field('a.bill_id,a.pm,a.title,a.number,a.balance,a.mark,a.create_time,a.status,b.nickname,a.uid,a.category') + ->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) { + $query->where('a.mer_id', $where['mer_id']); + }) + ->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where) { + $data = explode('/', $where['type'], 2); + if (count($data) > 1) { + $query->where('a.category', $data[0])->where('type', $data[1]); + } else { + $query->where('a.type', $where['type']); + } + }) + ->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) { + getModelTime($query, $where['date'], 'a.create_time'); + }) + ->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) { + $query->whereLike('a.uid|b.nickname|a.title', "%{$where['keyword']}%"); + }) + ->when(isset($where['category']) && $where['category'] !== '', function ($query) use ($where) { + $query->where('a.category', $where['category']); + })->where('category', '<>', 'sys_brokerage'); + + return $query; + } + + public function refundBrokerage($order_id, $uid) + { + return UserBill::where('link_id', $order_id)->where('uid', $uid) + ->where('category', 'brokerage')->whereIn('type', ['refund_two', 'refund_one'])->sum('number'); + } + + public function refundIntegral($order_id, $uid) + { + return UserBill::where('link_id', $order_id)->where('uid', $uid) + ->where('category', 'integral')->where('type', 'refund_lock')->sum('number'); + } + + public function validIntegral($uid, $start, $end) + { + $lst = UserBill::where('category', 'integral') + ->where('type', 'lock')->whereBetween('create_time', [$start, $end])->where('uid', $uid)->where('status', 1)->field('link_id,number')->select()->toArray(); + $integral = 0; + if (count($lst)) { + $integral = -1 * UserBill::whereIn('link_id', array_column($lst, 'link_id'))->where('uid', $uid) + ->where('category', 'integral')->where('type', 'refund_lock')->sum('number'); + } + foreach ($lst as $bill) { + $integral = bcadd($integral, $bill['number'], 0); + } + $integral2 = UserBill::where('uid', $uid)->whereBetween('create_time', [$start, $end]) + ->where('category', 'integral')->where('pm', 1)->whereNotIn('type', ['lock', 'refund'])->sum('number'); + $integral3 = UserBill::where('uid', $uid)->whereBetween('create_time', [$start, $end]) + ->where('category', 'integral')->where('type', 'sys_dec')->sum('number'); + return (int)max(bcsub(bcadd($integral, $integral2, 0), $integral3, 0), 0); + } +} diff --git a/app/common/model/merchant/user/UserHistory.php b/app/common/model/merchant/user/UserHistory.php new file mode 100644 index 0000000..6a56744 --- /dev/null +++ b/app/common/model/merchant/user/UserHistory.php @@ -0,0 +1,14 @@ +hasOne(User::class, 'uid', 'uid'); + } + + /** + * @param $value + * @return array + * @author xaboy + * @day 2020-05-09 + */ + public function getLabelIdAttr($value) + { + return $value ? explode(',', $value) : []; + } + + /** + * @param $value + * @return string + * @author xaboy + * @day 2020-05-09 + */ + public function setLabelIdAttr($value) + { + return implode(',', $value); + } + + public function getAuthLabelAttr() + { + return app()->make(UserLabel::class)->whereIn('label_id', $this->label_id)->where('mer_id', $this->mer_id)->where('type', 1)->column('label_id'); + } + + /** + * @param $uid + * @param $mer_id + * @return bool + * @author xaboy + * @day 2020/10/20 + */ + public function isMerUser($uid, $mer_id) + { + return $this->existsWhere(compact('uid', 'mer_id')); + } + + /** + * @param $uid + * @param $mer_id + * @return int + * @throws \think\db\exception\DbException + * @author xaboy + * @day 2020/10/20 + */ + public function updateLastTime($uid, $mer_id) + { + return UserMerchant::where(compact('uid', 'mer_id'))->update([ + 'last_time' => date('Y-m-d H:i:s') + ]); + } + + /** + * @param array $where + * @return mixed + * @author xaboy + * @day 2020/10/20 + */ + public function search(array $where) + { + return UserMerchant::alias('A')->leftJoin('User B', 'A.uid = B.uid') + ->when(isset($where['mer_id']) && $where['mer_id'] !== '', + function ($query) use ($where) { + $query->where('A.mer_id', $where['mer_id']); + } + ) + ->when(isset($where['nickname']) && $where['nickname'], function (BaseQuery $query) use ($where) { + return $query->where('B.nickname', 'like', '%' . $where['nickname'] . '%'); + })->when(isset($where['sex']) && $where['sex'] !== '', function (BaseQuery $query) use ($where) { + return $query->where('B.sex', intval($where['sex'])); + })->when(isset($where['is_promoter']) && $where['is_promoter'] !== '', function (BaseQuery $query) use ($where) { + return $query->where('B.is_promoter', $where['is_promoter']); + })->when(isset($where['uids']), function (BaseQuery $query) use ($where) { + return $query->whereIn('A.uid', $where['uids']); + })->when(isset($where['user_time_type']) && $where['user_time_type'] !== '' && $where['user_time'] != '', function ($query) use ($where) { + if ($where['user_time_type'] == 'visit') { + getModelTime($query, $where['user_time'], 'A.last_time'); + } + if ($where['user_time_type'] == 'add_time') { + getModelTime($query, $where['user_time'], 'A.create_time'); + } + })->when(isset($where['pay_count']) && $where['pay_count'] !== '', function ($query) use ($where) { + if ($where['pay_count'] == -1) { + $query->where('A.pay_num', 0); + } else { + $query->where('A.pay_num', '>', $where['pay_count']); + } + })->when(isset($where['label_id']) && $where['label_id'] !== '', function (BaseQuery $query) use ($where) { + return $query->whereRaw('CONCAT(\',\',A.label_id,\',\') LIKE \'%,' . $where['label_id'] . ',%\''); + })->when(isset($where['user_type']) && $where['user_type'] !== '', function (BaseQuery $query) use ($where) { + return $query->where('B.user_type', $where['user_type']); + })->where('A.status', 1); + } + + public function numUserIds($mer_id, $min, $max = null) + { + return UserMerchant::where('mer_id', $mer_id)->where('pay_num', '>=', $min)->when(!is_null($max), function ($query) use ($max) { + $query->where('pay_num', '<=', $max); + })->group('uid')->column('uid'); + } + + public function priceUserIds($mer_id, $min, $max = null) + { + return UserMerchant::where('mer_id', $mer_id)->where('pay_price', '>=', $min)->when(!is_null($max), function ($query) use ($max, $min) { + $query->where('pay_price', $min == $max ? '<=' : '<', $max); + })->group('uid')->column('uid'); + } +} diff --git a/app/common/model/merchant/user/UserOrder.php b/app/common/model/merchant/user/UserOrder.php new file mode 100644 index 0000000..f6b8c33 --- /dev/null +++ b/app/common/model/merchant/user/UserOrder.php @@ -0,0 +1,14 @@ + +// +---------------------------------------------------------------------- +namespace app\validate\merchant; + + +use think\Validate; + +class MerchantApplymentsValidate extends Validate +{ + protected $failException = true; + + //2401:小微商户,指无营业执照的个人商家。 + //2500:个人卖家,指无营业执照,已持续从事电子商务经营活动满6个月,且期间经营收入累计超过20万元的个人商家。(若选择该主体,请在“补充说明”填写相关描述) + //4:个体工商户,营业执照上的主体类型一般为个体户、个体工商户、个体经营。 + //2:企业,营业执照上的主体类型一般为有限公司、有限责任公司。 + //3:党政、机关及事业单位,包括国内各级、各类政府机构、事业单位等(如:公安、党 团、司法、交通、旅游、工商税务、市政、医疗、教育、学校等机构)。 + //1708:其他组织,不属于企业、政府/事业单位的组织机构(如社会团体、民办非企业、基 金会),要求机构已办理组织机构代码证。 + + protected $rule = [ + 'organization_type|主体类型' => 'require|in:2,3,4,2401,2500,1708', + 'business_license_info|营业执照/登记证书信息' => 'checkBusinessInfo', +// 'organization_cert_info|组织机构代码证信息' => 'checkOrganization', + 'id_doc_type|证件类型' => 'require|in:1,2,3,4,5,6,7,8', + 'id_card_info|经营者/法人身份证信息' => 'checkIdCardInfo', + 'id_doc_info|经营者/法人身份证信息' => 'checkIdDocInfo', +// 'need_account_info|是否填写结算银行账户' => 'require|in:true,false', 废弃字段 + 'account_info|结算银行账户' => 'getAccountInfo', + 'contact_info|超级管理员信息' => 'getContactInfo', + 'sales_scene_info|店铺信息'=>'checkSalesSceneInfo', + 'merchant_shortname|商户简称' => 'require', + 'business_addition_desc' => 'checkBusinessAdditionDesc', + ]; + + /** + * TODO 营业执照/登记证书信息 + * @param $item + * @param $rule + * @param $data + * @return bool|string + * @author Qinii + * @day 6/22/21 + */ + protected function checkBusinessInfo($item,$rule,$data) + { + if(!in_array($data['organization_type'],['2401','2500'])){ + if(empty($item)) return '营业执照/登记证书信息为空'; + + if(!isset($item['business_license_copy']) || empty($item['business_license_copy'])) return '证件扫描件为空'; + if(!isset($item['business_license_number']) || empty($item['business_license_number'])) return '证件注册号为空'; + if(!isset($item['merchant_name']) || empty($item['merchant_name'])) return '商户名称为空'; + if(!isset($item['legal_person']) || empty($item['legal_person'])) return '经营者/法定代表人姓名为空'; + + if(isset($item['business_time'])) { + $statr = $item['business_time'][0]; + $end = $item['business_time'][1]; + if ($end !== '长期') { + $statr = strtotime($statr); + $end = strtotime($end); + $t = $end - $statr; + if (($t / (3600 * 24)) <= 60) return '营业执照/登记证书有效期必须大于60天,即结束时间距当前时间需超过60天'; + } + } + + } + return true; + } + + /** + * TODO 组织机构代码证信息 + * @param $item + * @param $rule + * @param $data + * @return bool|string + * @author Qinii + * @day 6/22/21 + */ + protected function checkOrganization($item,$rule,$data) + { + $len = strlen($data['business_license_info']['business_license_number']); + if(!in_array($data['organization_type'],['4','2401','2500']) && $len === 18){ + if(empty($item)) return '组织机构代码证信息为空'; + + if(!isset($item['organization_copy']) || empty($item['organization_copy'])) return '组织机构代码证照片为空'; + if(!isset($item['organization_number']) || empty($item['organization_number'])) return '组织机构代码为空'; + if(!isset($item['organization_time']) || empty($item['organization_time'])) return '组织机构代码有效期限为空'; + +// list($statr,$end) = explode(',',$item['organization_time']); + + $statr = $item['organization_time'][0]; + $end = $item['organization_time'][1]; + + if($end !== '长期') { + $statr = strtotime($statr); + $end = strtotime($end); + $t = $end - $statr; + if(($t/(3600 * 24)) <= 60) return '组织机构代码证有效期必须大于60天,即结束时间距当前时间需超过60天'; + } + } + return true; + } + + /** + * TODO 经营者/法人身份证信息/身份证 + * @param $item + * @param $rule + * @param $data + * @return bool|string + * @author Qinii + * @day 6/22/21 + */ + protected function checkIdCardInfo($item,$rule,$data) + { + if($data['id_doc_type'] == 1){ + if(empty($item)) return '经营者/法人身份证信息为空'; + + if(!isset($item['id_card_copy']) || empty($item['id_card_copy'])) return '身份证人像面照片为空'; + if(!isset($item['id_card_national']) || empty($item['id_card_national'])) return '身份证国徽面照片为空'; + if(!isset($item['id_card_name']) || empty($item['id_card_name'])) return '身份证姓名为空'; + if(!isset($item['id_card_number']) || empty($item['id_card_number'])) return '身份证号码为空'; + if(!isset($item['id_card_valid_time_begin']) || empty($item['id_card_valid_time_begin'])) return '经营者/法人身份证信息身份证开始时间为空'; + if(!isset($item['id_card_valid_time']) || empty($item['id_card_valid_time'])) return '经营者/法人身份证信息身份证有效期限为空'; + + if($item['id_card_valid_time'] !== '长期') { + $statr = time(); + $end = strtotime($item['id_card_valid_time']); + $t = $end - $statr; + if(($t/(3600 * 24)) <= 60) return '经营者/法人身份证信息证件结束日期必须大于60天,即结束时间距当前时间需超过60天'; + if(strtotime($item['id_card_valid_time_begin']) >= strtotime($item['id_card_valid_time'])) return '经营者/法人身份证信息证件结束日期必须大于证件开始时间'; + } + if($data['organization_type'] === 2){ + if(!isset($item['id_card_address']) || empty($item['id_card_address'])) return '经营者/法人身份证信息身份证居住地址为空'; + } + }; + return true; + } + + /** + * TODO 经营者/法人身份证信息/通行证 + * @param $item + * @param $rule + * @param $data + * @return bool|string + * @author Qinii + * @day 6/22/21 + */ + protected function checkIdDocInfo($item,$rule,$data) + { + if(in_array($data['organization_type'],['2401','2500']) && !empty($item)) return '小微/个人卖家可选证件类型:身份证'; + + if($data['id_doc_type'] !== 1){ + if(empty($item)) return '经营者/法人身份证信息为空'; + + if(!isset($item['id_doc_name']) || empty($item['id_doc_name'])) return '证件姓名为空'; + if(!isset($item['id_doc_number']) || empty($item['id_doc_number'])) return '证件号码为空'; + if(!isset($item['id_doc_copy']) || empty($item['id_doc_copy'])) return '经营者/法人其他类型证件信息证件正面照片为空'; + if($data['id_doc_type'] !== 2) //护照不需要传反面 + { + if(!isset($item['id_doc_copy_back']) || empty($item['id_doc_copy_back'])) return '经营者/法人其他类型证件信息证件反面照片为空'; + } + if(!isset($item['doc_period_begin']) || empty($item['doc_period_begin'])) return '经营者/法人其他类型证件信息证件有效期开始时间为空'; + if(!isset($item['doc_period_end']) || empty($item['doc_period_end'])) return '经营者/法人其他类型证件信息证件结束日期为空'; + + if($item['doc_period_end'] !== '长期') { + $statr = time(); + $end = strtotime($item['doc_period_end']); + $t = $end - $statr; + if(($t/(3600 * 24)) <= 60) return '经营者/法人其他类型证件信息证件结束日期必须大于60天,即结束时间距当前时间需超过60天'; + if(strtotime($item['doc_period_begin']) >= strtotime($item['doc_period_end'])) return '经营者/法人其他类型证件信息证件结束日期必须大于证件开始时间'; + if($data['organization_type'] === 2){ + if(!isset($item['id_doc_address']) || empty($item['id_doc_address'])) return '经营者/法人其他类型证件信息证件居住地址为空'; + } + } + } + + return true; + } + + /** + * TODO 结算银行账户 + * @param $item + * @param $rule + * @param $data + * @return bool|string + * @author Qinii + * @day 6/22/21 + */ + protected function getAccountInfo($item,$rule,$data) + { +// if($data['need_account_info']){ + + if(empty($item)) return '结算银行账户信息为空'; + + if(!isset($item['bank_account_type']) || empty($item['bank_account_type'])) return '账户类型为空'; + if(!isset($item['account_bank']) || empty($item['account_bank'])) return '开户银行为空'; + if(!isset($item['account_name']) || empty($item['account_name'])) return '开户名称为空'; + if(!isset($item['bank_address_code']) || empty($item['bank_address_code'])) return '开户银行省市编码为空'; + if(!isset($item['account_number']) || empty($item['account_number'])) return '银行帐号为空'; + +// } + + return true; + } + + /** + * TODO 超级管理员信息 + * @param $item + * @param $rule + * @param $data + * @return bool|string + * @author Qinii + * @day 6/22/21 + */ + protected function getContactInfo($item,$rule,$data) + { + + if(empty($item)) return '超级管理员信息信息为空'; + + if(!isset($item['contact_type']) || empty($item['contact_type'])) return '超级管理员类型为空'; + if(!isset($item['contact_name']) || empty($item['contact_name'])) return '超级管理员姓名为空'; + if(!isset($item['contact_id_card_number']) || empty($item['contact_id_card_number'])) return '超级管理员身份证件号码为空'; + if(!isset($item['mobile_phone']) || empty($item['mobile_phone'])) return '超级管理员手机为空'; + + if(!in_array($data['organization_type'],['2401','2500'])){ + if(!isset($item['contact_email']) || empty($item['contact_email'])) return '邮箱为空'; + } + + if($item['contact_type'] === 66) //当超级管理员类型为66(经办人时) + { + if(!isset($item['contact_id_doc_type']) || empty($item['contact_id_doc_type']) || !in_array($item['contact_id_doc_type'],[1,2,3,4,5,6,7,8])) return '超级管理员证件类型为空或不合法'; + if(!isset($item['contact_id_doc_copy']) || empty($item['contact_id_doc_copy'])) return '超级管理员信息证件正面照片为空'; + if($item['contact_id_doc_type'] !== 2) //护照不需要传反面 + { + if(!isset($item['contact_id_doc_copy_back']) || empty($item['contact_id_doc_copy_back'])) return '超级管理员信息证件反面照片为空'; + } + if(!isset($item['contact_id_doc_period_begin']) || empty($item['contact_id_doc_period_begin'])) return '超级管理员信息证件有效期开始时间为空'; + if(!isset($item['contact_id_doc_period_end']) || empty($item['contact_id_doc_period_end'])) return '超级管理员信息证件结束日期为空'; + + if($item['contact_id_doc_period_end'] !== '长期') { + $statr = time(); + $end = strtotime($item['contact_id_doc_period_end']); + $t = $end - $statr; + if(($t/(3600 * 24)) <= 60) return '超级管理员信息证件结束日期必须大于60天,即结束时间距当前时间需超过60天'; + if(strtotime($item['contact_id_doc_period_begin']) >= strtotime($item['contact_id_doc_period_end'])) return '超级管理员信息证件结束日期必须大于证件开始时间'; + } + if(!isset($item['business_authorization_letter']) || empty($item['business_authorization_letter'])) return '超级管理员信息业务办理授权函为空'; + } + + return true; + } + + /** + * TODO 店铺信息 + * @param $item + * @param $rule + * @param $data + * @return bool|string + * @author Qinii + * @day 6/22/21 + */ + protected function checkSalesSceneInfo($item,$rule,$data) + { + if(empty($item)) return '店铺信息为空'; + + if(!isset($item['store_name']) || empty($item['store_name'])) return '店铺名称为空'; + + if(!isset($item['store_url']) && !isset($item['store_url'])) return '店铺链接和店铺二维码二选一'; + + return true; + } + + /** + * TODO 补充说明s + * @param $item + * @param $rule + * @param $data + * @return bool|string + * @author Qinii + * @day 6/24/21 + */ + protected function checkBusinessAdditionDesc($item,$rule,$data) + { + if($data['organization_type'] == 2500 && empty($item)) return '若主体为“个人卖家”:补充说明不能为空'; + return true; + } + +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..86aeca2 --- /dev/null +++ b/index.html @@ -0,0 +1,39 @@ + + + + + 恭喜,站点创建成功! + + + +
+

恭喜, 站点创建成功!

+

这是默认index.html,本页面由系统自动生成

+ +
+ + \ No newline at end of file diff --git a/route/app.php b/route/app.php index d8e09e3..c7b4229 100644 --- a/route/app.php +++ b/route/app.php @@ -14,4 +14,4 @@ Route::get('think', function () { return 'hello,ThinkPHP6!'; }); -Route::get('hello/:name', 'index/hello'); +Route::get('hello/:name', 'index/hello'); \ No newline at end of file