diff --git a/404.html b/404.html new file mode 100644 index 00000000..6f17eaf5 --- /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/common/model/store/StoreCategory.php b/app/common/model/store/StoreCategory.php index 1b565c50..5e325c2a 100644 --- a/app/common/model/store/StoreCategory.php +++ b/app/common/model/store/StoreCategory.php @@ -19,6 +19,9 @@ use think\Model; class StoreCategory extends BaseModel { + // 设置当前模型的数据库连接 + protected $connection = 'mysql'; + /** * @return string * @author xaboy diff --git a/app/common/model/store/product/Spu.php b/app/common/model/store/product/Spu.php index 16c03d90..f2df5a5f 100644 --- a/app/common/model/store/product/Spu.php +++ b/app/common/model/store/product/Spu.php @@ -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') diff --git a/app/common/model/system/merchant/Merchant.php b/app/common/model/system/merchant/Merchant.php index 688a4a45..f9314245 100644 --- a/app/common/model/system/merchant/Merchant.php +++ b/app/common/model/system/merchant/Merchant.php @@ -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); diff --git a/app/common/model/system/supplychain/SupplyChain.php b/app/common/model/system/supplychain/SupplyChain.php new file mode 100644 index 00000000..70139318 --- /dev/null +++ b/app/common/model/system/supplychain/SupplyChain.php @@ -0,0 +1,45 @@ + +// +---------------------------------------------------------------------- + + +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'; + } + +} diff --git a/app/common/model/system/supplychain/SupplyChainLinkMerchant.php b/app/common/model/system/supplychain/SupplyChainLinkMerchant.php new file mode 100644 index 00000000..1461e960 --- /dev/null +++ b/app/common/model/system/supplychain/SupplyChainLinkMerchant.php @@ -0,0 +1,65 @@ + +// +---------------------------------------------------------------------- + + +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'); + } +} diff --git a/app/common/repositories/store/product/SpuRepository.php b/app/common/repositories/store/product/SpuRepository.php index e4935d9d..7f7ac641 100644 --- a/app/common/repositories/store/product/SpuRepository.php +++ b/app/common/repositories/store/product/SpuRepository.php @@ -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(); diff --git a/app/controller/api/store/order/StoreCartDg.php b/app/controller/api/store/order/StoreCartDg.php index c317dc92..81f08cbd 100644 --- a/app/controller/api/store/order/StoreCartDg.php +++ b/app/controller/api/store/order/StoreCartDg.php @@ -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']; diff --git a/app/controller/api/store/product/StoreCategory.php b/app/controller/api/store/product/StoreCategory.php index ff461403..931f6e7f 100644 --- a/app/controller/api/store/product/StoreCategory.php +++ b/app/controller/api/store/product/StoreCategory.php @@ -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'])) { diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 13529971..e92d93a9 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -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); } diff --git a/basic/BaseAuth.php b/basic/BaseAuth.php new file mode 100644 index 00000000..f67c68d6 Binary files /dev/null and b/basic/BaseAuth.php differ diff --git a/basic/BaseController.php b/basic/BaseController.php new file mode 100644 index 00000000..3c71dd1a Binary files /dev/null and b/basic/BaseController.php differ diff --git a/basic/BaseManager.php b/basic/BaseManager.php new file mode 100644 index 00000000..cbd1b23f Binary files /dev/null and b/basic/BaseManager.php differ diff --git a/basic/BaseMessage.php b/basic/BaseMessage.php new file mode 100644 index 00000000..152f7265 Binary files /dev/null and b/basic/BaseMessage.php differ diff --git a/basic/BaseStorage.php b/basic/BaseStorage.php new file mode 100644 index 00000000..1beb82b2 Binary files /dev/null and b/basic/BaseStorage.php differ diff --git a/basic/BaseUpload.php b/basic/BaseUpload.php new file mode 100644 index 00000000..9bf89f71 Binary files /dev/null and b/basic/BaseUpload.php differ diff --git a/crmeb/traits/CategoresDao.php b/crmeb/traits/CategoresDao.php index b456c8dd..b9e972df 100644 --- a/crmeb/traits/CategoresDao.php +++ b/crmeb/traits/CategoresDao.php @@ -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(); + } + } /** diff --git a/crmeb/traits/CategoresRepository.php b/crmeb/traits/CategoresRepository.php index 8631f0b4..60c85d1e 100644 --- a/crmeb/traits/CategoresRepository.php +++ b/crmeb/traits/CategoresRepository.php @@ -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()); } diff --git a/index.html b/index.html new file mode 100644 index 00000000..86aeca22 --- /dev/null +++ b/index.html @@ -0,0 +1,39 @@ + + + + + 恭喜,站点创建成功! + + + +
+

恭喜, 站点创建成功!

+

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

+ +
+ + \ No newline at end of file diff --git a/public/nginx.htaccess b/public/nginx.htaccess new file mode 100644 index 00000000..e69de29b