Merge branch 'dev' of https://gitea.lihaink.cn/mkm/shop-new into dev
This commit is contained in:
commit
507cba099c
@ -106,7 +106,7 @@ class StoreOrderDao extends BaseDao
|
||||
}
|
||||
})
|
||||
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
|
||||
$query->where('uid', $where['uid']);
|
||||
$query->where('StoreOrder.uid', $where['uid']);
|
||||
})
|
||||
->when(isset($where['is_spread']) && $where['is_spread'] !== '', function ($query) use ($where) {
|
||||
if ($where['is_spread']) {
|
||||
@ -300,7 +300,7 @@ class StoreOrderDao extends BaseDao
|
||||
|
||||
})
|
||||
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
|
||||
$query->where('uid', $where['uid']);
|
||||
$query->where('StoreOrder.uid', $where['uid']);
|
||||
})
|
||||
->when(isset($where['is_user']) && $where['is_user'] !== '', function ($query) use ($where) {
|
||||
$query->where(function ($query) {
|
||||
|
20
app/common/model/system/GeoStreet.php
Normal file
20
app/common/model/system/GeoStreet.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\system;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
class GeoStreet extends BaseModel
|
||||
{
|
||||
|
||||
|
||||
public static function tablePk(): string
|
||||
{
|
||||
return 'street_id';
|
||||
}
|
||||
|
||||
public static function tableName(): string
|
||||
{
|
||||
return 'geo_street';
|
||||
}
|
||||
}
|
@ -23,7 +23,9 @@ use app\common\model\store\product\Spu;
|
||||
use app\common\model\store\service\StoreService;
|
||||
use app\common\model\system\config\SystemConfigValue;
|
||||
use app\common\model\system\financial\Financial;
|
||||
use app\common\model\system\GeoStreet;
|
||||
use app\common\model\system\serve\ServeOrder;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\store\StoreActivityRepository;
|
||||
|
||||
class Merchant extends BaseModel
|
||||
@ -271,4 +273,19 @@ class Merchant extends BaseModel
|
||||
{
|
||||
$query->whereIn('mer_id',$value);
|
||||
}
|
||||
|
||||
public function street()
|
||||
{
|
||||
return $this->hasOne(GeoStreet::class, 'street_code', 'street_id');
|
||||
}
|
||||
|
||||
public function promoter()
|
||||
{
|
||||
$spreadId = User::where('uid', $this->uid)->value('spread_uid');
|
||||
if ($spreadId > 0) {
|
||||
return User::where('uid', $spreadId)->field('uid,nickname')->find();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,9 +75,9 @@ use think\model\Relation;
|
||||
class StoreOrderRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* 支付类型 0余额 1 微信 2 小程序 3 微信 4 支付宝 5 支付宝 6 微信
|
||||
* 支付类型 0余额 1 微信 2 小程序 3 微信 4 支付宝 5 支付宝 6 微信 7 四川农信 8 信用购 9 商户余额
|
||||
*/
|
||||
const PAY_TYPE = ['balance', 'weixin', 'routine', 'h5', 'alipay', 'alipayQr', 'weixinQr'];
|
||||
const PAY_TYPE = ['balance', 'weixin', 'routine', 'h5', 'alipay', 'alipayQr', 'weixinQr', 'scrcu', 'creditBuy', 'merBalance'];
|
||||
const PAY_TYPE_FILTEER = [
|
||||
0 => 0,
|
||||
1 => '1,2,3,6',
|
||||
@ -204,8 +204,6 @@ class StoreOrderRepository extends BaseRepository
|
||||
$flag = true;
|
||||
$finance = [];
|
||||
$profitsharing = [];
|
||||
$financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
$financeSn = $financialRecordRepository->getSn();
|
||||
$userMerchantRepository = app()->make(UserMerchantRepository::class); //商户用户表
|
||||
$storeOrderProfitsharingRepository = app()->make(StoreOrderProfitsharingRepository::class);
|
||||
$storeGroupOrderRepository = app()->make(StoreGroupOrderRepository::class);
|
||||
@ -253,8 +251,10 @@ class StoreOrderRepository extends BaseRepository
|
||||
//更新助力状态
|
||||
app()->make(ProductAssistSetRepository::class)->changStatus($order->orderProduct[0]['activity_id']);
|
||||
}
|
||||
if ($order->order_type == 1 && $order->status != 10)
|
||||
if ($order->order_type == 1 && $order->status != 10) {
|
||||
$order->verify_code = $this->verifyCode();
|
||||
$order->logistics_code = random_int(1000, 9999);
|
||||
}
|
||||
if ($order->orderProduct[0]->product->type == 2) {
|
||||
$order->status = 2;
|
||||
$order->delivery_type = 6;
|
||||
@ -308,10 +308,12 @@ class StoreOrderRepository extends BaseRepository
|
||||
$promoter = $order->merchant->promoter();
|
||||
$promoterCommission = bcmul($orderValidAmount, 0.003, 2);
|
||||
if (!empty($promoter) && $promoterCommission > 0) {
|
||||
$financeDao->user = $promoter;
|
||||
$financeDao->platformOut($promoterCommission, 'commission_to_promoter');
|
||||
}
|
||||
|
||||
// 平台收入手续费
|
||||
$financeDao->user = $groupOrder->user;
|
||||
$commission_rate = bcdiv((string)$order['commission_rate'],'100',6);
|
||||
$platformCommission = bcmul($orderValidAmount, (string)$commission_rate, 2);
|
||||
if ($commission_rate > 0 && $platformCommission > 0) {
|
||||
@ -388,11 +390,11 @@ class StoreOrderRepository extends BaseRepository
|
||||
'pay_price' => Db::raw('pay_price+' . $groupOrder->pay_price),
|
||||
'svip_save_money' => Db::raw('svip_save_money+' . $svipDiscount),
|
||||
]);
|
||||
$financeDao->save();
|
||||
$this->giveIntegral($groupOrder);
|
||||
if (count($profitsharing)) {
|
||||
$storeOrderProfitsharingRepository->insertAll($profitsharing);
|
||||
}
|
||||
$financialRecordRepository->insertAll($finance);
|
||||
$storeOrderStatusRepository->batchCreateLog($orderStatus);
|
||||
if (count($groupOrder['give_coupon_ids']) > 0)
|
||||
$groupOrder['give_coupon_ids'] = app()->make(StoreCouponRepository::class)->getGiveCoupon($groupOrder['give_coupon_ids'])->column('coupon_id');
|
||||
|
@ -904,7 +904,7 @@ class MerchantRepository extends BaseRepository
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function deductDeposit($income, $order, FinancialDao $financeDao)
|
||||
public function deductDeposit($income, $order, FinancialRecordDao $financeDao)
|
||||
{
|
||||
$merchant = Merchant::find($this->merId);
|
||||
//商户押金大于支付押金 或者forceMargin==false 直接返回 不计算押金
|
||||
|
Loading…
x
Reference in New Issue
Block a user