pull/5/head
wanghousheng 4 months ago
parent c76426b220
commit fd2f3abefa
  1. 2
      app/api/controller/Notify.php
  2. 2
      app/common/library/wxserver/Wholesaler.php
  3. 10
      app/common/model/dealer/Order.php
  4. 2
      app/timer/controller/dealer/Order.php
  5. 6
      app/timer/service/dealer/Order.php

@ -14,7 +14,6 @@ namespace app\api\controller;
use app\api\service\Notify as NotifyService;
use cores\BaseController;
use think\facade\Db;
/**
* 支付成功异步通知接口
@ -43,7 +42,6 @@ class Notify extends BaseController
*/
public function wechatV3(): string
{
Db::table('yoshop_wx_server')->insertGetId(['content' => "进入回调第一步", 'created_at' => date('Y-m-d H:i:s')]);
try {
$NotifyService = new NotifyService;
return $NotifyService->wechatV3();

@ -512,8 +512,6 @@ class Wholesaler
$data['uploaddomain'] = [$domain, 'https://qiniu.shop.royaum.com.cn'];
$data['downloaddomain'] = [$domain, 'https://qiniu.shop.royaum.com.cn'];
$result = $this->curlPost($url, json_encode($data));
Db::table('yoshop_wx_server')->insertGetId(['content' => "设置域名信息", 'created_at' => date('Y-m-d H:i:s')]);
Db::table('yoshop_wx_server')->insertGetId(['content' => $result, 'created_at' => date('Y-m-d H:i:s')]);
$result = json_decode($result, true);
if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') {
return true;

@ -18,7 +18,6 @@ use app\common\library\helper;
use app\common\model\Order as OrderModel;
use app\common\model\OrderGoods as OrderGoodsModel;
use cores\BaseModel;
use think\facade\Db;
use think\model\relation\BelongsTo;
/**
@ -136,8 +135,6 @@ class Order extends BaseModel
$goodsPrice = min($capital['orderPrice'], $goods['total_pay_price']);
// 计算商品实际佣金
$goodsCapital = static::calculateGoodsCapital($setting, $goods, (string)$goodsPrice);
Db::table('yoshop_wx_server')->insertGetId(['content' => 'goodsCapital数据', 'created_at' => date('Y-m-d H:i:s')]);
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($goodsCapital), 'created_at' => date('Y-m-d H:i:s')]);
// 累积分销佣金
$level >= 1 && $capital['first_money'] = helper::bcadd($capital['first_money'], $goodsCapital['first_money']);
$level >= 2 && $capital['second_money'] = helper::bcadd($capital['second_money'], $goodsCapital['second_money']);
@ -158,13 +155,6 @@ class Order extends BaseModel
// 判断是否开启商品单独分销
if (!$goods['is_ind_dealer']) {
// 全局分销比例
$arr = [
'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 1000, 3)),
'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 1000, 3)),
'third_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['third_money'], 1000, 3))
];
Db::table('yoshop_wx_server')->insertGetId(['content' => '全局分销比例', 'created_at' => date('Y-m-d H:i:s')]);
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($arr), 'created_at' => date('Y-m-d H:i:s')]);
return [
'first_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['first_money'], 1000, 3)),
'second_money' => helper::bcmul($goodsPrice, helper::bcdiv($setting['second_money'], 1000, 3)),

@ -14,7 +14,6 @@ namespace app\timer\controller\dealer;
use app\timer\controller\Controller;
use app\timer\service\dealer\Order as DealerOrderService;
use think\facade\Db;
/**
* 定时任务:商城订单
@ -65,7 +64,6 @@ class Order extends Controller
*/
private function grantMoneyEvent()
{
Db::table('yoshop_wx_server')->insertGetId(['content' => '定时任务开始', 'created_at' => date('Y-m-d H:i:s')]);
$service = new DealerOrderService;
$service->grantMoneyEvent($this->storeId);
}

@ -17,7 +17,6 @@ use app\common\service\BaseService;
use app\timer\library\Tools;
use app\timer\model\dealer\Order as DealerOrderModel;
use app\timer\model\dealer\User as DealerUserModel;
use think\facade\Db;
use think\model\Collection;
/**
@ -59,7 +58,6 @@ class Order extends BaseService
$model = new DealerOrderModel;
$orderList = $model->getUnSettledList($storeId);
// 发放分销订单佣金
Db::table('yoshop_wx_server')->insertGetId(['content' => '发放佣金', 'created_at' => date('Y-m-d H:i:s')]);
$this->settlement($storeId, $orderList);
// 记录日志
Tools::taskLogs('DealerOrder', 'grantMoneyEvent', [
@ -79,7 +77,6 @@ class Order extends BaseService
$model = new DealerOrderModel;
$model->transaction(function () use ($storeId, $orderList) {
foreach ($orderList as $order) {
Db::table('yoshop_wx_server')->insertGetId(['content' => '发放分销订单佣金', 'created_at' => date('Y-m-d H:i:s')]);
static::grantMoneyOrder($storeId, $order);
}
});
@ -102,9 +99,6 @@ class Order extends BaseService
}
// 重新计算分销佣金
$capital = DealerOrderModel::getCapitalByOrder($orderItem['order']);
Db::table('yoshop_wx_server')->insertGetId(['content' => '$capital数据', 'created_at' => date('Y-m-d H:i:s')]);
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($capital), 'created_at' => date('Y-m-d H:i:s')]);
// 发放一级分销商佣金
$orderItem['first_user_id'] > 0 && DealerUserModel::grantMoney((int)$orderItem['first_user_id'], (float)$capital['first_money'], $storeId);
// 发放二级分销商佣金

Loading…
Cancel
Save