|
|
@ -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']); |
|
|
@ -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,7 +192,7 @@ 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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -205,14 +200,4 @@ class Store extends Controller |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |