修改接口:佣金、分类、提现区分供应链、以及普通购物车

This commit is contained in:
monanxiao 2023-03-09 17:51:56 +08:00
parent e971632acc
commit 811d4c48c3
20 changed files with 234 additions and 12 deletions

7
404.html Normal file
View File

@ -0,0 +1,7 @@
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

View File

@ -19,6 +19,9 @@ use think\Model;
class StoreCategory extends BaseModel
{
// 设置当前模型的数据库连接
protected $connection = 'mysql';
/**
* @return string
* @author xaboy

View File

@ -17,6 +17,7 @@ use app\common\model\BaseModel;
use app\common\model\store\coupon\StoreCouponProduct;
use app\common\model\store\StoreSeckillActive;
use app\common\model\system\merchant\Merchant;
use app\common\model\system\supplychain\SupplyChainLinkMerchant;
use think\db\BaseQuery;
class Spu extends BaseModel
@ -163,6 +164,16 @@ class Spu extends BaseModel
{
return $this->hasOne(Merchant::class,'mer_id','mer_id');
}
/**
* 供应链中间件
*
*/
public function supplyChainLink()
{
return $this->hasOne(SupplyChainLinkMerchant::class, 'mer_id', 'eb_merchant_id');
}
public function issetCoupon()
{
return $this->hasOne(StoreCouponProduct::class, 'product_id', 'product_id')->alias('A')

View File

@ -24,6 +24,8 @@ use app\common\model\system\config\SystemConfigValue;
use app\common\model\system\financial\Financial;
use app\common\model\system\serve\ServeOrder;
use app\common\repositories\store\StoreActivityRepository;
use app\common\model\system\supplychain\SupplyChain;
use app\common\model\system\supplychain\SupplyChainLinkMerchant;
class Merchant extends BaseModel
{
@ -53,7 +55,7 @@ class Merchant extends BaseModel
if (!$value) return [];
return explode(',',$value);
}
public function product()
{
return $this->hasMany(Product::class, 'mer_id', 'mer_id');
@ -64,6 +66,7 @@ class Merchant extends BaseModel
return $this->hasMany(SystemConfigValue::class, 'mer_id', 'mer_id');
}
public function showProduct()
{
return $this->hasMany(Product::class, 'mer_id', 'mer_id')
@ -181,6 +184,25 @@ class Merchant extends BaseModel
return $this->merchantType()->bind(['type_name']);
}
/**
* 供应链中间件
*
*/
public function SupplyChainLink()
{
return $this->hasOne(SupplyChainLinkMerchant::class, 'eb_merchant_id', 'mer_id');
}
/**
*
* 关联供应链
*
*/
public function supplyChain()
{
return $this->hasOneThrough(SupplyChain::class, SupplyChainLinkMerchant::class, 'eb_merchant_id', 'id', 'mer_id', 'fa_supply_chain_id');
}
public function getMerCommissionRateAttr()
{
return $this->commission_rate > 0 ? $this->commission_rate : bcmul($this->merchantCategory->commission_rate, 100, 4);

View File

@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\system\supplychain;
use app\common\model\BaseModel;
class SupplyChain extends BaseModel
{
// 设置当前模型的数据库连接
protected $connection = 'nongke';
/**
* @return string
* @author xaboy
* @day 2020-03-30
*/
public static function tablePk(): string
{
return 'id';
}
/**
* @return string
* @author xaboy
* @day 2020-03-30
*/
public static function tableName(): string
{
return 'fa_supply_chain';
}
}

View File

@ -0,0 +1,65 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\system\supplychain;
use app\common\model\BaseModel;
use app\common\model\store\StoreCategory;
class SupplyChainLinkMerchant extends BaseModel
{
// 设置当前模型的数据库连接
protected $connection = 'nongke';
/**
* @return string
* @author xaboy
* @day 2020-03-30
*/
public static function tablePk(): string
{
return 'id';
}
/**
* @return string
* @author xaboy
* @day 2020-03-30
*/
public static function tableName(): string
{
return 'fa_supply_chain_link_merchant';
}
/**
* 所属供应链
* 一对一
*
*/
public function supplyChain()
{
return $this->hasOne(SupplyChain::class, 'id', 'fa_supply_chain_id');
}
/**
*
* 商户下的分类
*
*/
public function category()
{
return $this->hasMany(StoreCategory::class, 'mer_id', 'eb_merchant_id');
}
}

View File

@ -118,11 +118,12 @@ class SpuRepository extends BaseRepository
* @param $page
* @param $limit
* @param $userInfo
* @param $source 请求来源
* @return array
* @author Qinii
* @day 12/18/20
*/
public function getApiSearch($where, $page, $limit, $userInfo = null)
public function getApiSearch($where, $page, $limit, $userInfo = null, $source = 2)
{
if (isset($where['keyword']) && !empty($where['keyword'])) {
if (preg_match('/^(\/@[1-9]{1}).*\*\//', $where['keyword'])) {
@ -137,14 +138,16 @@ class SpuRepository extends BaseRepository
}
$where['spu_status'] = 1;
$where['mer_status'] = 1;
$query = $this->dao->search($where);
$query->with([
'merchant' => function ($query) {
'merchant.supplyChain' => function ($query) {
$query->field($this->merchantFiled)->with(['type_name']);
},
'issetCoupon',
'issetCoupon'
]);
$productMake = app()->make(ProductRepository::class);
$count = $query->count();

View File

@ -106,7 +106,7 @@ class StoreCartDg extends BaseController
$data['product_id'] = $result['product']['product_id'];
break;
case 99: //小组代购
$result = app()->make(ProductGroupRepository::class)->cartCheck($data,$this->request->userInfo());
$result = app()->make(ProductDgRepository::class)->cartCheck($data,$this->request->userInfo());
$data['source'] = $data['product_type'];
$data['source_id'] = $data['group_buying_id'];
$data['product_id'] = $result['product']['product_id'];

View File

@ -38,8 +38,11 @@ class StoreCategory extends BaseController
*/
public function lst()
{
$source = $this->request->param('source'); // 1 小组服务 2 普通来源
$data = $this->repository->getHot(0);
$list = $this->repository->getApiFormatList(0,1);
$list = $this->repository->getApiFormatList(0, 1, $source);
$ret =[];
foreach ($list as $key => $value) {
if (isset($value['children'])) {

View File

@ -60,11 +60,14 @@ class StoreSpu extends BaseController
'merchant_category_id',
'is_good'
]);
// return json($where);;
$where['is_gift_bag'] = 0;
$where['product_type'] = 0;
$where['order'] = $where['order'] ?: 'star';
$source = $this->request->param('source'); // 1 小组服务 2 普通来源
if ($where['is_trader'] != 1) unset($where['is_trader']);
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo, $source);
return app('json')->success($data);
}

BIN
basic/BaseAuth.php Normal file

Binary file not shown.

BIN
basic/BaseController.php Normal file

Binary file not shown.

BIN
basic/BaseManager.php Normal file

Binary file not shown.

BIN
basic/BaseMessage.php Normal file

Binary file not shown.

BIN
basic/BaseStorage.php Normal file

Binary file not shown.

BIN
basic/BaseUpload.php Normal file

Binary file not shown.

View File

@ -12,6 +12,9 @@
namespace crmeb\traits;
use app\common\model\system\supplychain\SupplyChainLinkMerchant;
trait CategoresDao
{
public $path = 'path';
@ -79,11 +82,29 @@ trait CategoresDao
* @return mixed
* @author Qinii
*/
public function getAll($mer_id = 0,$status = null)
{
return $this->getModel()::getDB()->where('mer_id', $mer_id)->when(($status !== null),function($query)use($status){
public function getAll($mer_id = 0,$status = null, $source = 2)
{
// 验证来源 1 小组服务 2 普通来源
if($source == 1)
{
// 获取供应链商户ID
$MerList = SupplyChainLinkMerchant::with(['supplyChain', 'category'])
->hasWhere('supplyChain', ['status' => 1]) // 启用的供应链团队
->group('eb_merchant_id') // 以分类分组
->column('eb_merchant_id');
// 获取供应链商户共同拥有的分类
return $this->getModel()::getDB()->whereIn('mer_id', $MerList)->when(($status !== null),function($query)use($status){
$query->where($this->getStatus(),$status);
})->order('sort DESC,'.$this->getPk().' DESC')->select();
}else{
\think\facade\Log::record('普通访问');
return $this->getModel()::getDB()->where('mer_id', $mer_id)->when(($status !== null),function($query)use($status){
$query->where($this->getStatus(),$status);
})->order('sort DESC,'.$this->getPk().' DESC')->select();
}
}
/**

View File

@ -33,8 +33,8 @@ trait CategoresRepository
* @param null $status
* @return array
*/
public function getApiFormatList($merID,$status = null)
{
public function getApiFormatList($merID,$status = null, $source = 2)
{
return formatCategory($this->dao->getAll($merID,$status)->hidden(['path','level','mer_id','create_time'])->toArray(), $this->dao->getPk());
}

39
index.html Normal file
View File

@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>恭喜,站点创建成功!</title>
<style>
.container {
width: 60%;
margin: 10% auto 0;
background-color: #f0f0f0;
padding: 2% 5%;
border-radius: 10px
}
ul {
padding-left: 20px;
}
ul li {
line-height: 2.3
}
a {
color: #20a53a
}
</style>
</head>
<body>
<div class="container">
<h1>恭喜, 站点创建成功!</h1>
<h3>这是默认index.html本页面由系统自动生成</h3>
<ul>
<li>本页面在FTP根目录下的index.html</li>
<li>您可以修改、删除或覆盖本页面</li>
<li>FTP相关信息请到“面板系统后台 > FTP” 查看</li>
</ul>
</div>
</body>
</html>

0
public/nginx.htaccess Normal file
View File