Merge pull request 'dev' (#18) from dev into preview

Reviewed-on: #18
This commit is contained in:
mkm 2023-09-26 21:17:02 +08:00
commit 16f7f0e96b
122 changed files with 180 additions and 23 deletions

View File

@ -58,6 +58,9 @@ class SpuDao extends BaseDao
->when(isset($where['mer_id']) && $where['mer_id'] !== '',function($query)use($where){
$query->where('P.mer_id',$where['mer_id']);
})
->when(isset($where['mer_array_id']),function($query)use($where){
$query->whereIn('P.mer_id',$where['mer_array_id']);
})
->when(isset($where['mer_ids']) && $where['mer_ids'] !== '',function($query)use($where){
$query->whereIn('P.mer_id',$where['mer_ids']);
})

View File

@ -164,7 +164,7 @@ class SpuRepository extends BaseRepository
return compact('count', 'list');
}
public function getApiCloudSearch($where, $page, $limit, $rand = true)
public function getApiCloudSearch($where, $page, $limit, $rand = false)
{
$where = array_merge(Product::searchEnable(), $where);
if (!empty($where['keyword'])) {
@ -178,7 +178,6 @@ class SpuRepository extends BaseRepository
app()->make(UserVisitRepository::class)->searchProduct($this->userInfo ? $this->userInfo['uid'] : 0, $where['keyword'], (int)($where['mer_id'] ?? 0));
}
}
if ($rand) {
$dataKey = sprintf(CloudProduct::CacheKey, $where['mer_id']);
$RedisCacheService = app()->make(RedisCacheService::class);
@ -193,12 +192,11 @@ class SpuRepository extends BaseRepository
unset($where['mer_id'], $where['page']);
$page = 1;
}
$entryMerId = $where['entry_mer_id'] ?? '';
unset($where['entry_mer_id']);
$query = $this->dao->search($where);
$count = $query->count();
$count = $query->fetchSql(false)->count();
$query->with([
'merchant' => function ($query) {
$query->field($this->merchantFiled)->with(['type_name']);

View File

@ -91,7 +91,7 @@ class MerchantType extends BaseController
protected function getValidParams()
{
$data = $this->request->params(['type_name', 'type_info', 'is_margin', 'margin', 'auth', 'description', 'is_allow_apply', 'is_search_display', 'is_sync_prod', 'type_code']);
$data = $this->request->params(['type_name', 'type_info', 'is_margin', 'margin', 'first_margin', 'auth', 'description', 'is_allow_apply', 'is_search_display', 'is_sync_prod', 'type_code']);
$validate = app()->make(MerchantTypeValidate::class);
$validate->check($data);
if ($data['is_margin'] == 1) {

View File

@ -280,6 +280,13 @@ class Auth extends BaseController
if (!$merchant) {
return app('json')->fail('用户店铺异常');
}
$merchantTypeInfo = Db::name('merchant_type')->where('mer_type_id', $merchant['type_id'])->find();
if ($merchantTypeInfo['first_margin'] > 0) {
if (!$merchant['first_margin_status']) {
$merchant['margin'] = $merchantTypeInfo['first_margin'];
}
}
$repository = app()->make(StoreOrderRepository::class);
$orderSn = "bzj" . date('YmdHis') . uniqid();
Db::name('margin_order')->insert([
@ -1360,6 +1367,18 @@ class Auth extends BaseController
return app('json')->success([]);
}
//获取APP菜单
public function miniAppVersion()
{
$version = $this->request->param('version', '');
$queryBuilder = Db::name('miniapp_update');
if ($version) {
$queryBuilder = $queryBuilder->where('version', '>', $version);
}
$appInfo = ($queryBuilder->order('version', 'desc')->fetchSql(false)->find()) ?? (object)[];
return app('json')->success(compact('appInfo'));
}
//根据street_id获取商户信息
public function regionMerchant($street_id)
{
@ -1387,6 +1406,7 @@ class Auth extends BaseController
'meizu',
'moto'
];
Log::info("请求版本参数:" . json_encode(request()->param()));
$type = $this->request->param('type', '-1');
$version = $this->request->param('version', '');
$phoneBrand = $this->request->param('phone_brand', '');
@ -1412,7 +1432,10 @@ class Auth extends BaseController
$queryBuilder = $queryBuilder->where('phone_brand', '');
}
}
$appInfo = ($queryBuilder->order('version', 'desc')->fetchSql(false)->find()) ?? (object)[];
$appInfo = $queryBuilder->order('version', 'desc')->fetchSql(false)->find();
if (empty($appInfo)) {
$appInfo = (Db::name('AppUpdate')->where('type', $type)->where('version', '>', $version)->find()) ?? (object)[];
}
}
return app('json')->success(compact('appInfo'));

View File

@ -262,10 +262,22 @@ class Merchant extends BaseController
{
$id = $this->request->param('id');
if(empty($id)){
return app('json')->fail('参数不能为空');
}
$merchantInfo = Db::name('merchant')->where('mer_id',$id)->field('uid,mer_id,type_id,mer_name,margin,paid_margin,is_margin,first_margin_status')->find();
if(empty($merchantInfo)){
return app('json')->fail('参数错误');
}
$data = Db::name('merchant')->where('mer_id',$id)->field('uid,mer_id,mer_name,margin,paid_margin,is_margin')->find();
return app('json')->success($data);
$merchantInfo['unpaid_margin'] = $merchantInfo['margin'];
$merchantTypeInfo = Db::name('merchant_type')->where('mer_type_id', $merchantInfo['type_id'])->find();
if ($merchantTypeInfo['first_margin'] > 0) {
if ($merchantInfo['first_margin_status']) {
$merchantInfo['margin'] = $merchantInfo['margin'];
} else {
$merchantInfo['margin'] = $merchantTypeInfo['first_margin'];
}
}
return app('json')->success($merchantInfo);
}
public function apply($merId){

View File

@ -155,7 +155,16 @@ class MerchantIntention extends BaseController
}
$intenInfo = Db::name('merchant_intention')->where('mer_intention_id', $merInfo['mer_intention_id'] ?? 0)->where('type', 1)->find();
if (empty($intenInfo)) {
return app('json')->fail('商户状态异常');
// 兼容处理已开通商户
$intenInfo = [
'uid' => $merInfo['uid'],
'mer_id' => $merInfo['mer_id'],
'phone' => $merInfo['mer_phone'],
'mer_name' => $merInfo['mer_name'],
'merchant_category_id' => $merInfo['category_id'],
'mer_type_id' => $merInfo['type_id'],
'is_old_mer' => 1
];
}
$intenInfo['bank_username'] = $data['bank_username'];
@ -203,7 +212,7 @@ class MerchantIntention extends BaseController
return app('json')->success('申请成功');
}
//发送商户入驻申请
//发送商户申请
public function sendMerIntentionApply($data, $postUrl)
{
Log::info("商户申请URL: {$postUrl}");

View File

@ -46,16 +46,18 @@ class CloudWarehouse extends BaseController
*/
public function index()
{
$typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->value('mer_type_id');
$typeTownSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeTownSupplyChain'])->value('mer_type_id');
$params = $this->request->params(['category_id', 'street_code', 'order', ['product_type', 0], 'keyword']);
$search = [
'street_id' => $params['street_code'],
'type_id' => $typeStoreId,
'category_id' => $params['category_id'],
'type_id' => $typeTownSupplyChainId,
'status' => 1,
'is_del' => 0,
'mer_state' => 1,
];
if (!empty($params['category_id'])) {
$search['category_id'] = $params['category_id'];
}
$merchantIds = $this->merchantDao->search($search)->column('mer_id');
[$page, $limit] = $this->getPage();
if (empty($merchantIds)) {
@ -65,11 +67,13 @@ class CloudWarehouse extends BaseController
$entryWhere = [
'street_id' => $params['street_code'],
'type_id' => $typeCloudWarehouseId,
'category_id' => $params['category_id'],
'status' => 1,
'is_del' => 0,
'mer_state' => 1,
];
if (!empty($params['category_id'])) {
$entryWhere['category_id'] = $params['category_id'];
}
$where['entry_mer_id'] = $this->merchantDao->search($entryWhere)->value('mer_id');
$where['keyword'] = $params['keyword'];
$where['mer_ids'] = $merchantIds;

View File

@ -143,18 +143,19 @@ class StoreSpu extends BaseController
]);
if ($where['action']) unset($where['product_type']);
$currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find();
$typeCloudWarehouseId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeCloudWarehouse'])->value('mer_type_id');
$typeTownSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeTownSupplyChain'])->value('mer_type_id');
$where['mer_array_id'][] = $id;
$mer_id = Db::name('merchant')
->where('street_id',$currentMerchant['street_id'])
->where('mer_state',1)
->where('status',1)
->where('category_id',$currentMerchant['category_id'])
->where('type_id', $typeCloudWarehouseId)
->where('type_id', $typeTownSupplyChainId)
->value('mer_id');
if (!$mer_id) {
return app('json')->success(['count'=>0,'list'=>[]]);
if ($mer_id) {
$where['mer_array_id'][] = $mer_id;
}
$where['mer_id'] = $mer_id;
// $where['mer_id'] = $mer_id;
$where['entry_mer_id'] = $id;
$where['is_gift_bag'] = 0;
$where['order'] = $where['order'] ? $where['order'] : 'sort';
@ -171,7 +172,7 @@ class StoreSpu extends BaseController
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['common','mer_id']);
$typeStoreId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeStore'])->value('mer_type_id');
$typeTownSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeTownSupplyChain'])->value('mer_type_id');
$where['is_gift_bag'] = 0;
//1:星级
//2:用户收藏
@ -197,7 +198,7 @@ class StoreSpu extends BaseController
}
$where['product_type'] = 0;
$where['is_stock'] = 1;
$where['mer_ids'] = Merchant::getInstance()->where('type_id', $typeStoreId)
$where['mer_ids'] = Merchant::getInstance()->where('type_id', $typeTownSupplyChainId)
->where(['status' => 1, 'mer_state' => 1, 'is_del' => 0])->column('mer_id');
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
return app('json')->success($data);

View File

@ -22,6 +22,7 @@ class paySuccessMargin
'pay_time' => date('Y-m-d H:i:s')
]);
$merchantInfo = Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->find();
$paidMarginAmount = (float)$merchantInfo['paid_margin'] + (float)$marginInfo['total_price'];
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([
'paid_margin' => $paidMarginAmount
@ -30,6 +31,15 @@ class paySuccessMargin
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([
'margin' => $marginAmount
]);
$merchantTypeInfo = Db::name('merchant_type')->where('mer_type_id', $merchantInfo['type_id'])->find();
if ($merchantTypeInfo['first_margin'] > 0) {
if (!$merchantInfo['first_margin_status'] && ($marginInfo['total_price'] <= $merchantTypeInfo['first_margin'])) {
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([
'first_margin_status' => 1
]);
}
}
if ($marginAmount <= 0) {
Db::name('merchant')->where('mer_id', $marginInfo['mer_id'] ?? 0)->where('uid', $marginInfo['uid'] ?? 0)->update([
'is_margin' => 10

BIN
public/static/applet/fl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/static/applet/jy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
public/static/applet/ny.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/static/applet/qg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
public/static/applet/yz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
public/static/applet/zz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 956 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More