mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 05:50:50 +00:00
【程序目录】修复已知问题
This commit is contained in:
parent
cb12734286
commit
35c9c34bac
@ -12,6 +12,7 @@
|
||||
namespace app\adminapi;
|
||||
|
||||
|
||||
use app\exceptions\CommonException;
|
||||
use crmeb\exceptions\AdminException;
|
||||
use crmeb\exceptions\ApiException;
|
||||
use crmeb\exceptions\AuthException;
|
||||
@ -34,6 +35,7 @@ class AdminApiExceptionHandle extends Handle
|
||||
AuthException::class,
|
||||
AdminException::class,
|
||||
ApiException::class,
|
||||
CommonException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@ -86,7 +88,7 @@ class AdminApiExceptionHandle extends Handle
|
||||
// 添加自定义异常处理机制
|
||||
if ($e instanceof DbException) {
|
||||
return app('json')->fail('数据获取失败', $massageData);
|
||||
} elseif ($e instanceof AuthException || $e instanceof ValidateException || $e instanceof ApiException) {
|
||||
} elseif ($e instanceof AuthException || $e instanceof ValidateException || $e instanceof ApiException || $e instanceof CommonException) {
|
||||
return app('json')->make($e->getCode() ? : 400, $e->getMessage());
|
||||
} elseif ($e instanceof AdminException) {
|
||||
return app('json')->fail($e->getMessage(), $massageData);
|
||||
|
||||
@ -122,25 +122,25 @@ if (!function_exists('attr_format')) {
|
||||
for ($i = 0; $i < $count - 1; $i++) {
|
||||
if ($i == 0) $data = $arr[$i]['detail'];
|
||||
//替代变量1
|
||||
$rep1 = $rep4 = [];
|
||||
$rep4 = [];
|
||||
$tmp = [];
|
||||
foreach ($data as $v) {
|
||||
foreach ($arr[$i + 1]['detail'] as $g) {
|
||||
//替代变量2
|
||||
$rep2 = ($i != 0 ? '' : $arr[$i]['value'] . '_$_') . $v . '-$-' . $arr[$i + 1]['value'] . '_$_' . $g;
|
||||
$tmp[] = $rep2;
|
||||
// if ($i == $count - 2) {
|
||||
foreach (explode('-$-', $rep2) as $k => $h) {
|
||||
//替代变量3
|
||||
$rep3 = explode('_$_', $h);
|
||||
//替代变量4
|
||||
$rep4['detail'][$rep3[0]] = $rep3[1] ?? '';
|
||||
}
|
||||
if ($count == count($rep4['detail']))
|
||||
if ($count == count($rep4['detail'])) {
|
||||
$res[] = $rep4;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = $tmp ?? [];
|
||||
$data = $tmp;
|
||||
}
|
||||
} else {
|
||||
$dataArr = [];
|
||||
|
||||
26
crmeb/app/adminapi/lang/zh-cn.php
Normal file
26
crmeb/app/adminapi/lang/zh-cn.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
|
||||
// 商品
|
||||
'product' => [
|
||||
// 更新相关
|
||||
'Please select product category' => '请选择商品分类',
|
||||
'Please enter the product name' => '请输入商品名称',
|
||||
'Please upload the slide image' => '请上传商品轮播图',
|
||||
],
|
||||
|
||||
// 订单
|
||||
'order' => [
|
||||
|
||||
]
|
||||
];
|
||||
@ -173,6 +173,8 @@ class StoreOrderDao extends BaseDao
|
||||
} else {
|
||||
$query->where('refund_status', 0);
|
||||
}
|
||||
})->when(isset($where['is_spread']), function ($query) {
|
||||
$query->where('refund_status', 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -153,6 +153,8 @@ class StoreProductDao extends BaseDao
|
||||
})->when(!isset($where['ids']), function ($query) use ($where) {
|
||||
if (isset($where['timeOrder']) && $where['timeOrder'] == 1) {
|
||||
$query->order('id desc');
|
||||
} else if (isset($where['is_best']) && $where['is_best'] == 1) {
|
||||
$query->order('sales desc,sort desc');
|
||||
} else {
|
||||
$query->order('sort desc,id desc');
|
||||
}
|
||||
@ -223,7 +225,7 @@ class StoreProductDao extends BaseDao
|
||||
->when($limit, function ($query) use ($limit) {
|
||||
$query->limit($limit);
|
||||
})
|
||||
->order(($field == 'is_hot' ? 'sales DESC' : 'sort DESC') . ', id DESC')->select()->toArray();
|
||||
->order((in_array($field, ['is_hot','is_best']) ? 'sales DESC' : 'sort DESC') . ', id DESC')->select()->toArray();
|
||||
|
||||
}
|
||||
|
||||
|
||||
42
crmeb/app/exceptions/CommonException.php
Normal file
42
crmeb/app/exceptions/CommonException.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\exceptions;
|
||||
|
||||
use crmeb\utils\AdminApiErrorCode;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* 公共错误信息
|
||||
* Class CommonException
|
||||
* @package app\exceptions
|
||||
*/
|
||||
class CommonException extends \RuntimeException
|
||||
{
|
||||
public function __construct($message, $code = 0, Throwable $previous = null)
|
||||
{
|
||||
if(is_array($message)){
|
||||
$errInfo = $message;
|
||||
$message = $errInfo[1] ?? '未知错误';
|
||||
if ($code === 0) {
|
||||
$code = $errInfo[0] ?? 400;
|
||||
}
|
||||
}
|
||||
|
||||
// 通过错误获取code 当前方式不支持常量数组
|
||||
$errCode = AdminApiErrorCode::getCode($message);
|
||||
if ($errCode > 0) {
|
||||
$code = $errCode;
|
||||
}
|
||||
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
@ -21,4 +21,6 @@ return [
|
||||
// \think\middleware\TraceDebug::class,
|
||||
//初始化基础中间件
|
||||
\app\http\middleware\BaseMiddleware::class,
|
||||
// 多语言支持
|
||||
\think\middleware\LoadLangPack::class,
|
||||
];
|
||||
|
||||
@ -331,71 +331,201 @@ class DivisionServices extends BaseServices
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取比例
|
||||
* 获取返佣比例佣金比例
|
||||
* 当前方法会将获得的佣金逐步的递减
|
||||
* @param $uid
|
||||
* @param $storeBrokerageRatio
|
||||
* @param $storeBrokerageRatioTwo
|
||||
* @param $isSelfBrokerage
|
||||
* @return array
|
||||
*/
|
||||
public function getDivisionPercent($uid, $storeBrokerageRatio, $storeBrokerageTwo, $isSelfBrokerage)
|
||||
public function getDivisionPercent($uid, $storeBrokerageRatio, $storeBrokerageRatioTwo, $isSelfBrokerage)
|
||||
{
|
||||
$field = ['is_staff', 'is_agent', 'is_division', 'division_percent', 'division_end_time', 'staff_id', 'agent_id', 'division_id'];
|
||||
/** @var UserServices $userServices */
|
||||
$userServices = app()->make(UserServices::class);
|
||||
$userInfo = $userServices->get(['uid' => $uid], $field);
|
||||
if (!$userInfo) throw new ValidateException('用户错误');
|
||||
if ($userInfo['staff_id'] || $userInfo['agent_id'] || $userInfo['division_id']) {
|
||||
$spread_uid = $userServices->getSpreadUid($uid);
|
||||
$spread_uid_two = $userServices->getSpreadUid($spread_uid);
|
||||
$oneSpreadInfo = $userServices->get(['uid' => $spread_uid], $field);
|
||||
if (isset($oneSpreadInfo['is_division']) && $oneSpreadInfo['is_division'] == 1 && $oneSpreadInfo['division_end_time'] > time()) {
|
||||
$storeBrokerageRatio = $isSelfBrokerage ? $storeBrokerageRatio : 0;
|
||||
$userInfo = $userServices->get($uid);
|
||||
if ($userInfo['is_division'] == 1 && $userInfo['division_end_time'] > time()) {
|
||||
/** 自己是事业部 */
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = $oneSpreadInfo['division_percent'] - $storeBrokerageRatio;
|
||||
} elseif (isset($oneSpreadInfo['is_agent']) && $oneSpreadInfo['is_agent'] == 1 && $oneSpreadInfo['division_end_time'] > time()) {
|
||||
$twoSpreadInfo = $userServices->get(['uid' => $userInfo['division_id']], $field);
|
||||
$storeBrokerageRatio = $isSelfBrokerage ? $storeBrokerageRatio : 0;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $oneSpreadInfo['division_percent'] - $storeBrokerageRatio;
|
||||
$divisionPercent = $twoSpreadInfo['division_percent'] - $oneSpreadInfo['division_percent'];
|
||||
} elseif (isset($oneSpreadInfo['is_staff']) && $oneSpreadInfo['is_staff'] == 1) {
|
||||
$twoSpreadInfo = $userServices->get(['uid' => $userInfo['agent_id']], $field);
|
||||
$threeSpreadInfo = $userServices->get(['uid' => $userInfo['division_id']], $field);
|
||||
$storeBrokerageRatio = $isSelfBrokerage ? $storeBrokerageRatio : 0;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = $oneSpreadInfo['division_percent'] - $storeBrokerageRatio;
|
||||
$agentPercent = $twoSpreadInfo['division_percent'] - $oneSpreadInfo['division_percent'];
|
||||
$divisionPercent = $threeSpreadInfo['division_percent'] - $twoSpreadInfo['division_percent'];
|
||||
} elseif (isset($oneSpreadInfo['is_staff']) && $oneSpreadInfo['is_staff'] == 0 && $userServices->value(['uid' => $spread_uid_two], 'is_staff') == 1) {
|
||||
$twoSpreadInfo = $userServices->get(['uid' => $spread_uid_two], $field);
|
||||
$threeSpreadInfo = $userServices->get(['uid' => $userInfo['agent_id']], $field);
|
||||
$fourSpreadInfo = $userServices->get(['uid' => $userInfo['division_id']], $field);
|
||||
$storeBrokerageRatio = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $isSelfBrokerage ? $storeBrokerageTwo : 0;
|
||||
$staffPercent = $isSelfBrokerage ? 0 : $twoSpreadInfo['division_percent'] - $storeBrokerageRatio;
|
||||
$agentPercent = $isSelfBrokerage ? $threeSpreadInfo['division_percent'] - $storeBrokerageRatio - $storeBrokerageTwo : $threeSpreadInfo['division_percent'] - $twoSpreadInfo['division_percent'];
|
||||
$divisionPercent = $fourSpreadInfo['division_percent'] - $threeSpreadInfo['division_percent'];
|
||||
$divisionPercent = 0;
|
||||
} else {
|
||||
$twoSpreadInfo = $userServices->get(['uid' => $userInfo['agent_id']], $field);
|
||||
$threeSpreadInfo = $userServices->get(['uid' => $userInfo['division_id']], $field);
|
||||
$storeBrokerageRatio = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $storeBrokerageTwo;
|
||||
$storeBrokerageOne = 0;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
if (isset($twoSpreadInfo['is_agent']) && $twoSpreadInfo['is_agent'] == 1 && $twoSpreadInfo['division_end_time'] > time()) {
|
||||
$agentPercent = $twoSpreadInfo['division_percent'] - $storeBrokerageRatio - $storeBrokerageTwo;
|
||||
} else {
|
||||
$agentPercent = 0;
|
||||
}
|
||||
if (isset($threeSpreadInfo['is_division']) && $threeSpreadInfo['is_division'] == 1 && $threeSpreadInfo['division_end_time'] > time() && $uid != $threeSpreadInfo['division_id']) {
|
||||
$divisionPercent = $threeSpreadInfo['division_percent'] - ($twoSpreadInfo['division_percent'] ?? 0);
|
||||
} else {
|
||||
$divisionPercent = 0;
|
||||
}
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = 0;
|
||||
}
|
||||
} elseif ($userInfo['is_agent'] == 1 && $userInfo['division_end_time'] > time()) {
|
||||
/** 自己是代理商 */
|
||||
$divisionInfo = $userServices->get($userInfo['division_id']);
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $storeBrokerageOne;
|
||||
} else {
|
||||
$storeBrokerageOne = 0;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = $divisionInfo['division_percent'];
|
||||
}
|
||||
} elseif ($userInfo['is_staff'] == 1 && $userInfo['division_end_time'] > time()) { // 自己是员工
|
||||
/** 自己是员工 */
|
||||
$agentInfo = $userServices->get($userInfo['agent_id']);
|
||||
$divisionInfo = $userServices->get($userInfo['division_id']);
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'] - $storeBrokerageOne;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
} else {
|
||||
$storeBrokerageOne = 0;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'];
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
}
|
||||
return [$storeBrokerageRatio, $storeBrokerageTwo, $staffPercent, $agentPercent, $divisionPercent];
|
||||
} else {
|
||||
return [$storeBrokerageRatio, $storeBrokerageTwo, 0, 0, 0];
|
||||
/** 自己是普通用户 */
|
||||
$staffInfo = $userServices->get($userInfo['staff_id']);
|
||||
$agentInfo = $userServices->get($userInfo['agent_id']);
|
||||
$divisionInfo = $userServices->get($userInfo['division_id']);
|
||||
if ($userInfo['staff_id']) {
|
||||
/** 该用户为员工推广 */
|
||||
if ($userInfo['staff_id'] == $userInfo['spread_uid']) {
|
||||
/** 员工直接下级 */
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = $staffInfo['division_percent'] - $storeBrokerageOne;
|
||||
$agentPercent = $agentInfo['division_percent'] - $staffInfo['division_percent'];
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
} else {
|
||||
$storeBrokerageOne = 0;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = $staffInfo['division_percent'];
|
||||
$agentPercent = $agentInfo['division_percent'] - $staffInfo['division_percent'];
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
}
|
||||
} elseif ($userServices->value(['uid' => $userInfo['spread_uid']], 'spread_uid') == $userInfo['staff_id']) {
|
||||
/** 员工间接下级 */
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $storeBrokerageRatioTwo;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'] - $storeBrokerageOne - $storeBrokerageTwo;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
} else {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = $staffInfo['division_percent'] - $storeBrokerageOne;
|
||||
$agentPercent = $agentInfo['division_percent'] - $staffInfo['division_percent'];
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
}
|
||||
} else {
|
||||
/** 和员工的关系超过两级 */
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $storeBrokerageRatioTwo;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'] - $storeBrokerageOne - $storeBrokerageTwo;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
}
|
||||
} elseif ($userInfo['agent_id']) {
|
||||
/** 该用户为代理商推广 */
|
||||
if ($userInfo['agent_id'] == $userInfo['spread_uid']) {
|
||||
/** 代理商直接下级 */
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'] - $storeBrokerageOne;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
} else {
|
||||
$storeBrokerageOne = 0;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'];
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
}
|
||||
} elseif ($userServices->value(['uid' => $userInfo['spread_uid']], 'spread_uid') == $userInfo['agent_id']) {
|
||||
/** 代理商间接下级 */
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $storeBrokerageRatioTwo;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'] - $storeBrokerageOne - $storeBrokerageTwo;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
} else {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'] - $storeBrokerageOne;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
}
|
||||
} else {
|
||||
/** 和代理商的关系超过两级 */
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $storeBrokerageRatioTwo;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = $agentInfo['division_percent'] - $storeBrokerageRatio - $storeBrokerageTwo;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $agentInfo['division_percent'];
|
||||
}
|
||||
} elseif ($userInfo['division_id']) {
|
||||
/** 该用户为事业部推广 */
|
||||
if ($userInfo['division_id'] == $userInfo['spread_uid']) {
|
||||
/** 事业部直接下级 */
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $storeBrokerageOne;
|
||||
} else {
|
||||
$storeBrokerageOne = 0;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = $divisionInfo['division_percent'];
|
||||
}
|
||||
} elseif ($userServices->value(['uid' => $userInfo['spread_uid']], 'spread_uid') == $userInfo['division_id']) {
|
||||
/** 事业部间接下级 */
|
||||
if ($isSelfBrokerage) {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $storeBrokerageRatioTwo;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $storeBrokerageOne - $storeBrokerageTwo;
|
||||
} else {
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = 0;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $storeBrokerageOne;
|
||||
}
|
||||
} else {
|
||||
/** 和事业部的关系超过两级 */
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $storeBrokerageRatioTwo;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = $divisionInfo['division_percent'] - $storeBrokerageOne - $storeBrokerageTwo;
|
||||
}
|
||||
} else {
|
||||
/** 没有任何代理商关系 */
|
||||
$storeBrokerageOne = $storeBrokerageRatio;
|
||||
$storeBrokerageTwo = $storeBrokerageRatioTwo;
|
||||
$staffPercent = 0;
|
||||
$agentPercent = 0;
|
||||
$divisionPercent = 0;
|
||||
}
|
||||
}
|
||||
return [$storeBrokerageOne, $storeBrokerageTwo, $staffPercent, $agentPercent, $divisionPercent];
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ class DiyServices extends BaseServices
|
||||
}
|
||||
/** @var QrcodeServices $QrcodeService */
|
||||
$QrcodeService = app()->make(QrcodeServices::class);
|
||||
$image = $QrcodeService->getRoutineQrcodePath($id, 0, 6, [], true);
|
||||
$image = $QrcodeService->getRoutineQrcodePath($id, 0, 6, [], false);
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,13 +214,18 @@ class MessageServices extends BaseServices
|
||||
$response = '上级用户不存在';
|
||||
} else if ($loginService->updateUserInfo(['code' => $spreadUid], $userInfo, $is_new)) {
|
||||
//写入扫码记录,返回内容
|
||||
$response = $wechatQrcodeService->wechatQrcodeRecord($qrcodeInfo, $userInfo, $spreadInfo);
|
||||
$response = $wechatQrcodeService->wechatQrcodeRecord($qrcodeInfo, $userInfo, $spreadInfo, 1);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$response = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新关注标识
|
||||
if (!is_string($response)) {
|
||||
$wechatUser->subscribe($message->FromUserName);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
@ -693,8 +693,8 @@ class StoreOrderCreateServices extends BaseServices
|
||||
|
||||
//指定返佣金额
|
||||
if (isset($productInfo['is_sub']) && $productInfo['is_sub'] == 1) {
|
||||
$oneBrokerage = bcmul((string)($productInfo['attrInfo']['brokerage'] ?? '0'), $cartNum, 2);
|
||||
$twoBrokerage = bcmul((string)($productInfo['attrInfo']['brokerage_two'] ?? '0'), $cartNum, 2);
|
||||
$oneBrokerage = $storeBrokerageRatio > 0 ? bcmul((string)($productInfo['attrInfo']['brokerage'] ?? '0'), $cartNum, 2) : 0;
|
||||
$twoBrokerage = $storeBrokerageTwo > 0 ? bcmul((string)($productInfo['attrInfo']['brokerage_two'] ?? '0'), $cartNum, 2) : 0;
|
||||
} else {
|
||||
if ($price) {
|
||||
//一级返佣比例 小于等于零时直接返回 不返佣
|
||||
|
||||
@ -229,7 +229,7 @@ class QrcodeServices extends BaseServices
|
||||
$namePath = 'routine_pay_vip_code.jpg';
|
||||
break;
|
||||
case 6:
|
||||
$page = 'pages/annex/special/index?id=' . $id;
|
||||
$page = 'pages/annex/special/index';
|
||||
$namePath = $id . 'routine_index_code.jpg';
|
||||
break;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ namespace app\services\product\product;
|
||||
|
||||
|
||||
use app\dao\product\product\StoreProductDao;
|
||||
use app\exceptions\CommonException;
|
||||
use app\Request;
|
||||
use app\services\activity\advance\StoreAdvanceServices;
|
||||
use app\services\activity\bargain\StoreBargainServices;
|
||||
@ -39,6 +40,7 @@ use crmeb\exceptions\AdminException;
|
||||
use app\jobs\ProductLogJob;
|
||||
use app\jobs\ProductCopyJob;
|
||||
use crmeb\services\GroupDataService;
|
||||
use crmeb\utils\AdminApiErrorCode;
|
||||
use Lizhichao\Word\VicWord;
|
||||
use think\exception\ValidateException;
|
||||
use think\facade\Config;
|
||||
@ -494,9 +496,11 @@ class StoreProductServices extends BaseServices
|
||||
*/
|
||||
public function save(int $id, array $data)
|
||||
{
|
||||
if (count($data['cate_id']) < 1) throw new AdminException('请选择商品分类');
|
||||
if (!$data['store_name']) throw new AdminException('请输入商品名称');
|
||||
if (count($data['slider_image']) < 1) throw new AdminException('请上传商品轮播图');
|
||||
if (count($data['cate_id']) < 1) throw new CommonException(AdminApiErrorCode::ERR_PLEASE_SELECT_PRODUCT_CATEGORY);
|
||||
if (!$data['store_name']) throw new CommonException(AdminApiErrorCode::ERR_PLEASE_ENTER_THE_PRODUCT_NAME);
|
||||
|
||||
$data['slider_image'] = [];
|
||||
if (count($data['slider_image']) < 1) throw new CommonException(AdminApiErrorCode::ERR_PLEASE_UPLOAD_SLIDER_IMAGE);
|
||||
|
||||
$detail = $data['attrs'];
|
||||
$attr = $data['items'];
|
||||
|
||||
@ -1189,7 +1189,7 @@ class UserBillServices extends BaseServices
|
||||
$storeOrderServices = app()->make(StoreOrderServices::class);
|
||||
[$page, $limit] = $this->getPageValue();
|
||||
$time = [];
|
||||
$where = ['paid' => 1, 'type' => 1, 'spread_or_uid' => $uid, 'pid' => 0];
|
||||
$where = ['paid' => 1, 'type' => 1, 'spread_or_uid' => $uid, 'pid' => 0, 'is_spread' => 1];
|
||||
$list = $storeOrderServices->getlist($where, ['id,order_id,uid,add_time,spread_uid,status,spread_two_uid,one_brokerage,two_brokerage,pay_price,pid'], $page, $limit, ['split']);
|
||||
$result['count'] = $storeOrderServices->count($where + ['pid' => 0]);
|
||||
$time_data = [];
|
||||
|
||||
@ -410,4 +410,16 @@ class WechatUserServices extends BaseServices
|
||||
}
|
||||
return $noBeOpenids;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户关注
|
||||
* @param $openid
|
||||
* @return bool
|
||||
*/
|
||||
public function subscribe($openid): bool
|
||||
{
|
||||
if (!$this->dao->update($openid, ['subscribe' => 1, 'subscribe_time' => time()], 'openid'))
|
||||
throw new AdminException('用户关注失败');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
44
crmeb/crmeb/utils/AdminApiErrorCode.php
Normal file
44
crmeb/crmeb/utils/AdminApiErrorCode.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace crmeb\utils;
|
||||
|
||||
/**
|
||||
* AdminApi错误码统一存放类
|
||||
* Class AdminApiErrorCode
|
||||
* @package crmeb\utils
|
||||
*/
|
||||
class AdminApiErrorCode
|
||||
{
|
||||
// 商品相关
|
||||
|
||||
/** 请选择商品分类 Please select product category 411001 */
|
||||
const ERR_PLEASE_SELECT_PRODUCT_CATEGORY = [411001, 'product.Please select product category'];
|
||||
|
||||
/** 请输入商品名称 Please enter the product name* code:411002 */
|
||||
const ERR_PLEASE_ENTER_THE_PRODUCT_NAME = 'product.Please enter the product name';
|
||||
|
||||
/** 请上传商品轮播图 Please upload the slide image code:411003 */
|
||||
const ERR_PLEASE_UPLOAD_SLIDER_IMAGE = 'product.Please upload the slide image';
|
||||
|
||||
public static $code = [
|
||||
'product.Please enter the product name' => 411002,
|
||||
'product.Please upload the slide image' => 411003,
|
||||
];
|
||||
|
||||
public static function getCode($msg = ''): int
|
||||
{
|
||||
if (isset(self::$code[$msg])) {
|
||||
return self::$code[$msg];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user