Files
littleTiger/application/admin/controller/Shop.php
2019-02-28 19:48:21 +08:00

98 lines
3.4 KiB
PHP

<?php
/**
* tpshop
* ============================================================================
* 版权所有 2015-2027 深圳搜豹网络科技有限公司,并保留所有权利。
* 网站地址: http://www.tp-shop.cn
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
* 不允许对程序代码以任何形式任何目的的再发布。
* 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
* ============================================================================
* Author: 当燃
* 拼团控制器
* Date: 2016-06-09
*/
namespace app\admin\controller;
use app\common\model\Shopper;
use think\Loader;
use think\Db;
use think\Page;
class Shop extends Base
{
public function index()
{
header("Content-type: text/html; charset=utf-8");
exit("请联系TPshop官网客服购买高级版支持此功能");
}
/**
* 门店自提点
* @return mixed
*/
public function info()
{
$shop_id = input('shop_id/d');
if ($shop_id) {
$Shop = new \app\common\model\Shop();
$shop = $Shop->where(['shop_id' => $shop_id,'deleted' => 0])->find();
if (empty($shop)) {
$this->error('非法操作');
}
$city_list = Db::name('region')->where(['parent_id'=>$shop['province_id'],'level'=> 2])->select();
$district_list = Db::name('region')->where(['parent_id'=>$shop['city_id']])->select();
$shop_image_list = Db::name('shop_images')->where(['shop_id'=>$shop['shop_id']])->select();
$this->assign('city_list', $city_list);
$this->assign('district_list', $district_list);
$this->assign('shop_image_list', $shop_image_list);
$this->assign('shop', $shop);
}
$province_list = Db::name('region')->where(['parent_id'=>0,'level'=> 1])->cache(true)->select();
$suppliers_list = Db::name("suppliers")->where(['is_check'=>1])->select();
$this->assign('suppliers_list', $suppliers_list);
$this->assign('province_list', $province_list);
return $this->fetch();
}
public function add(){
header("Content-type: text/html; charset=utf-8");
exit("请联系TPshop官网客服购买高级版支持此功能");
}
public function save(){
header("Content-type: text/html; charset=utf-8");
exit("请联系TPshop官网客服购买高级版支持此功能");
}
/**
* 删除
*/
public function delete()
{
$shop_id = input('shop_id/d');
if(empty($shop_id)){
$this->ajaxReturn(['status' => 0, 'msg' => '参数错误']);
}
$Shop = new \app\common\model\Shop();
$shop = $Shop->where(['shop_id'=>$shop_id])->find();
if(empty($shop)){
$this->ajaxReturn(['status' => 0, 'msg' => '非法操作', 'result' => '']);
}
$row = $shop->save(['deleted'=>1]);
if($row !== false){
$this->ajaxReturn(['status' => 1, 'msg' => '删除成功', 'result' => '']);
}else{
$this->ajaxReturn(['status' => 0, 'msg' => '删除失败', 'result' => '']);
}
}
public function shopImageDel()
{
$path = input('filename','');
Db::name('goods_images')->where("image_url",$path)->delete();
}
}