Merge branch 'feature/purchase_record' into dev
This commit is contained in:
commit
e67553fc92
@ -15,6 +15,7 @@ namespace app\common\repositories\store\order;
|
|||||||
|
|
||||||
|
|
||||||
use app\common\dao\store\order\StoreRefundOrderDao;
|
use app\common\dao\store\order\StoreRefundOrderDao;
|
||||||
|
use app\common\model\store\order\StoreGroupOrder;
|
||||||
use app\common\model\store\order\StoreOrder;
|
use app\common\model\store\order\StoreOrder;
|
||||||
use app\common\model\store\order\StoreRefundOrder;
|
use app\common\model\store\order\StoreRefundOrder;
|
||||||
use app\common\model\system\merchant\FinancialRecord;
|
use app\common\model\system\merchant\FinancialRecord;
|
||||||
@ -268,6 +269,9 @@ class StoreRefundOrderRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function refunds(StoreOrder $order, array $ids, $uid, array $data)
|
public function refunds(StoreOrder $order, array $ids, $uid, array $data)
|
||||||
{
|
{
|
||||||
|
if ($order->pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY && $order->status == 2) {
|
||||||
|
throw new ValidateException('已收货的订单不支持退款');
|
||||||
|
}
|
||||||
$orderId = $order->order_id;
|
$orderId = $order->order_id;
|
||||||
$products = app()->make(StoreOrderProductRepository::class)->userRefundProducts($ids, $uid, $orderId);
|
$products = app()->make(StoreOrderProductRepository::class)->userRefundProducts($ids, $uid, $orderId);
|
||||||
if (!$products || count($ids) != count($products))
|
if (!$products || count($ids) != count($products))
|
||||||
@ -331,6 +335,9 @@ class StoreRefundOrderRepository extends BaseRepository
|
|||||||
$data['integral'] = $totalIntegral;
|
$data['integral'] = $totalIntegral;
|
||||||
$data['platform_refund_price'] = $totalPlatformRefundPrice;
|
$data['platform_refund_price'] = $totalPlatformRefundPrice;
|
||||||
$data['refund_postage'] = $totalPostage;
|
$data['refund_postage'] = $totalPostage;
|
||||||
|
if ($order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||||
|
$data['refund_price'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Db::transaction(function () use ($refundProduct, $data, $products, $order, &$refund_order_id) {
|
return Db::transaction(function () use ($refundProduct, $data, $products, $order, &$refund_order_id) {
|
||||||
event('refund.creates.before', compact('data'));
|
event('refund.creates.before', compact('data'));
|
||||||
@ -394,6 +401,9 @@ class StoreRefundOrderRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function refund(StoreOrder $order, $productId, $num, $uid, array $data)
|
public function refund(StoreOrder $order, $productId, $num, $uid, array $data)
|
||||||
{
|
{
|
||||||
|
if ($order->pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY && $order->status == 2) {
|
||||||
|
throw new ValidateException('已收货的订单不支持退款');
|
||||||
|
}
|
||||||
$orderId = $order->order_id;
|
$orderId = $order->order_id;
|
||||||
//TODO 订单状态生成佣金
|
//TODO 订单状态生成佣金
|
||||||
$product = app()->make(StoreOrderProductRepository::class)->userRefundProducts([$productId], $uid, $orderId);
|
$product = app()->make(StoreOrderProductRepository::class)->userRefundProducts([$productId], $uid, $orderId);
|
||||||
@ -464,6 +474,9 @@ class StoreRefundOrderRepository extends BaseRepository
|
|||||||
$data['refund_num'] = $num;
|
$data['refund_num'] = $num;
|
||||||
$data['extension_one'] = $total_extension_one;
|
$data['extension_one'] = $total_extension_one;
|
||||||
$data['extension_two'] = $total_extension_two;
|
$data['extension_two'] = $total_extension_two;
|
||||||
|
if ($order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) {
|
||||||
|
$data['refund_price'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return Db::transaction(function () use ($order, $data, $product, $productId, $num) {
|
return Db::transaction(function () use ($order, $data, $product, $productId, $num) {
|
||||||
event('refund.create.before', compact('data'));
|
event('refund.create.before', compact('data'));
|
||||||
|
@ -2280,9 +2280,9 @@ class ProductRepository extends BaseRepository
|
|||||||
$supplierMerId = 0;
|
$supplierMerId = 0;
|
||||||
if (empty($params['product_id']) && !empty($params['order_product_id'])) {
|
if (empty($params['product_id']) && !empty($params['order_product_id'])) {
|
||||||
//有商品无规格或者无商品无规格,导入商品和规格
|
//有商品无规格或者无商品无规格,导入商品和规格
|
||||||
$product = Db::name('store_product')->where('source_product_id', $params['order_product_id'])->where('mer_id', $merId)->find();
|
$product = $this->getWhere(['source_product_id' => $params['order_product_id'], 'mer_id' => $merId]);
|
||||||
if (!empty($product)) {
|
if (!empty($product)) {
|
||||||
$unique = $this->importAttrValue($params['order_product_id'], $product, $params['order_unique']);
|
$unique = $this->importAttrValue($params['order_product_id'], $product->toArray(), $params['order_unique']);
|
||||||
if (!$unique) {
|
if (!$unique) {
|
||||||
throw new \Exception('商品规格导入出错', 500);
|
throw new \Exception('商品规格导入出错', 500);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ class Merchant extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function apply($merId){
|
public function apply($merId){
|
||||||
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type,is_frozen')->find();
|
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type')->find();
|
||||||
if (($msg = $this->checkAuth($merchant)) !== true) {
|
if (($msg = $this->checkAuth($merchant)) !== true) {
|
||||||
return app('json')->fail($msg);
|
return app('json')->fail($msg);
|
||||||
}
|
}
|
||||||
@ -283,7 +283,7 @@ class Merchant extends BaseController
|
|||||||
public function createApply($merId)
|
public function createApply($merId)
|
||||||
{
|
{
|
||||||
$data = $this->request->param(['extract_money','financial_type', 'financial_bank_name', 'financial_bank_bank', 'financial_bank_code', 'financial_bank_branch']);
|
$data = $this->request->param(['extract_money','financial_type', 'financial_bank_name', 'financial_bank_bank', 'financial_bank_code', 'financial_bank_branch']);
|
||||||
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('reg_admin_id,uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type,is_frozen')->find();
|
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('reg_admin_id,uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type')->find();
|
||||||
if (($msg = $this->checkAuth($merchant)) !== true) {
|
if (($msg = $this->checkAuth($merchant)) !== true) {
|
||||||
return app('json')->fail($msg);
|
return app('json')->fail($msg);
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@ class Merchant extends BaseController
|
|||||||
|
|
||||||
public function listApply($merId)
|
public function listApply($merId)
|
||||||
{
|
{
|
||||||
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('reg_admin_id,uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type,is_frozen')->find();
|
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('reg_admin_id,uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type')->find();
|
||||||
if (($msg = $this->checkAuth($merchant)) !== true) {
|
if (($msg = $this->checkAuth($merchant)) !== true) {
|
||||||
return app('json')->fail($msg);
|
return app('json')->fail($msg);
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ class Merchant extends BaseController
|
|||||||
|
|
||||||
public function account($merId)
|
public function account($merId)
|
||||||
{
|
{
|
||||||
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type,is_frozen')->find();
|
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type')->find();
|
||||||
if (($msg = $this->checkAuth($merchant)) !== true) {
|
if (($msg = $this->checkAuth($merchant)) !== true) {
|
||||||
return app('json')->fail($msg);
|
return app('json')->fail($msg);
|
||||||
}
|
}
|
||||||
@ -332,7 +332,7 @@ class Merchant extends BaseController
|
|||||||
{
|
{
|
||||||
$data = $this->request->param(['name','bank','bank_code','financial_type']);
|
$data = $this->request->param(['name','bank','bank_code','financial_type']);
|
||||||
app()->make(MerchantFinancialAccountValidate::class)->check($data);
|
app()->make(MerchantFinancialAccountValidate::class)->check($data);
|
||||||
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type,is_frozen')->find();
|
$merchant = app()->make(MerchantRepository::class)->search(['mer_id' => $merId])->field('uid,mer_id,mer_name,mer_money,financial_bank,financial_wechat,financial_alipay,financial_type')->find();
|
||||||
if (($msg = $this->checkAuth($merchant)) !== true) {
|
if (($msg = $this->checkAuth($merchant)) !== true) {
|
||||||
return app('json')->fail($msg);
|
return app('json')->fail($msg);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ declare (strict_types=1);
|
|||||||
|
|
||||||
namespace app\listener;
|
namespace app\listener;
|
||||||
|
|
||||||
|
use app\common\model\store\order\StoreGroupOrder;
|
||||||
use app\common\model\system\merchant\Merchant;
|
use app\common\model\system\merchant\Merchant;
|
||||||
use app\common\repositories\store\order\StoreOrderInterestRepository;
|
use app\common\repositories\store\order\StoreOrderInterestRepository;
|
||||||
|
|
||||||
@ -17,6 +18,9 @@ class OrderCreate
|
|||||||
{
|
{
|
||||||
$groupOrder = $event['groupOrder'];
|
$groupOrder = $event['groupOrder'];
|
||||||
$order = $groupOrder->orderList[0];
|
$order = $groupOrder->orderList[0];
|
||||||
|
if ($order['pay_type'] != StoreGroupOrder::PAY_TYPE_CREDIT_BUY && $order['activity_type'] != 98) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
/** @var StoreOrderInterestRepository $storeOrderInterestRepository */
|
/** @var StoreOrderInterestRepository $storeOrderInterestRepository */
|
||||||
$storeOrderInterestRepository = app()->make(StoreOrderInterestRepository::class);
|
$storeOrderInterestRepository = app()->make(StoreOrderInterestRepository::class);
|
||||||
$merchantId = Merchant::where('uid', $groupOrder['uid'])->value('mer_id');
|
$merchantId = Merchant::where('uid', $groupOrder['uid'])->value('mer_id');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user