wang hou sheng 7 months ago
parent 9887082516
commit 4b5df7cbc2
  1. 49
      app/api/controller/Store.php
  2. 2
      app/common/enum/ServerEnum.php

@ -12,18 +12,17 @@ declare (strict_types=1);
namespace app\api\controller; namespace app\api\controller;
use app\api\service\Store as StoreService;
use app\api\service\User as UserService; use app\api\service\User as UserService;
use app\api\validate\store\Store as StoreValidte;
use app\common\model\PriceSet;
use app\common\model\Store as StoreInfoModel;
use app\store\model\store\Address as AddressModel; use app\store\model\store\Address as AddressModel;
use think\response\Json;
use app\api\service\Store as StoreService;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;
use think\db\exception\DbException; use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException; use think\db\exception\ModelNotFoundException;
use app\api\validate\store\Store as StoreValidte; use think\response\Json;
use \app\common\model\Store as StoreInfoModel;
use app\common\model\UploadFile;
use app\common\model\PriceSet;
use think\Db;
/** /**
* 商城基础信息 * 商城基础信息
* Class Store * Class Store
@ -107,19 +106,14 @@ class Store extends Controller
if (!$upData) { if (!$upData) {
return $this->renderSuccess('ok'); return $this->renderSuccess('ok');
} }
StoreInfoModel::where('store_id',$storeid)->update($upData); StoreInfoModel::where('store_id', $storeid)->update($upData);
return $this->renderSuccess('ok'); return $this->renderSuccess('ok');
} }
public function getStoreInfo(): Json public function getStoreInfo(): Json
{ {
$storeid = request()->header()['storeid']; $storeid = request()->header()['storeid'];
$info = StoreInfoModel::detail($storeid);
$info = StoreInfoModel::where('store_id',$storeid)->find()->toArray();
$file = UploadFile::where('file_id', $info['group_share_img_id'])->field('file_path,domain')->find();
$info['group_share_img'] = getUrl($file['file_path'], $file['domain']);
$file1 = UploadFile::where('file_id', $info['logo_image_id'])->field('file_path,domain')->find();
$info['logo_image'] = getUrl($file1['file_path'], $file1['domain']);
return $this->renderSuccess($info); return $this->renderSuccess($info);
} }
@ -142,7 +136,7 @@ class Store extends Controller
// var_dump($params); // var_dump($params);
// exit(); // exit();
//先删除 //先删除
PriceSet::where('store_id', $storeid)->where('type', $params['type']??0)->delete(); PriceSet::where('store_id', $storeid)->where('type', $params['type'] ?? 0)->delete();
$inDatas = []; $inDatas = [];
foreach ($params['list'] as $value) { foreach ($params['list'] as $value) {
$categorys = explode(",", $value['category']); $categorys = explode(",", $value['category']);
@ -162,8 +156,8 @@ class Store extends Controller
$inDatas[] = $temp; $inDatas[] = $temp;
} }
} }
} }
// echo "<pre>"; // echo "<pre>";
// print_r($inDatas); // print_r($inDatas);
@ -172,11 +166,12 @@ class Store extends Controller
$model->addAll($inDatas); $model->addAll($inDatas);
return $this->renderSuccess('ok'); return $this->renderSuccess('ok');
} }
//加个设置回显 //加个设置回显
public function getStorePriceInfo(int $type): Json public function getStorePriceInfo(int $type): Json
{ {
$storeid = request()->header()['storeid']; $storeid = request()->header()['storeid'];
$list = PriceSet::where('store_id',$storeid)->where('type', $type)->field('category,code,min,max,add_price_rate')->group("category, min")->select()->toArray(); $list = PriceSet::where('store_id', $storeid)->where('type', $type)->field('category,code,min,max,add_price_rate')->group("category, min")->select()->toArray();
$data = []; $data = [];
$arr = []; $arr = [];
foreach ($list as $value) { foreach ($list as $value) {
@ -197,22 +192,12 @@ class Store extends Controller
{ {
$storeid = request()->header()['storeid']; $storeid = request()->header()['storeid'];
$categoryIds = [1001,1002]; $categoryIds = [1001, 1002];
$list = PriceSet::distributionPrice(90, 50, $categoryIds); $list = PriceSet::distributionPrice(90, 50, $categoryIds);
return $this->renderSuccess($list);
}
return $this->renderSuccess($list);
}
} }

@ -4,7 +4,7 @@ namespace app\common\enum;
class ServerEnum extends EnumBasics class ServerEnum extends EnumBasics
{ {
// 待付款 // 待付款 10待付款20待指派30待上门40已完成50已取消
const APPLYPAY = 10; const APPLYPAY = 10;
// 待派单 // 待派单
const APPLYDISPATCH = 20; const APPLYDISPATCH = 20;

Loading…
Cancel
Save