Merge branch 'v5.1.0dev' into v5.1.0-el

# Conflicts:
#	template/admin/src/components/linkaddress/index.vue
#	template/admin/src/components/uploadPictures/index.vue
#	template/admin/src/pages/finance/financialRecords/recharge/index.vue
#	template/admin/src/pages/kefu/pc/components/delivery.vue
#	template/admin/src/pages/kefu/pc/index.vue
#	template/admin/src/pages/marketing/point_statistic/index.vue
#	template/admin/src/pages/marketing/storeCouponIssue/create.vue
#	template/admin/src/pages/marketing/storeCouponIssue/index.vue
#	template/admin/src/pages/marketing/storeIntegralOrder/components/tableExpand.vue
#	template/admin/src/pages/notify/smsConfig/components/register.vue
#	template/admin/src/pages/notify/smsConfig/index.vue
#	template/admin/src/pages/order/invoice/index.vue
#	template/admin/src/pages/order/orderList/components/tableFrom.vue
#	template/admin/src/pages/order/orderList/components/tableList.vue
#	template/admin/src/pages/order/orderList/handle/orderDetails.vue
#	template/admin/src/pages/order/orderList/handle/orderSend.vue
#	template/admin/src/pages/product/productAdd/index.vue
#	template/admin/src/pages/product/productAdd/taoBao.vue
#	template/admin/src/pages/product/productList/taoBao.vue
#	template/admin/src/pages/setting/devise/list.vue
#	template/admin/src/pages/setting/freight/index.vue
#	template/admin/src/pages/setting/storage/index.vue
#	template/admin/src/pages/setting/user/index.vue
#	template/admin/src/pages/system/systemMenus/components/menusFrom.vue
#	template/admin/src/pages/system/systemMenus/index.vue
#	template/admin/src/pages/user/grade/card/index.vue
#	template/admin/src/styles/style.css
#	template/uni-app/pages/index/diy/components/pictureCube.vue
This commit is contained in:
From-wh 2023-07-04 16:15:51 +08:00
commit 0bc05d6f19
2678 changed files with 82886 additions and 16356 deletions

View File

@ -1,5 +1,5 @@
version=CRMEB-KY v5.0.0
version_code=500
version=CRMEB-KY v5.1.0
version_code=510
platform=gitee
app_id=ze7x9rxsv09l6pvsyo
app_key=fuF7U9zaybLa5gageVQzxtxQMFnvU2OI

View File

@ -33,7 +33,8 @@ class Request extends \think\Request
* 不过滤变量名
* @var array
*/
protected $except = ['menu_path', 'api_url', 'unique_auth', 'description', 'custom_form', 'content'];
protected $except = ['menu_path', 'api_url', 'unique_auth',
'description', 'custom_form', 'content', 'tableField'];
/**
* 获取请求的数据

View File

@ -17,6 +17,7 @@ use crmeb\exceptions\ApiException;
use crmeb\exceptions\AuthException;
use think\db\exception\DbException;
use think\exception\Handle;
use think\exception\HttpResponseException;
use think\exception\ValidateException;
use think\facade\Env;
use think\facade\Log;
@ -81,6 +82,9 @@ class AdminApiExceptionHandle extends Handle
*/
public function render($request, Throwable $e): Response
{
if ($e instanceof HttpResponseException) {
return parent::render($request, $e);
}
$massageData = Env::get('app_debug', false) ? [
'message' => $e->getMessage(),
'file' => $e->getFile(),

View File

@ -12,6 +12,8 @@
namespace app\adminapi\controller;
use app\Request;
use app\services\system\attachment\SystemAttachmentServices;
use crmeb\services\CacheService;
use think\Response;
@ -44,4 +46,29 @@ class PublicController
{
return app('json')->success(getWorkerManUrl());
}
/**
* 扫码上传
* @param Request $request
* @param int $upload_type
* @param int $type
* @return Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function scanUpload(Request $request, $upload_type = 0, $type = 0)
{
[$file, $uploadToken, $pid] = $request->postMore([
['file', 'file'],
['uploadToken', ''],
['pid', 0]
], true);
$service = app()->make(SystemAttachmentServices::class);
if ($service->cacheDriver()->get('scan_upload') != $uploadToken) {
return app('json')->fail(410086);
}
$service->upload($pid, $file, $upload_type, $type, '', $uploadToken);
return app('json')->success(100032);
}
}

File diff suppressed because one or more lines are too long

View File

@ -43,7 +43,8 @@ class SystemAttachment extends AuthController
public function index()
{
$where = $this->request->getMore([
['pid', 0]
['pid', 0],
['real_name', '']
]);
return app('json')->success($this->service->getImageList($where));
}
@ -135,4 +136,66 @@ class SystemAttachment extends AuthController
$res = $this->service->videoUpload($data, $_FILES['file']);
return app('json')->success($res);
}
/**
* 获取扫码上传页面链接以及参数
* @return \think\Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function scanUploadQrcode()
{
[$pid] = $this->request->getMore([
['pid', 0]
], true);
$uploadToken = md5(time());
$this->service->cacheDriver()->set('scan_upload', $uploadToken, 600);
$url = sys_config('site_url') . '/app/upload?pid=' . $pid . '&token=' . $uploadToken;
return app('json')->success(['url' => $url]);
}
/**
* 删除二维码
* @return \think\Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/6/26
*/
public function removeUploadQrcode()
{
$this->service->cacheDriver()->delete('scan_upload');
return app('json')->success();
}
/**
* 获取扫码上传的图片数据
* @param $scan_token
* @return \think\Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function scanUploadImage($scan_token)
{
return app('json')->success($this->service->scanUploadImage($scan_token));
}
/**
* 网络图片上传
* @return \think\Response
* @throws \Exception
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function onlineUpload()
{
$data = $this->request->postMore([
['pid', 0],
['images', []]
]);
$this->service->onlineUpload($data);
return app('json')->success(100032);
}
}

View File

@ -38,15 +38,20 @@ class SystemAttachmentCategory extends AuthController
/**
* 显示资源列表
* @return mixed
* @return \think\Response
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
$where = $this->request->getMore([
['name', ''],
['pid', 0]
['pid', 0],
['all', 0]
]);
if ($where['name'] != '') $where['pid'] = '';
if ($where['name'] != '' || $where['all'] == 1) $where['pid'] = '';
return app('json')->success($this->service->getAll($where));
}

View File

@ -43,7 +43,8 @@ class Express extends AuthController
public function index()
{
$where = $this->request->getMore([
['keyword', '']
['keyword', ''],
['is_show', '']
]);
return app('json')->success($this->services->getExpressList($where));
}

View File

@ -242,7 +242,7 @@ class StoreOrder extends AuthController
['delivery_id', ''],//快递单号
['delivery_code', ''],//快递公司编码
['express_record_type', 2],//发货记录类型
['express_record_type', 2],//发货记录类型:2=电子面单;3=商家寄件
['express_temp_id', ""],//电子面单模板
['to_name', ''],//寄件人姓名
['to_tel', ''],//寄件人电话
@ -252,7 +252,10 @@ class StoreOrder extends AuthController
['sh_delivery_id', ''],//送货人电话
['sh_delivery_uid', ''],//送货人ID
['fictitious_content', '']//虚拟发货内容
['fictitious_content', ''],//虚拟发货内容
['day_type', 0], //顺丰传 0今天,1明天,2后台
['pickup_time', []],//开始时间 9:00,结束时间 10:00 开始时间和结束时间之间不能小于一个小时
]);
return app('json')->success(100010, $services->delivery((int)$id, $data));
}
@ -286,7 +289,11 @@ class StoreOrder extends AuthController
['fictitious_content', ''],//虚拟发货内容
['cart_ids', []]
['cart_ids', []],
['day_type', 0], //顺丰传 0今天,1明天,2后台
['pickup_time', []],//开始时间 9:00,结束时间 10:00 开始时间和结束时间之间不能小于一个小时
['service_type', ''],//快递业务类型
]);
if (!$id) {
return app('json')->fail(100100);
@ -303,6 +310,58 @@ class StoreOrder extends AuthController
return app('json')->success(100010);
}
/**
* 获取寄件预扣金额
* @param ServeServices $services
* @return \think\Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/6/16
*/
public function getPrice(ServeServices $services)
{
$data = $this->request->postMore([
['kuaidicom', ''],
['send_address', ''],
['orderId', ''],
['service_type', ''],
['cart_ids', []],
]);
$orderInfo = $this->services->get($data['orderId'], ['user_address', 'cart_id']);
if (!$orderInfo) {
return app('json')->fail('订单没有查询到');
}
$weight = '0';
if ($data['cart_ids']) {
$cartIds = array_column($data['cart_ids'], 'cart_id');
$cartList = app()->make(StoreOrderCartInfoServices::class)->getColumn([
['cart_id', 'in', $cartIds]
], 'cart_info', 'cart_id');
foreach ($data['cart_ids'] as $cart) {
if (!isset($cart['cart_id']) || !$cart['cart_id'] || !isset($cart['cart_num']) || !$cart['cart_num']) {
return app('json')->fail(400159);
}
if (isset($cartList[$cart['cart_id']])) {
$value = is_string($cartList[$cart['cart_id']]) ? json_decode($cartList[$cart['cart_id']], true) : $cartList[$cart['cart_id']];
$weightnew = bcmul($value['attrInfo']['weight'], (string)$cart['cart_num'], 2);
$weight = bcadd($weightnew, $weight, 2);
}
}
} else {
$orderCartInfoList = app()->make(StoreOrderCartInfoServices::class)->getCartInfoPrintProduct($data['orderId']);
foreach ($orderCartInfoList as $item) {
$weightnew = bcmul($item['attrInfo']['weight'], (string)$item['cart_num'], 2);
$weight = bcadd($weightnew, $weight, 2);
}
}
$data['address'] = $orderInfo['user_address'];
if ($weight > 0) {
$data['weight'] = $weight;
}
return app('json')->success($services->express()->getPrice($data));
}
/**
* 获取订单可拆分发货商品列表
* @param $id
@ -465,7 +524,7 @@ class StoreOrder extends AuthController
*/
public function order_info($id)
{
if (!$id || !($orderInfo = $this->services->get($id, [], ['refund']))) {
if (!$id || !($orderInfo = $this->services->get($id, [], ['refund', 'invoice']))) {
return app('json')->fail(400118);
}
/** @var UserServices $services */

View File

@ -19,6 +19,7 @@ use app\services\product\product\StoreProductServices;
use crmeb\services\FileService;
use app\services\other\UploadService;
use think\facade\App;
use think\Request;
/**
* Class StoreProduct
@ -339,10 +340,21 @@ class StoreProduct extends AuthController
* @return mixed
* @throws \Exception
*/
public function getTempKeys()
public function getTempKeys(Request $request)
{
$upload = UploadService::init();
$re = $upload->getTempKeys();
$type = (int)sys_config('upload_type', 1);
$key = $request->get('key', '');
$path = $request->get('path', '');
$contentType = $request->get('contentType', '');
if ($type === 5) {
if (!$key || !$contentType) {
return app('json')->fail('缺少参数');
}
$re = $upload->getTempKeys($key, $path, $contentType);
} else {
$re = $upload->getTempKeys();
}
return $re ? app('json')->success($re) : app('json')->fail(100016);
}

View File

@ -100,7 +100,8 @@ class StoreProductReply extends AuthController
['product_score', 0],
['service_score', 0],
['product_id', 0],
['add_time', 0]
['add_time', 0],
['suk', ''],
]);
if (!$data['product_id']) {
$data['product_id'] = $data['image']['product_id'] ?? '';

View File

@ -169,9 +169,13 @@ class SystemAdmin extends AuthController
['new_pwd', ''],
['conf_pwd', ''],
]);
if (!preg_match('/^(?![^a-zA-Z]+$)(?!\D+$).{6,}$/', $data['new_pwd'])) {
return app('json')->fail(400183);
if ($data['pwd']) {
if (!preg_match('/^(?![^a-zA-Z]+$)(?!\D+$).{6,}$/', $data['new_pwd'])) {
return app('json')->fail(400183);
}
}
if ($this->services->updateAdmin($this->adminId, $data))
return app('json')->success(100001);
else

View File

@ -14,6 +14,7 @@ use app\adminapi\controller\AuthController;
use app\Request;
use app\services\system\config\SystemConfigServices;
use app\services\system\config\SystemConfigTabServices;
use crmeb\services\easywechat\orderShipping\MiniOrderService;
use think\facade\App;
/**
@ -327,9 +328,13 @@ class SystemConfig extends AuthController
@copy($from, $toHome);
@copy($from, $toPublic);
}
if(isset($post['reward_integral']) || isset($post['reward_money'])) {
if($post['reward_integral'] < 0 || $post['reward_money'] < 0) return app('json')->fail(400558);
if (isset($post['reward_integral']) || isset($post['reward_money'])) {
if ($post['reward_integral'] < 0 || $post['reward_money'] < 0) return app('json')->fail(400558);
}
// if (isset($post['order_shipping_open']) && $post['order_shipping_open'] == 1 && isset($post['order_shipping_url'])) {
// MiniOrderService::setMesJumpPathAndCheck($post['order_shipping_url']);
// }
foreach ($post as $k => $v) {
$config_one = $this->services->getOne(['menu_name' => $k]);
if ($config_one) {

View File

@ -111,7 +111,7 @@ class SystemMenus extends AuthController
['is_show', 0],
['is_show_path', 0],
]);
$data['is_show_path'] = $data['is_show'];
if (!$data['menu_name'])
return app('json')->fail(400198);
$data['path'] = implode('/', $data['path']);
@ -180,6 +180,7 @@ class SystemMenus extends AuthController
'pid' => $menu['path'],
'auth_type' => 2,
'is_show' => 1,
'is_show_path' => 1,
];
}

View File

@ -77,6 +77,7 @@ class SystemRole extends AuthController
if (!$data['role_name']) return app('json')->fail(400220);
if (!is_array($data['rules']) || !count($data['rules']))
return app('json')->fail(400221);
$data['rules'] = implode(',', $data['rules']);
if ($id) {
if (!$this->services->update($id, $data)) return app('json')->fail(100007);

View File

@ -79,19 +79,11 @@ class SystemStorage extends AuthController
}
/**
* @param SystemConfigServices $services
* @return mixed
*/
public function saveConfig(SystemConfigServices $services)
public function saveConfig( )
{
$type = (int)$this->request->post('type', 0);
// $services->update('upload_type', ['value' => json_encode($type)], 'menu_name');
// if (1 === $type) {
// $this->services->transaction(function () {
// $this->services->update(['status' => 1, 'is_delete' => 0], ['status' => 0]);
// });
// }
// \crmeb\services\CacheService::clear();
$data = $this->request->postMore([
['accessKey', ''],
@ -166,7 +158,10 @@ class SystemStorage extends AuthController
//设置跨域规则
try {
$upload = UploadService::init($info->type);
$upload->setBucketCors($info->name, $info->region);
$res = $upload->setBucketCors($info->name, $info->region);
if (false === $res) {
return app('json')->fail($upload->getError());
}
} catch (\Throwable $e) {
}
@ -199,6 +194,7 @@ class SystemStorage extends AuthController
public function updateDomain($id)
{
$domain = $this->request->post('domain', '');
$cdn = $this->request->post('cdn', '');
$data = $this->request->postMore([
['pri', ''],
['ca', '']
@ -214,7 +210,7 @@ class SystemStorage extends AuthController
// return app('json')->fail('域名为HTTPS访问时,必须填写证书');
// }
$this->services->updateDomain($id, $domain);
$this->services->updateDomain($id, $domain, ['cdn' => $cdn]);
return app('json')->success(100001);
}

View File

@ -36,12 +36,21 @@ Route::group('file', function () {
'update' => '修改附件分类管理',
'delete' => '删除附件分类管理'
],
]);
//获取上传类型
Route::get('upload_type', 'v1.file.SystemAttachment/uploadType')->option(['real_name' => '上传类型']);
//分片上传本地视频
Route::post('video_upload', 'v1.file.SystemAttachment/videoUpload')->option(['real_name' => '分片上传本地视频']);
//获取扫码上传页面链接以及参数
Route::get('scan_upload/qrcode', 'v1.file.SystemAttachment/scanUploadQrcode')->option(['real_name' => '扫码上传页面链接']);
//删除扫码上传token
Route::delete('scan_upload/qrcode', 'v1.file.SystemAttachment/removeUploadQrcode')->option(['real_name' => '删除扫码上传页面链接']);
//获取扫码上传的图片数据
Route::get('scan_upload/image/:scan_token', 'v1.file.SystemAttachment/scanUploadImage')->option(['real_name' => '获取扫码上传的图片数据']);
//网络图片上传
Route::post('online_upload', 'v1.file.SystemAttachment/onlineUpload')->option(['real_name' => '网络图片上传']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -36,6 +36,8 @@ Route::group('order', function () {
Route::put('take/:id', 'v1.order.StoreOrder/take_delivery')->name('StoreOrderTakeDelivery')->option(['real_name' => '确认收货']);
//发送货
Route::put('delivery/:id', 'v1.order.StoreOrder/update_delivery')->name('StoreOrderUpdateDelivery')->option(['real_name' => '订单发送货']);
//获取商家寄件金额
Route::post('price', 'v1.order.StoreOrder/getPrice')->name('getPrice')->option(['real_name' => '获取商家寄件金额']);
//获取订单可拆分商品列表
Route::get('split_cart_info/:id', 'v1.order.StoreOrder/split_cart_info')->name('StoreOrderSplitCartInfo')->option(['real_name' => '获取订单可拆分商品列表']);
//拆单发送货

View File

@ -52,7 +52,7 @@ Route::group('product', function () {
//修改商品状态
Route::put('product/set_show/:id/:is_show', 'v1.product.StoreProduct/set_show')->option(['real_name' => '修改商品状态']);
//商品快速编辑
Route::put('product/set_product/:id', 'v1.product.StoreProduct/set_product')->option(['real_name' => '商品快速编辑']);
// Route::put('product/set_product/:id', 'v1.product.StoreProduct/set_product')->option(['real_name' => '商品快速编辑']);
//设置批量商品上架
Route::put('product/product_show', 'v1.product.StoreProduct/product_show')->option(['real_name' => '设置批量商品上架']);
//设置批量商品下架

View File

@ -36,6 +36,10 @@ Route::group(function () {
Route::get('get_workerman_url', 'PublicController/getWorkerManUrl')->option(['real_name' => '获取客服数据']);
//测试
Route::get('index', 'Test/index')->option(['real_name' => '测试地址']);
//扫码上传图片
Route::post('image/scan_upload', 'PublicController/scanUpload')->option(['real_name' => '扫码上传图片']);
})->middleware(AllowOriginMiddleware::class)->option(['mark' => 'login', 'mark_name' => '登录相关']);
/**

View File

@ -217,8 +217,8 @@ class PublicController
/**
* 图片上传
* @param Request $request
* @param SystemAttachmentServices $services
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function upload_image(Request $request, SystemAttachmentServices $services)
{
@ -643,7 +643,8 @@ class PublicController
*/
public function getVersion()
{
return app('json')->success(['version' => get_crmeb_version()]);
$version = parse_ini_file(app()->getRootPath() . '.version');
return app('json')->success(['version' => $version['version'], 'version_code' => $version['version_code']]);
}
/**

View File

@ -46,6 +46,84 @@ class StoreOrderController
$this->service = $services;
}
/**
* 订单 查看物流
* @param StoreOrderCartInfoServices $services
* @param ExpressServices $expressServices
* @param $uni
* @param string $type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function express(StoreOrderServices $orderServices, StoreOrderCartInfoServices $services, ExpressServices $expressServices, $uni, $type = '')
{
if ($type == 'refund') {
/** @var StoreOrderRefundServices $refundService */
$refundService = app()->make(StoreOrderRefundServices::class);
$order = $refundService->refundDetail($uni);
$express = $order['refund_express'];
$cacheName = $uni . $express;
$orderInfo = [];
$info = [];
$cartNew = [];
foreach ($order['cart_info'] as $k => $cart) {
$cartNew['cart_num'] = $cart['cart_num'];
$cartNew['truePrice'] = $cart['truePrice'];
$cartNew['postage_price'] = $cart['postage_price'];
$cartNew['productInfo']['image'] = $cart['productInfo']['image'];
$cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name'];
$cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? '';
array_push($info, $cartNew);
unset($cart);
}
$orderInfo['cartInfo'] = $info;
$orderInfo['delivery_id'] = $express;
$orderInfo['delivery_name'] = $order['refund_express_name'];
$orderInfo['delivery_code'] = '';
} else {
if (!$uni || !($order = $orderServices->getUserOrderDetail($uni, 0, []))) {
return app('json')->fail(410173);
}
if ($type != 'refund' && ($order['delivery_type'] != 'express' || !$order['delivery_id'])) {
return app('json')->fail(410206);
}
$express = $type == 'refund' ? $order['refund_express'] : $order['delivery_id'];
$cacheName = $uni . $express;
$orderInfo = [];
$cartInfo = $services->getCartColunm(['oid' => $order['id']], 'cart_info', 'unique');
$info = [];
$cartNew = [];
foreach ($cartInfo as $k => $cart) {
$cart = json_decode($cart, true);
$cartNew['cart_num'] = $cart['cart_num'];
$cartNew['truePrice'] = $cart['truePrice'];
$cartNew['postage_price'] = $cart['postage_price'];
$cartNew['productInfo']['image'] = $cart['productInfo']['image'];
$cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name'];
$cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? '';
array_push($info, $cartNew);
unset($cart);
}
$orderInfo['delivery_id'] = $express;
$orderInfo['delivery_name'] = $type == 'refund' ? '用户退回' : $order['delivery_name'];;
$orderInfo['delivery_code'] = $type == 'refund' ? '' : $order['delivery_code'];
$orderInfo['delivery_type'] = $order['delivery_type'];
$orderInfo['user_address'] = $order['user_address'];
$orderInfo['user_mark'] = $order['mark'];
$orderInfo['cartInfo'] = $info;
}
return app('json')->success([
'order' => $orderInfo,
'express' => [
'result' => ['list' => $expressServices->query($cacheName, $orderInfo['delivery_id'], $orderInfo['delivery_code'], $order['user_phone'])
]
]
]);
}
/**
* 订单数据统计
* @param StoreOrderServices $services
@ -163,7 +241,8 @@ class StoreOrderController
['sh_delivery_id', ''],//送货人电话
['sh_delivery_uid', ''],//送货人ID
['fictitious_content', '']//虚拟发货内容
['fictitious_content', ''],//虚拟发货内容
['pickup_time', []]
]);
if ($data['delivery_type']) {
$data['delivery_name'] = $data['delivery_type'];

View File

@ -34,6 +34,7 @@ use app\services\order\{OtherOrderServices,
StoreOrderInvoiceServices,
StoreOrderRefundServices,
StoreOrderServices,
StoreOrderStatusServices,
StoreOrderSuccessServices,
StoreOrderTakeServices
};
@ -43,6 +44,7 @@ use app\services\product\product\StoreProductReplyServices;
use app\services\shipping\ShippingTemplatesServices;
use crmeb\services\CacheService;
use think\facade\Cache;
use think\facade\Log;
/**
* 订单控制器
@ -61,9 +63,9 @@ class StoreOrderController
* @var int[]
*/
protected $getChennel = [
'weixin' => 0,
'wechat' => 0,
'routine' => 1,
'weixinh5' => 2,
'h5' => 2,
'pc' => 3,
'app' => 4
];
@ -255,10 +257,11 @@ class StoreOrderController
$orderInfo = $this->services->get(['order_id' => $uni]);
$uid = $type == 1 ? (int)$request->uid() : $orderInfo->uid;
$orderInfo->is_channel = $this->getChennel[$request->getFromType()] ?? ($request->isApp() ? 0 : 1);
$orderInfo->order_id = $uid != $orderInfo->pay_uid ? app()->make(StoreOrderCreateServices::class)->getNewOrderId('cp') : $uni;
$orderInfo->pay_uid = $uid;
$orderInfo->save();
$orderInfo = $orderInfo->toArray();
$order = $this->services->get(['order_id' => $uni]);
$order = $this->services->get(['order_id' => $orderInfo['order_id']]);
if (!$order)
return app('json')->fail(410173);
if ($order['paid'])
@ -715,6 +718,7 @@ class StoreOrderController
if (!$order || $uid != $order['uid']) {
return app('json')->fail(410173);
}
if ($order['pid'] == -1) return app('json')->fail('主订单已拆单,请刷新页面');
$refundData = [
'refund_reason' => $data['text'],
'refund_explain' => $data['refund_reason_wap_explain'],
@ -793,4 +797,101 @@ class StoreOrderController
$cartProduct['order_id'] = $this->services->value(['id' => $cartInfo['oid']], 'order_id');
return app('json')->success($cartProduct);
}
/**
* 商家寄件回调
* @param Request $request
* @return \think\Response
* @author 等风来
* @email 136327134@qq.com
* @date 2023/6/12
*/
public function callBack(Request $request)
{
$data = $request->postMore([
['t', ''],
['sign', ''],
['type', ''],
['data', ''],
]);
\think\facade\Log::error('回调:' . json_encode($data));
$data['data']['id'] = (int)$data['data']['id'];
if (md5(json_encode($data['data']) . $data['t']) != $data['sign']) {
return app('json')->fail('验签失败');
}
switch ($data['type']) {
case 'order_success'://下单成功
$update = [
'label' => $data['data']['label'] ?? '',
];
//韵达会异步推送单号
if (isset($data['kuaidinum'])) {
$update['delivery_id'] = $data['kuaidinum'];
}
if (isset($data['task_id'])) {
$this->services->update(['task_id' => $data['task_id']], $update);
}
break;
case 'order_take'://取件
if (isset($data['data']['task_id'])) {
$orderInfo = $this->services->get(['kuaidi_task_id' => $data['data']['task_id']]);
if (!$orderInfo) {
return app('json')->fail('订单不存在');
}
$this->services->transaction(function () use ($data, $orderInfo) {
$this->services->update(['kuaidi_task_id' => $data['data']['task_id']], [
'status' => 1,
'is_stock_up' => 0
]);
/** @var StoreOrderStatusServices $services */
$services = app()->make(StoreOrderStatusServices::class);
$services->save([
'oid' => $orderInfo->id,
'change_time' => time(),
'change_type' => 'delivery_goods',
'change_message' => '已发货 快递公司:' . $orderInfo->delivery_name . ' 快递单号:' . $orderInfo->delivery_id
]);
});
}
break;
case 'order_cancel'://取消寄件
if (isset($data['data']['task_id'])) {
$orderInfo = $this->services->get(['kuaidi_task_id' => $data['data']['task_id']]);
if (!$orderInfo) {
return app('json')->fail('订单不存在');
}
if ($orderInfo->is_stock_up && $orderInfo->status == 0) {
app()->make(StoreOrderStatusServices::class)->save([
'oid' => $orderInfo->id,
'change_time' => time(),
'change_type' => 'delivery_goods_cancel',
'change_message' => '已取消发货,取消原因:用户手动取消'
]);
$orderInfo->status = 0;
$orderInfo->is_stock_up = 0;
$orderInfo->kuaidi_task_id = '';
$orderInfo->kuaidi_order_id = '';
$orderInfo->express_dump = '';
$orderInfo->kuaidi_label = '';
$orderInfo->delivery_id = '';
$orderInfo->delivery_code = '';
$orderInfo->delivery_name = '';
$orderInfo->delivery_type = '';
$orderInfo->save();
} else {
Log::error('商家寄件自动回调,订单状态不正确:', [
'kuaidi_task_id' => $data['data']['task_id']
]);
}
}
break;
}
return app('json')->success();
}
}

View File

@ -18,9 +18,10 @@ Route::group(function () {
Route::any('wechat/serve', 'v1.wechat.WechatController/serve')->option(['real_name' => '公众号服务']);//公众号服务
Route::any('wechat/miniServe', 'v1.wechat.WechatController/miniServe')->option(['real_name' => '小程序服务']);//公众号服务
Route::any('pay/notify/:type', 'v1.PayController/notify')->option(['real_name' => '支付回调']);//支付回调
Route::any('order_call_back', 'v1.order.StoreOrderController/callBack')->option(['real_name' => '商家寄件回调']);//商家寄件回调
Route::get('get_script', 'v1.PublicController/getScript')->option(['real_name' => '获取统计代码']);//获取统计代码
Route::get('version', 'v1.PublicController/getVersion')->option(['real_name' => '获取代码版本号']);
})->option(['mark' => 'serve', 'mark_name' => '服务接口']);
})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->option(['mark' => 'serve', 'mark_name' => '服务接口']);
Route::group(function () {
//apple快捷登陆
@ -80,6 +81,7 @@ Route::group(function () {
Route::get('admin/order/delivery_info', 'v1.admin.StoreOrderController/getDeliveryInfo')->name('getDeliveryInfo')->option(['real_name' => '获取电子面单默认信息']);//获取电子面单默认信息
Route::get('admin/order/export_temp', 'v1.admin.StoreOrderController/getExportTemp')->name('getExportTemp')->option(['real_name' => '获取电子面单模板获取']);//获取电子面单模板获取
Route::get('admin/order/export_all', 'v1.admin.StoreOrderController/getExportAll')->name('getExportAll')->option(['real_name' => '获取物流公司']);//获取物流公司
Route::get('admin/order/express/:uni/[:type]', 'v1.admin.StoreOrderController/express')->name('orderExpress')->option(['real_name' => '订单查看物流']); //订单查看物流
})->middleware(\app\http\middleware\AllowOriginMiddleware::class)
->middleware(\app\api\middleware\StationOpenMiddleware::class)
->middleware(\app\api\middleware\AuthTokenMiddleware::class, true)

View File

@ -682,10 +682,10 @@ if (!function_exists('get_file_link')) {
if (!$link) {
return '';
}
if (strstr('http', $link) === false) {
return app()->request->domain() . $link;
} else {
if (substr($link, 0, 4) === "http" || substr($link, 0, 2) === "//") {
return $link;
} else {
return app()->request->domain() . $link;
}
}
}

View File

@ -71,7 +71,7 @@ class StoreCombinationDao extends BaseDao
* @return int
* @throws \ReflectionException
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}

View File

@ -132,7 +132,7 @@ class StorePinkDao extends BaseDao
public function successList(int $uid)
{
return $this->search(['status' => 2, 'is_refund' => 0])
->where('uid', '<>', $uid)
// ->where('uid', '<>', $uid)
->select()->toArray();
}

View File

@ -39,7 +39,7 @@ class StoreIntegralDao extends BaseDao
* @return int
* @throws \ReflectionException
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}

View File

@ -93,7 +93,7 @@ class StoreIntegralOrderDao extends BaseDao
* @return int
* @throws \ReflectionException
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}

View File

@ -59,7 +59,7 @@ class ArticleCategoryDao extends BaseDao
public function getArticleCategory()
{
return $this->search(['hidden' => 0, 'is_del' => 0, 'status' => 1, 'pid' => 0])->with(['children'])
->order('sort DESC')
->order('sort DESC,id DESC')
->field('id,pid,title')
->select()->toArray();
}
@ -77,7 +77,7 @@ class ArticleCategoryDao extends BaseDao
->where('hidden', 0)
->where('is_del', 0)
->where('status', 1)
->order('sort DESC')
->order('sort DESC,id DESC')
->field('id,pid,title')
->select()->toArray();
}

View File

@ -47,7 +47,7 @@ class PageCategoryDao extends BaseDao
{
return $this->search($where)->field($field)->when($page && $limit, function ($query) use ($page, $limit) {
$query->page();
})->order('sort desc')->select()->toArray();
})->order('sort desc,id DESC')->select()->toArray();
}
}

View File

@ -190,7 +190,7 @@ class OtherOrderDao extends BaseDao
* @email 442384644@qq.com
* @date 2023/04/11
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}

View File

@ -269,7 +269,7 @@ class StoreOrderDao extends BaseDao
* @return int
* @throws \ReflectionException
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->count();
}
@ -702,7 +702,7 @@ class StoreOrderDao extends BaseDao
$query->field("sum($sumField) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
})
->order('pay_time ASC')->select()->toArray();
->order('pay_time ASC,id DESC')->select()->toArray();
}
/**时间分组订单数统计
@ -730,7 +730,7 @@ class StoreOrderDao extends BaseDao
$query->field("count($sumField) as number,FROM_UNIXTIME(pay_time, '$timeUinx') as time");
$query->group("FROM_UNIXTIME(pay_time, '$timeUinx')");
})
->order('pay_time ASC')->select()->toArray();
->order('pay_time ASC,id DESC')->select()->toArray();
}
/**时间段支付订单人数
@ -773,7 +773,7 @@ class StoreOrderDao extends BaseDao
$query->field("count(distinct uid) as number,FROM_UNIXTIME(pay_time, '$timeUinx') as time");
$query->group("FROM_UNIXTIME(pay_time, '$timeUinx')");
})
->order('pay_time ASC')->select()->toArray();
->order('pay_time ASC,id DESC')->select()->toArray();
}
@ -978,8 +978,18 @@ class StoreOrderDao extends BaseDao
})->field(['uid', 'order_id', 'real_name', 'status', 'pay_price', 'total_num', 'add_time', 'pay_time', 'paid'])->order('add_time desc')->select()->toArray();
}
public function getSubOrderNotSendList(int $pid)
{
return $this->getModel()->where('pid', $pid)->where('status', 1)->select()->toArray();
}
public function getSubOrderNotSend(int $pid, int $order_id)
{
return $this->getModel()->where('id', $pid)->where('status', '0')->where('id', '<>', $order_id)->count();
return $this->getModel()->where('pid', $pid)->where('status', 0)->where('id', '<>', $order_id)->count();
}
public function getSubOrderNotTake(int $pid, int $order_id)
{
return $this->getModel()->where('pid', $pid)->where('status', 1)->where('id', '<>', $order_id)->count();
}
}

View File

@ -95,9 +95,27 @@ class StoreOrderRefundDao extends BaseDao
})->order('id DESC')->select()->toArray();
}
/**
* 退款订单数量
* @param array $where
* @param bool $search
* @return int
* @throws \ReflectionException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/19
*/
public function count(array $where = [], bool $search = false)
{
return $this->search($where, $search)->count();
}
/**
* 根据时间获取
* @param array $where
* @param string $sum_field
* @param string $selectType
* @param string $group
* @return float|int
*/
public function getOrderRefundMoneyByWhere(array $where, string $sum_field, string $selectType, string $group = "")

View File

@ -122,7 +122,7 @@ class StoreProductDao extends BaseDao
})->when(isset($where['cid']) && $where['cid'], function ($query) use ($where) {
$query->whereIn('id', function ($query) use ($where) {
$query->name('store_product_cate')->whereIn('cate_id', function ($query) use ($where) {
$query->name('store_category')->where('pid', $where['cid'])->field('id')->select();
$query->name('store_category')->where('pid', $where['cid'])->whereOr('id', $where['cid'])->field('id')->select();
})->field('product_id')->select();
});
})->when(isset($where['coupon_category_id']) && $where['coupon_category_id'] != '', function ($query) use ($where) {

View File

@ -96,7 +96,7 @@ class StoreServiceDao extends BaseDao
* @email 442384644@qq.com
* @date 2023/05/10
*/
public function count($where = [], $search = true)
public function count(array $where = [], bool $search = true)
{
return $this->search($where, false)->when(isset($where['noId']), function ($query) use ($where) {
$query->whereNotIn('uid', $where['noId']);

View File

@ -42,7 +42,7 @@ class ExpressDao extends BaseDao
*/
public function getExpressList(array $where, string $field, int $page, int $limit)
{
return $this->search($where)->field($field)->order('sort DESC,id DESC')
return $this->search($where)->field($field)->order('sort DESC,is_show DESC,id ASC')
->when($page > 0 && $limit > 0, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->select()->toArray();

View File

@ -53,7 +53,7 @@ class ShippingTemplatesDao extends BaseDao
*/
public function getShippingList(array $where, int $page, int $limit)
{
return $this->search($where)->order('sort DESC')->page($page, $limit)->select()->toArray();
return $this->search($where)->order('sort DESC,id DESC')->page($page, $limit)->select()->toArray();
}
/**

View File

@ -51,9 +51,9 @@ class ShippingTemplatesNoDeliveryDao extends BaseDao
* @param string $key
* @return array
*/
public function getShippingArray(array $where, string $field, string $key)
public function getShippingArray(array $where)
{
return $this->search($where)->column($field, $key);
return $this->search($where)->select()->toArray();
}
/**

View File

@ -128,7 +128,7 @@ class SystemMenusDao extends BaseDao
public function menusSelect(array $where, $type = 1)
{
if ($type == 1) {
return $this->search($where)->field('id,pid,menu_name,menu_path,unique_auth,sort')->order('sort DESC')->select();
return $this->search($where)->field('id,pid,menu_name,menu_path,unique_auth,sort')->order('sort DESC,id DESC')->select();
} else {
return $this->search($where)->group('pid')->column('pid');
}
@ -143,7 +143,7 @@ class SystemMenusDao extends BaseDao
public function getSearchList()
{
return $this->search(['is_show' => 1, 'auth_type' => 1, 'is_del' => 0, 'is_show_path' => 0])
->field('id,pid,menu_name,menu_path,unique_auth,sort')->order('sort DESC')->select();
->field('id,pid,menu_name,menu_path,unique_auth,sort')->order('sort DESC,id DESC')->select();
}
/**

View File

@ -92,4 +92,20 @@ class SystemAttachmentDao extends BaseDao
{
$this->getModel()->whereTime('time', 'yesterday')->where('module_type', 2)->delete();
}
/**
* 获取扫码上传的图片数据
* @param $scan_token
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function scanUploadImage($scan_token)
{
return $this->getModel()->where('scan_token', $scan_token)->field('att_dir,att_id')->select()->toArray();
}
}

View File

@ -84,7 +84,7 @@ class SystemConfigDao extends BaseDao
{
$where['tab_id'] = $tabId;
if ($status == 1) $where['status'] = $status;
return $this->search($where)->order('sort desc')->select()->toArray();
return $this->search($where)->order('sort desc,id ASC')->select()->toArray();
}
/**

View File

@ -50,7 +50,7 @@ class MemberShipDao extends BaseDao
*/
public function getApiList(array $where)
{
return $this->search()->where($where)->order('sort desc')->select()->toArray();
return $this->search()->where($where)->order('sort desc,id DESC')->select()->toArray();
}

View File

@ -44,6 +44,6 @@ class UserAddressDao extends BaseDao
*/
public function getList(array $where, string $field = '*', int $page, int $limit): array
{
return $this->search($where)->field($field)->page($page, $limit)->order('is_default DESC')->select()->toArray();
return $this->search($where)->field($field)->page($page, $limit)->order('is_default DESC,id DESC')->select()->toArray();
}
}

View File

@ -45,7 +45,7 @@ class UserLabelCateDao extends BaseDao
{
return $this->search($where)->when($page && $limit, function ($query) use ($page, $limit) {
$query->page($page, $limit);
})->order('sort DESC')->select()->toArray();
})->order('sort DESC,id DESC')->select()->toArray();
}
/**
@ -59,6 +59,6 @@ class UserLabelCateDao extends BaseDao
{
return $this->getModel()->when(count($with), function ($query) use ($with) {
$query->with($with);
})->order('sort DESC')->select()->toArray();
})->order('sort DESC,id DESC')->select()->toArray();
}
}

View File

@ -106,7 +106,7 @@ class WechatReplyKeyDao extends BaseDao
* @param bool $search
* @return int
*/
public function count(array $where = [], bool $search = true): int
public function count(array $where = [], bool $search = true)
{
return $this->search($where, $search)->group($this->alias . '.id')->count();
}

View File

@ -38,7 +38,7 @@ class AutoCommentJob extends BaseJobs
'uid' => $item['uid'],
'oid' => $item['oid'],
'unique' => $item['unique'],
'product_id' => $item['product_id'],
'product_id' => json_decode($item['cart_info'],true)['product_id'],
'reply_type' => 'product',
'nickname' => $userInfos[$item['uid']]['nickname'],
'avatar' => $userInfos[$item['uid']]['avatar'],

View File

@ -0,0 +1,27 @@
<?php
namespace app\jobs;
use crmeb\basic\BaseJobs;
use crmeb\services\easywechat\orderShipping\MiniOrderService;
use crmeb\traits\QueueTrait;
use EasyWeChat\Core\Exceptions\HttpException;
use think\Exception;
class MiniOrderJob extends BaseJobs
{
use QueueTrait;
/**
* @throws HttpException
*/
public function doJob(string $out_trade_no, int $logistics_type, array $shipping_list, string $payer_openid, string $path, int $delivery_mode = 1, bool $is_all_delivered = true)
{
try {
MiniOrderService::shippingByTradeNo($out_trade_no, $logistics_type, $shipping_list, $payer_openid, $path, $delivery_mode, $is_all_delivered);
} catch (HttpException $e) {
// 订单异常处理
throw new HttpException($e);
}
}
}

View File

@ -81,8 +81,6 @@ class ProductCopyJob extends BaseJobs
$copyTaobao = app()->make(CopyTaobaoServices::class);
/** @var StoreProductServices $StoreProductServices */
$StoreProductServices = app()->make(StoreProductServices::class);
/** @var StoreProductAttrValueServices $StoreProductAttrValueServices */
$StoreProductAttrValueServices = app()->make(StoreProductAttrValueServices::class);
//下载图片
$res = $copyTaobao->downloadCopyImage($image);
//获取缓存中的轮播图
@ -97,7 +95,6 @@ class ProductCopyJob extends BaseJobs
$image = $slider_images[0];
$slider_images = $slider_images ? json_encode($slider_images) : '';
$StoreProductServices->update($id, ['slider_image' => $slider_images, 'image' => $image]);
$StoreProductAttrValueServices->update(['product_id' => $id], ['image' => $image]);
} else {
CacheService::set('slider_images_' . $id, $slider_images);
}
@ -106,4 +103,26 @@ class ProductCopyJob extends BaseJobs
}
return true;
}
/**
* 下载商品规格图片
* @param $value_id
* @param $value_image
* @return bool
*/
public function copyAttrImage($value_id, $value_image)
{
try {
/** @var CopyTaobaoServices $copyTaobao */
$copyTaobao = app()->make(CopyTaobaoServices::class);
/** @var StoreProductAttrValueServices $StoreProductAttrValueServices */
$StoreProductAttrValueServices = app()->make(StoreProductAttrValueServices::class);
//下载图片
$res = $copyTaobao->downloadCopyImage($value_image);
$StoreProductAttrValueServices->update($value_id, ['image' => $res]);
} catch (\Throwable $e) {
Log::error('下载商品规格图片失败,失败原因:' . $e->getMessage() . '_' . $e->getFile() . '_' . $e->getLine());
}
return true;
}
}

View File

@ -2,6 +2,7 @@
namespace app\listener\order;
use app\jobs\MiniOrderJob;
use app\model\order\StoreOrder;
use app\services\order\StoreOrderCartInfoServices;
use app\services\order\StoreOrderServices;
@ -15,56 +16,95 @@ class OrderShippingListener implements ListenerInterface
public function handle($event): void
{
/** @var StoreOrder $order */
[$order, $delivery_type, $delivery_id, $delivery_name] = $event;
[$order_type, $order, $delivery_type, $delivery_id, $delivery_name] = $event;
$order_shipping_open = sys_config('order_shipping_open', 0); // 小程序发货信息管理服务开关
$secs = 0;
if ($order && $order_shipping_open) {
if ($order['channel_type'] = 'routine') {
$out_trade_no = $order['order_id'];
//判断订单是否拆单
$delivery_mode = 1;
$is_all_delivered = true;
if ($order['pid'] > 0) {
$order = '';
$delivery_mode = 2;
// 判断订单是否全部发货
/** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class);
$is_all_delivered = $orderServices->checkSubOrderNotSend((int)$order['pid'], (int)$order['id']);
}
//判断订单是否拆单
$delivery_mode = 1;
$is_all_delivered = true;
if ($order_type == 'product') { // 商品订单
if ($order['is_channel'] == 1 && $order['pay_type'] == 'weixin') {
$out_trade_no = $order['order_id'];
/** @var StoreOrderCartInfoServices $orderInfoServices */
$orderInfoServices = app()->make(StoreOrderCartInfoServices::class);
$item_desc = $orderInfoServices->getCarIdByProductTitle((int)$order['id'], true);
// 整理商品信息
/** @var StoreOrderCartInfoServices $orderInfoServices */
$orderInfoServices = app()->make(StoreOrderCartInfoServices::class);
$item_desc = $orderInfoServices->getCarIdByProductTitle((int)$order['id'], true);
$shipping_list = [
['item_desc' => $item_desc]
];
//判断订单物流模式
if ($order['shipping_type'] == 1) {
if ($delivery_type == 1) {
$shipping_list = [
[
'tracking_no' => $delivery_id ?? '',
'express_company' => $delivery_name ?? '',
'item_desc' => $item_desc,
'contact' => [
'receiver_contact' => $order['user_phone']
]
]
];
if ($order['pid'] > 0) {
$delivery_mode = 2;
// 判断订单是否全部发货
/** @var StoreOrderServices $orderServices */
$orderServices = app()->make(StoreOrderServices::class);
$is_all_delivered = $orderServices->checkSubOrderNotSend((int)$order['pid'], (int)$order['id']);
$p_order = $orderServices->get((int)$order['pid']);
if (!$p_order) {
throw new AdminException('拆单异常');
}
$out_trade_no = $p_order['order_id'];
}
$logistics_type = $delivery_type;
$pay_uid = $order['pay_uid'];
$path = 'pages/goods/order_details/index?order_id=' . $out_trade_no;
} else {
$logistics_type = 4;
return;
}
//查找支付者openid
/** @var WechatUserServices $wechatUserService */
$wechatUserService = app()->make(WechatUserServices::class);
$payer_openid = $wechatUserService->uidToOpenid($order['pay_uid'], 'routine');
if (empty($payer_openid)) {
throw new AdminException('订单支付人异常');
} else if ($order_type == 'recharge') { // 充值订单
if ($order['recharge_type'] == 'weixin') {
$delivery_type = 3;
$item_desc = '用户充值' . $order['price'];
$out_trade_no = $order['order_id'];
$pay_uid = $order['uid'];
$secs = 10;
$path = '/pages/users/user_bill/index?type=2';
} else {
return;
}
MiniOrderService::shippingByTradeNo($out_trade_no, $logistics_type, $shipping_list, $payer_openid, $delivery_mode, $is_all_delivered);
} else if ($order_type == 'member') { // 会员订单
if ($order['pay_type'] == 'weixin') {
$delivery_type = 3;
$item_desc = '用户购买' . $order['member_type'] . '会员卡';
$out_trade_no = $order['order_id'];
$pay_uid = $order['uid'];
$secs = 10;
$path = '/pages/annex/vip_paid/index';
} else {
return;
}
} else {
return;
}
// 整理商品信息
$shipping_list = [
['item_desc' => $item_desc]
];
//判断订单物流模式
if (!isset($order['shipping_type']) || $order['shipping_type'] == 1) {
if ($delivery_type == 1) {
$shipping_list = [
[
'tracking_no' => $delivery_id ?? '',
'express_company' => $delivery_name ?? '',
'item_desc' => $item_desc,
'contact' => [
'receiver_contact' => $order['user_phone']
]
]
];
}
$logistics_type = $delivery_type;
} else {
$logistics_type = 4;
}
//查找支付者openid
/** @var WechatUserServices $wechatUserService */
$wechatUserService = app()->make(WechatUserServices::class);
$payer_openid = $wechatUserService->uidToOpenid($pay_uid, 'routine');
if (empty($payer_openid)) {
throw new AdminException('订单支付人异常');
}
if ($secs) {
MiniOrderJob::dispatchSecs($secs, 'doJob', [$out_trade_no, $logistics_type, $shipping_list, $payer_openid, $path, $delivery_mode, $is_all_delivered]);
} else {
MiniOrderJob::dispatch('doJob', [$out_trade_no, $logistics_type, $shipping_list, $payer_openid, $path, $delivery_mode, $is_all_delivered]);
}
}
}

View File

@ -41,11 +41,10 @@ class Express extends BaseModel
* 物流公司是否显示
* @param Model $query
* @param $value
* @param $data
*/
public function searchIsShowAttr($query, $value, $data)
public function searchIsShowAttr($query, $value)
{
$query->where('is_show', $value);
if ($value !== '') $query->where('is_show', $value);
}
/**
@ -72,7 +71,7 @@ class Express extends BaseModel
public function searchCodeAttr($query, $value)
{
if ($value === '') {
if ($value !== '') {
$query->where('code', $value);
}
}

View File

@ -232,7 +232,11 @@ class SystemMenus extends BaseModel
public function searchAuthTypeAttr($query, $value)
{
if ($value !== '') {
$query->where('auth_type', $value);
if ($value == 3) {
$query->whereIn('auth_type', [1, 3]);
} else {
$query->where('auth_type', $value);
}
}
}
}

View File

@ -63,6 +63,16 @@ class SystemAttachment extends BaseModel
*/
public function searchLikeNameAttr($query, $value)
{
if ($value) $query->where('name','LIKE' ,"$value%");
if ($value) $query->where('name', 'LIKE', "$value%");
}
/**
* real_name模糊搜索
* @param Model $query
* @param $value
*/
public function searchRealNameAttr($query, $value)
{
if ($value != '') $query->where('real_name', 'LIKE', "%$value%");
}
}

View File

@ -69,10 +69,10 @@ class User extends BaseModel
return app('request')->ip();
}
protected function getPhoneAttr($value)
{
return $value && app('request')->hasMacro('adminInfo') && app('request')->adminInfo()['level'] != 0 ? substr_replace($value, '****', 3, 4) : $value;
}
// protected function getPhoneAttr($value)
// {
// return $value && app('request')->hasMacro('adminInfo') && app('request')->adminInfo()['level'] != 0 ? substr_replace($value, '****', 3, 4) : $value;
// }
/**
* 链接会员登陆设置表

View File

@ -87,6 +87,16 @@ class UserRecharge extends BaseModel
$query->where('recharge_type', $value);
}
/**
* 不等于充值类型
* @param Model $query
* @param $value
*/
public function searchNoRechargeTypeAttr($query, $value)
{
$query->where('recharge_type', '<>', $value);
}
/**退款金额
* @param $query
* @param $value

View File

@ -97,6 +97,10 @@ class User extends AuthController
* 赠送相关
* @param int $uid
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function give($uid)
{
@ -114,4 +118,70 @@ class User extends AuthController
}
return app('json')->success(100010);
}
/**
* 获取用户详情
* @param $uid
* @return \think\Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/20
*/
public function info($uid)
{
if (!$uid) return app('json')->fail(100100);
return app('json')->success($this->services->userInfo($uid));
}
/**
* 赠送余额
* @param int $uid
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function giveBalance($uid)
{
$data = $this->request->postMore([
['money_status', 0],
['money', 0],
['integration_status', 0],
['integration', 0],
['days', 0],
['coupon', 0]
]);
if (!$uid) return app('json')->fail(100100);
if (!$this->services->otherGive((int)$uid, $data)) {
return app('json')->fail(100005);
}
return app('json')->success(100010);
}
/**
* 赠送积分
* @param int $uid
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function givePoint($uid)
{
$data = $this->request->postMore([
['money_status', 0],
['money', 0],
['integration_status', 0],
['integration', 0],
['days', 0],
['coupon', 0]
]);
if (!$uid) return app('json')->fail(100100);
if (!$this->services->otherGive((int)$uid, $data)) {
return app('json')->fail(100005);
}
return app('json')->success(100010);
}
}

View File

@ -83,9 +83,11 @@ Route::group(function () {
//用户
Route::get('user/list', 'User/lst')->option(['real_name' => '用户列表']);
Route::get('user/info/:uid', 'User/info')->option(['real_name' => '用户详情']);
Route::post('user', 'User/save')->option(['real_name' => '新增用户']);
Route::put('user/:uid', 'User/update')->option(['real_name' => '修改用户']);
Route::put('user/give/:uid', 'User/give')->option(['real_name' => '赠送积分/金额']);
Route::put('user/give_balance/:uid', 'User/giveBalance')->option(['real_name' => '赠送余额']);
Route::put('user/give_point/:uid', 'User/givePoint')->option(['real_name' => '赠送积分']);
})->option(['mark' => 'user', 'mark_name' => '用户']);
})->middleware(AuthTokenMiddleware::class);

View File

@ -393,11 +393,11 @@ class StoreCombinationServices extends BaseServices
/** @var StorePinkServices $pinkService */
$pinkService = app()->make(StorePinkServices::class);
list($pink, $pindAll) = $pinkService->getPinkList($id, true);//拼团列表
list($pink, $pinkAll) = $pinkService->getPinkList($id, true);//拼团列表
$data['pink_ok_list'] = $pinkService->getPinkOkList($uid);
$data['pink_ok_sum'] = $pinkService->getPinkOkSumTotalNum();
$data['pink'] = $pink;
$data['pindAll'] = $pindAll;
$data['pinkAll'] = $pinkAll;
/** @var StoreOrderServices $storeOrderServices */
$storeOrderServices = app()->make(StoreOrderServices::class);

View File

@ -97,7 +97,7 @@ class StorePinkServices extends BaseServices
*/
public function getPinkMember(int $id)
{
return $this->dao->getList(['k_id' => $id, 'is_refund' => 0]);
return $this->dao->getList(['k_id' => $id]);
}
/**
@ -130,15 +130,15 @@ class StorePinkServices extends BaseServices
$res11 = $this->dao->update($id, ['k_id' => $kCount['id']], 'k_id');
$res12 = $this->dao->update($kCount['id'], ['stop_time' => $count['add_time'] + 86400, 'k_id' => 0]);
$res1 = $res11 && $res12;
$res2 = $this->dao->update($id, ['stop_time' => time() - 1, 'k_id' => 0, 'is_refund' => $kCount['id'], 'status' => 3]);
$res2 = $this->dao->update($id, ['stop_time' => time() - 1, 'k_id' => $kCount['id'], 'is_refund' => $kCount['id'], 'status' => 3]);
} else {
$res1 = true;
$res2 = $this->dao->update($id, ['stop_time' => time() - 1, 'k_id' => 0, 'is_refund' => $id, 'status' => 3]);
$res2 = $this->dao->update($id, ['stop_time' => time() - 1, 'is_refund' => $id, 'status' => 3]);
}
//修改结束时间为前一秒 团长ID为0
$res = $res1 && $res2;
} else if ($countY) {//团员
$res = $this->dao->update($countY['id'], ['stop_time' => time() - 1, 'k_id' => 0, 'is_refund' => $id, 'status' => 3]);
$res = $this->dao->update($countY['id'], ['stop_time' => time() - 1, 'is_refund' => $id, 'status' => 3]);
}
return $res;
}
@ -157,6 +157,7 @@ class StorePinkServices extends BaseServices
$where['cid'] = $id;
$where['k_id'] = 0;
$where['is_refund'] = 0;
$where['status'] = 1;
$pinkList = $this->dao->pinkList($where);
$ids = array_column($pinkList, 'id');
$orderIdKey = array_column($pinkList, 'order_id_key');
@ -221,10 +222,10 @@ class StorePinkServices extends BaseServices
{
//查找拼团团员和团长
if ($pink['k_id']) {
$pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['k_id'], 'is_refund' => 0]);
$pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['k_id']]);
$pinkT = $this->dao->getPinkUserOne($pink['k_id']);
} else {
$pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['id'], 'is_refund' => 0]);
$pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['id']]);
$pinkT = $pink;
}
$count = count($pinkAll) + 1;

View File

@ -23,6 +23,7 @@ use app\services\user\UserServices;
use crmeb\exceptions\AdminException;
use crmeb\exceptions\ApiException;
use crmeb\services\FormBuilder;
use think\facade\Db;
/**
*
@ -64,6 +65,7 @@ class StoreCouponIssueServices extends BaseServices
foreach ($list as &$item) {
$item['use_time'] = date('Y-m-d', $item['start_use_time']) . ' ~ ' . date('Y-m-d', $item['end_use_time']);
}
// unset($where['type'], $where['receive_type']);
$count = $this->dao->count($where);
return compact('list', 'count');
}
@ -89,6 +91,14 @@ class StoreCouponIssueServices extends BaseServices
public function saveCoupon($data)
{
if ($data['start_time'] && $data['start_use_time']) {
if ($data['start_time'] < date('Y-m-d 00:00:00')) {
throw new AdminException('开始领取时间不能小于当前时间');
}
if ($data['start_use_time'] < date('Y-m-d 00:00:00')) {
throw new AdminException('开始使用时间不能小于当前时间');
}
if ($data['start_use_time'] < $data['start_time']) {
throw new AdminException(400513);
}
@ -108,7 +118,7 @@ class StoreCouponIssueServices extends BaseServices
if ($data['end_time'] && $data['end_use_time']) {
if ($data['end_use_time'] < $data['end_time']) {
throw new AdminException(400514);
throw new AdminException('用户领取数量不能大于优惠券发布数量');
}
}
@ -372,9 +382,13 @@ class StoreCouponIssueServices extends BaseServices
$issueUserService = app()->make(StoreCouponIssueUserServices::class);
/** @var StoreCouponUserServices $couponUserService */
$couponUserService = app()->make(StoreCouponUserServices::class);
$this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo) {
$this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo, $is_receive) {
$issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]);
$couponUserService->addUserCoupon($uid, $issueCouponInfo, "send");
if ($issueCouponInfo['total_count'] > 0 && $is_receive) {
$issueCouponInfo['remain_count'] -= 1;
$issueCouponInfo->save();
}
});
}

View File

@ -71,7 +71,7 @@ class StoreCouponService extends BaseServices
$f[] = Form::select('category_id', '选择品类')->setOptions(Form::setOptions($options))->filterable(1)->col(12);
break;
case 2://商品券
$f[] = Form::frameImages('image', '商品', Url::buildUrl(config('app.admin_prefix', 'admin') . '/store.StoreProduct/index', array('fodder' => 'image', 'type' => 'many')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->props(['srcKey' => 'image']);
$f[] = Form::frameImages('image', '商品', Url::buildUrl(config('app.admin_prefix', 'admin') . '/store.StoreProduct/index', array('fodder' => 'image', 'type' => 'many')))->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true])->props(['srcKey' => 'image']);
$f[] = Form::hidden('product_id', '');
break;
}

View File

@ -75,14 +75,14 @@ class LiveAnchorServices extends BaseServices
$field[] = Form::input('name', '主播名称', '')->maxlength(20)->required('请填写名称');
$field[] = Form::input('wechat', '主播微信号', '')->maxlength(32)->required('请填写微信号');
$field[] = Form::input('phone', '主播手机号', '')->maxlength(20)->required('请填写手机号');
$field[] = Form::frameImage('cover_img', '主播图像', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'cover_img')), '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->appendValidate(Validate::str()->required('请选择图像'));
$field[] = Form::frameImage('cover_img', '主播图像', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'cover_img')), '')->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true])->appendValidate(Validate::str()->required('请选择图像'));
} else {
$title = '修改主播';
$field[] = Form::hidden('id', $anchor->getData('id'));
$field[] = Form::input('name', '主播名称', $anchor->getData('name'))->maxlength(20)->required('请填写名称');
$field[] = Form::input('wechat', '主播微信号', $anchor->getData('wechat'))->maxlength(32)->required('请填写微信号');
$field[] = Form::input('phone', '主播手机号', $anchor->getData('phone'))->maxlength(20)->required('请填写手机号');
$field[] = Form::frameImage('cover_img', '主播图像', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'cover_img')), $anchor->getData('cover_img'))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->appendValidate(Validate::str()->required('请选择图像'));
$field[] = Form::frameImage('cover_img', '主播图像', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'cover_img')), $anchor->getData('cover_img'))->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true])->appendValidate(Validate::str()->required('请选择图像'));
}
return create_form($title, $field, $this->url('/live/anchor/save'), 'POST');
}

View File

@ -212,7 +212,7 @@ class LuckLotteryRecordServices extends BaseServices
/** @var StoreCouponIssueServices $couponIssueService */
$couponIssueService = app()->make(StoreCouponIssueServices::class);
try {
$couponIssueService->issueUserCoupon($prize['coupon_id'], $userInfo, true);
$couponIssueService->issueUserCoupon($prize['coupon_id'], $userInfo);
} catch (\Throwable $e) {
Log::error('抽奖领取优惠券失败,原因:' . $e->getMessage());
}

View File

@ -262,7 +262,7 @@ class AgentLevelServices extends BaseServices
{
$field[] = Form::input('name', '等级名称')->maxlength(8)->col(24);
$field[] = Form::number('grade', '等级', 0)->min(0)->precision(0);
$field[] = Form::frameImage('image', '背景图', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$field[] = Form::frameImage('image', '背景图', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image')))->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
$field[] = Form::number('one_brokerage', '一级上浮', 0)->appendRule('suffix', [
'type' => 'div',
'class' => 'tips-info',
@ -292,7 +292,7 @@ class AgentLevelServices extends BaseServices
$field[] = Form::hidden('id', $id);
$field[] = Form::input('name', '等级名称', $levelInfo['name'])->maxlength(8)->col(24);
$field[] = Form::number('grade', '等级', $levelInfo['grade'])->min(0)->precision(0);
$field[] = Form::frameImage('image', '背景图', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image')), $levelInfo['image'])->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$field[] = Form::frameImage('image', '背景图', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image')), $levelInfo['image'])->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
$field[] = Form::number('one_brokerage', '一级上浮', $levelInfo['one_brokerage'])->appendRule('suffix', [
'type' => 'div',
'class' => 'tips-info',

View File

@ -75,7 +75,7 @@ class ArticleCategoryServices extends BaseServices
$f[] = Form::select('pid', '上级分类', (int)($info['pid'] ?? ''))->setOptions($this->menus($pid))->filterable(1);
$f[] = Form::input('title', '分类名称', $info['title'] ?? '')->maxlength(20)->required();
$f[] = Form::input('intr', '分类简介', $info['intr'] ?? '')->type('textarea')->required();
$f[] = Form::frameImage('image', '分类图片', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image')), $info['image'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$f[] = Form::frameImage('image', '分类图片', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image')), $info['image'] ?? '')->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
$f[] = Form::number('sort', '排序', (int)($info['sort'] ?? 0))->precision(0);
$f[] = Form::radio('status', '状态', $info['status'] ?? 1)->options([['value' => 1, 'label' => '显示'], ['value' => 0, 'label' => '隐藏']]);
return create_form('添加分类', $f, Url::buildUrl($url), $method);

View File

@ -91,9 +91,9 @@ class StoreServiceServices extends BaseServices
public function createServiceForm(array $formData = [])
{
if ($formData) {
$field[] = $this->builder->frameImage('avatar', '客服头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'avatar'], true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$field[] = $this->builder->frameImage('avatar', '客服头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'avatar'], true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
} else {
$field[] = $this->builder->frameImage('image', '选择用户', $this->url(config('app.admin_prefix', 'admin') . '/system.user/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
$field[] = $this->builder->frameImage('image', '选择用户', $this->url(config('app.admin_prefix', 'admin') . '/system.user/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
$field[] = $this->builder->hidden('uid', 0);
$field[] = $this->builder->hidden('avatar', '');
}

View File

@ -66,12 +66,12 @@ class SmsService extends NoticeService
$this->isOpen = $this->noticeInfo['is_sms'] === 1;
$mark = $this->noticeInfo['mark'];
if ($this->isOpen) {
try{
try {
/** @var SmsService $smsServices */
$smsServices = app()->make(SmsService::class);
$smsServices->send(true, $phone, $data, $mark);
return true;
}catch (\Throwable $e) {
} catch (\Throwable $e) {
Log::error('发送短信失败,失败原因:' . $e->getMessage());
}
//SmsJob::dispatch('doJob', [$phone, $data, $mark]);

View File

@ -80,9 +80,9 @@ class DeliveryServiceServices extends BaseServices
public function createServiceForm(array $formData = [])
{
if ($formData) {
$field[] = $this->builder->frameImage('avatar', '配送员头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'avatar'], true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$field[] = $this->builder->frameImage('avatar', '配送员头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => 'avatar'], true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
} else {
$field[] = $this->builder->frameImage('image', '商城用户', $this->url(config('app.admin_prefix', 'admin') . '/system.user/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
$field[] = $this->builder->frameImage('image', '商城用户', $this->url(config('app.admin_prefix', 'admin') . '/system.user/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
$field[] = $this->builder->hidden('uid', 0);
$field[] = $this->builder->hidden('avatar', '');
}

View File

@ -346,6 +346,9 @@ class OtherOrderServices extends BaseServices
if ($spread_two && $spread_two_price > 0) $this->memberBrokerage($spread_two, $spread_two_price, 'get_two_member_brokerage', $orderInfo);
}
$orderInfo['pay_type'] = $paytype;
// 小程序订单服务
event('OrderShipping', ['member', $orderInfo, 3, '', '']);
return false !== $res;
}

View File

@ -556,14 +556,7 @@ class StoreCartServices extends BaseServices
*/
public function handleCartList(int $uid, array $cartList, array $addr = [], int $shipping_type = 1)
{
if (!$cartList) {
return [$cartList, [], []];
}
/** @var StoreProductServices $productServices */
$productServices = app()->make(StoreProductServices::class);
/** @var MemberCardServices $memberCardService */
$memberCardService = app()->make(MemberCardServices::class);
$vipStatus = $memberCardService->isOpenMemberCard('vip_price', false);
if (!$cartList) return [$cartList, [], []];
$tempIds = [];
$userInfo = [];
$discount = 100;
@ -578,6 +571,12 @@ class StoreCartServices extends BaseServices
$discount = $systemLevel->value(['id' => $userInfo['level'], 'is_del' => 0, 'is_show' => 1], 'discount') ?: 100;
}
}
//付费会员是否开启,用户是否是付费会员,两个都满足,订单计算金额才会按照付费会员计算。
/** @var MemberCardServices $memberCardService */
$memberCardService = app()->make(MemberCardServices::class);
$vipStatus = $memberCardService->isOpenMemberCard('vip_price', false) && $userInfo['is_money_level'] > 0;
//不送达运费模板
if ($shipping_type == 1 && $addr) {
$cityId = (int)($addr['city_id'] ?? 0);
@ -596,6 +595,8 @@ class StoreCartServices extends BaseServices
}
}
/** @var StoreProductServices $productServices */
$productServices = app()->make(StoreProductServices::class);
$valid = $invalid = [];
foreach ($cartList as &$item) {
$item['productInfo']['express_delivery'] = false;

View File

@ -440,6 +440,15 @@ class StoreOrderDeliveryServices extends BaseServices
/** @var StoreOrderCartInfoServices $orderInfoServices */
$orderInfoServices = app()->make(StoreOrderCartInfoServices::class);
$storeName = $orderInfoServices->getCarIdByProductTitle((int)$orderInfo->id);
if (isset($data['pickup_time']) && count($data['pickup_time']) == 2) {
$data['pickup_start_time'] = $data['pickup_time'][0];
$data['pickup_end_time'] = $data['pickup_time'][1];
} else {
$data['pickup_start_time'] = '';
$data['pickup_end_time'] = '';
}
// 发货信息录入
$res = [];
switch ($type) {
@ -463,7 +472,8 @@ class StoreOrderDeliveryServices extends BaseServices
if (!$data['delivery_id']) {
$data['delivery_id'] = uniqid();
}
event('OrderShipping', [$orderInfo, $type, $data['delivery_id'], $data['delivery_name']]);
// 小程序订单管理
event('OrderShipping', ['product', $orderInfo, $type, $data['delivery_id'], $data['delivery_name']]);
//到期自动收货
event('OrderDeliveryListener', [$orderInfo, $storeName, $data, $type]);
return $res;
@ -560,47 +570,81 @@ class StoreOrderDeliveryServices extends BaseServices
$expData['temp_id'] = $data['express_temp_id'];
$expData['weight'] = $this->getOrderSumWeight($id);
$expData['cargo'] = $orderInfoServices->getCarIdByProductTitle((int)$orderInfo->id, true);
if (!sys_config('config_shippment_open', 0)) {
throw new AdminException('商家寄件未开启无法寄件');
}
$expData['day_type'] = $data['day_type'];
$expData['pickup_start_time'] = $data['pickup_start_time'];
$expData['pickup_end_time'] = $data['pickup_end_time'];
// if (!sys_config('config_shippment_open', 0)) {
// throw new AdminException('商家寄件未开启无法寄件');
// }
$dump = $expressService->express()->shippmentCreateOrder($expData);
Log::error('商家寄件返回数据:' . json_encode($dump));
$orderInfo->delivery_id = $dump['kuaidinum'] ?? '';
$data['express_dump'] = json_encode([
'com' => $expData['com'],
'from_name' => $expData['from_name'],
'from_tel' => $expData['from_tel'],
'from_addr' => $expData['from_addr'],
'com' => $expData['kuaidicom'],
'from_name' => $expData['send_real_name'],
'from_tel' => $expData['send_phone'],
'from_addr' => $expData['send_address'],
'temp_id' => $expData['temp_id'],
'cargo' => $expData['cargo'],
]);
$data['delivery_id'] = $dump['kuaidinum'] ?? '';
$data['kuaidi_label'] = $dump['label'] ?? '';
$data['kuaidi_task_id'] = $dump['taskId'] ?? '';
$data['kuaidi_order_id'] = $dump['orderId'] ?? '';
$data['kuaidi_task_id'] = $dump['task_id'] ?? '';
$data['kuaidi_order_id'] = $dump['order_id'] ?? '';
} else {
if (!$data['delivery_id']) {
throw new AdminException(400531);
}
$orderInfo->delivery_id = $data['delivery_id'];
}
$data['status'] = 1;
$orderInfo->delivery_type = $data['delivery_type'];
$orderInfo->delivery_name = $data['delivery_name'];
$orderInfo->status = $data['status'];
/** @var StoreOrderStatusServices $services */
$services = app()->make(StoreOrderStatusServices::class);
$this->transaction(function () use ($id, $data, $services) {
$res = $this->dao->update($id, $data);
$res = $res && $services->save([
'oid' => $id,
'change_time' => time(),
'change_type' => 'delivery_goods',
'change_message' => '已发货 快递公司:' . $data['delivery_name'] . ' 快递单号:' . $data['delivery_id']
]);
if (!$res) {
throw new AdminException(400529);
}
});
if ($data['express_record_type'] != 3) {
$data['status'] = 1;
$orderInfo->delivery_type = $data['delivery_type'];
$orderInfo->delivery_name = $data['delivery_name'];
$orderInfo->status = $data['status'];
/** @var StoreOrderStatusServices $services */
$services = app()->make(StoreOrderStatusServices::class);
$this->transaction(function () use ($id, $data, $services) {
$res = $this->dao->update($id, $data);
$res = $res && $services->save([
'oid' => $id,
'change_time' => time(),
'change_type' => 'delivery_goods',
'change_message' => '已发货 快递公司:' . $data['delivery_name'] . ' 快递单号:' . $data['delivery_id']
]);
if (!$res) {
throw new AdminException(400529);
}
});
} else {
$update = [
'is_stock_up' => 1,
'delivery_type' => $data['delivery_type'],
'delivery_name' => $data['delivery_name'],
'delivery_code' => $data['delivery_code'],
'delivery_id' => $data['delivery_id'],
'kuaidi_label' => $data['kuaidi_label'],
'kuaidi_task_id' => $data['kuaidi_task_id'],
'kuaidi_order_id' => $data['kuaidi_order_id'],
'express_dump' => $data['express_dump']
];
/** @var StoreOrderStatusServices $services */
$services = app()->make(StoreOrderStatusServices::class);
$this->transaction(function () use ($id, $data, $services, $update) {
$res = $this->dao->update($id, $update);
$res = $res && $services->save([
'oid' => $id,
'change_time' => time(),
'change_type' => 'stock_up_goods',
'change_message' => '备货中 快递公司:' . $data['delivery_name'] . ' 快递单号:' . $data['delivery_id']
]);
if (!$res) {
throw new AdminException(400529);
}
});
}
return $dump;
}

View File

@ -35,6 +35,7 @@ use crmeb\services\CacheService;
use crmeb\services\FormBuilder as Form;
use crmeb\services\pay\Pay;
use crmeb\services\workerman\ChannelService;
use think\facade\Db;
/**
@ -434,18 +435,22 @@ class StoreOrderRefundServices extends BaseServices
/** @var StoreOrderStatusServices $statusService */
$statusService = app()->make(StoreOrderStatusServices::class);
$res = true;
//取消的订单退回优惠券
if ($type == 'cancel' && $order['coupon_id'] && $order['coupon_price']) {
//取消或者退款的订单退回优惠券
if ($order['coupon_id'] && $order['coupon_price']) {
/** @var StoreCouponUserServices $couponUserServices */
$couponUserServices = app()->make(StoreCouponUserServices::class);
$res = $couponUserServices->recoverCoupon((int)$order['coupon_id']);
$statusService->save([
'oid' => $order['id'],
'change_type' => 'coupon_back',
'change_message' => '商品退优惠券',
'change_time' => time()
]);
//未支付取消订单,或者退优惠券开关打开之后的主订单以及最后一个子订单退还优惠券
if ($type == 'cancel' || (sys_config('coupon_return_open', 1) && ($order['pid'] == 0 || $this->storeOrderServices->count(['pid' => $order['pid'], 'refund_status' => 0]) == 1))) {
$res = $couponUserServices->recoverCoupon((int)$order['coupon_id']);
$statusService->save([
'oid' => $order['id'],
'change_type' => 'coupon_back',
'change_message' => '商品退优惠券',
'change_time' => time()
]);
}
}
//回退积分
$order = $this->regressionIntegral($order);
$statusService->save([
@ -596,7 +601,7 @@ class StoreOrderRefundServices extends BaseServices
$userInfo = $userServices->get($order['uid']);
$order['nickname'] = $userInfo['nickname'];
$order['phone'] = $userInfo['phone'];
if (in_array($orderInfo['pay_type'], ['weixin', 'alipay', 'allinpay', 'offline'])) {
if (in_array($order['pay_type'], ['weixin', 'alipay', 'allinpay', 'offline'])) {
$capitalFlowServices->setFlow($order, 'refund');
}
@ -683,7 +688,7 @@ class StoreOrderRefundServices extends BaseServices
$storeOrderServices->update($oid, ['refund_status' => 0, 'refund_type' => 3]);
//处理订单商品cart_info
$this->cancelOrderRefundCartInfo($id, $oid, $orderRefundInfo);
$this->cancelOrderRefundCartInfo($id, $oid, $orderRefundInfo, '不退款原因:' . ($data['refund_reason'] ?? ''));
//记录
/** @var StoreOrderStatusServices $statusService */
$statusService = app()->make(StoreOrderStatusServices::class);
@ -1272,7 +1277,7 @@ class StoreOrderRefundServices extends BaseServices
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function cancelOrderRefundCartInfo(int $id, int $oid, $orderRefundInfo = [])
public function cancelOrderRefundCartInfo(int $id, int $oid, $orderRefundInfo = [], string $title = '')
{
if (!$orderRefundInfo) {
$orderRefundInfo = $this->dao->get(['id' => $id, 'is_cancel' => 0]);
@ -1301,7 +1306,7 @@ class StoreOrderRefundServices extends BaseServices
$statusService->save([
'oid' => $oid,
'change_type' => 'cancel_refund_order',
'change_message' => '取消退款',
'change_message' => $title ?: '取消退款',
'change_time' => time()
]);

View File

@ -101,10 +101,13 @@ class StoreOrderServices extends BaseServices
foreach ($data as &$item) {
$refund_num = array_sum(array_column($item['refund'], 'refund_num'));
$cart_num = 0;
$vipTruePrice = 0;
foreach ($item['_info'] as $items) {
$cart_num += $items['cart_info']['cart_num'];
$vipTruePrice = bcadd((string)$vipTruePrice, (string)$items['cart_info']['vip_truePrice'], 2);
}
$item['is_all_refund'] = $refund_num == $cart_num ? true : false;
$item['total_price'] = bcadd($item['total_price'], $vipTruePrice, 2);
$item['is_all_refund'] = $refund_num == $cart_num;
}
return compact('data', 'count');
}
@ -754,7 +757,7 @@ HTML;
$f[] = Form::number('total_price', '商品总价', (float)$product->getData('total_price'))->min(0)->disabled(true);
$f[] = Form::number('pay_postage', '支付邮费', (float)$product->getData('pay_postage') ?: 0)->disabled(true);
$f[] = Form::number('pay_price', '实际支付金额', (float)$product->getData('pay_price'))->min(0);
$f[] = Form::number('gain_integral', '赠送积分', (float)$product->getData('gain_integral') ?: 0);
$f[] = Form::number('gain_integral', '赠送积分', (float)$product->getData('gain_integral') ?: 0)->min(0);
return create_form('修改订单', $f, $this->url('/order/update/' . $id), 'PUT');
}
@ -793,6 +796,12 @@ HTML;
'change_time' => time(),
'change_message' => '修改商品总价为:' . $data['total_price'] . ' 实际支付金额' . $data['pay_price']
]);
$res = $res && $services->save([
'oid' => $id,
'change_type' => 'order_edit',
'change_time' => time(),
'change_message' => '修改订单赠送积分为:' . $data['gain_integral']
]);
if ($res) {
$order = $this->dao->getOne(['id' => $id, 'is_del' => 0]);
//改价短信提醒
@ -2498,8 +2507,16 @@ HTML;
}
// 判断是否开启小程序订单管理
$orderData['order_shipping_open'] = false;
if (sys_config('order_shipping_open', 0) && MiniOrderService::isManaged()) {
$orderData['order_shipping_open'] = true;
if (sys_config('order_shipping_open', 0) && MiniOrderService::isManaged() && $order['is_channel'] == 1 && $order['pay_type'] == 'weixin') {
// 判断是否存在子未收货子订单
if ($order['pid'] > 0) {
if ($this->checkSubOrderNotTake((int)$order['pid'], (int)$order['id'])) {
$orderData['order_shipping_open'] = true;
}
} else {
$orderData['order_shipping_open'] = true;
}
}
return $orderData;
}
@ -2654,15 +2671,15 @@ HTML;
/**
* 取消商家寄件
* @author 等风来
* @email 136327134@qq.com
* @date 2023/5/15
* @param int $id
* @param string $msg
* @return array|mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 等风来
* @email 136327134@qq.com
* @date 2023/5/15
*/
public function shipmentCancelOrder(int $id, string $msg)
{
@ -2673,21 +2690,17 @@ HTML;
if (!$orderInfo->kuaidi_task_id || !$orderInfo->kuaidi_order_id) {
throw new ValidateException('商家寄件订单信息不存在,无法取消');
}
if ($orderInfo->status != 1) {
if ($orderInfo->is_stock_up != 1) {
throw new ValidateException('订单状态不正确,无法取消寄件');
}
//发起取消商家寄件
$res = app()->make(ServeServices::class)->express()->shipmentCancelOrder([
app()->make(ServeServices::class)->express()->shipmentCancelOrder([
'task_id' => $orderInfo->kuaidi_task_id,
'order_id' => $orderInfo->kuaidi_order_id,
'cancel_msg' => $msg,
]);
if ($res['status'] != 200) {
throw new ValidateException($res['msg'] ?? '一号通:取消失败');
}
//订单返回原状态
$this->transaction(function () use ($id, $msg, $orderInfo) {
app()->make(StoreOrderStatusServices::class)->save([
@ -2698,10 +2711,19 @@ HTML;
]);
$orderInfo->status = 0;
$orderInfo->is_stock_up = 0;
$orderInfo->kuaidi_task_id = '';
$orderInfo->kuaidi_order_id = '';
$orderInfo->express_dump = '';
$orderInfo->kuaidi_label = '';
$orderInfo->delivery_id = '';
$orderInfo->delivery_code = '';
$orderInfo->delivery_name = '';
$orderInfo->delivery_type = '';
$orderInfo->save();
});
return $res;
return true;
}
public function checkSubOrderNotSend(int $pid, int $order_id)
@ -2713,4 +2735,14 @@ HTML;
return true;
}
}
public function checkSubOrderNotTake(int $pid, int $order_id)
{
$order_count = $this->dao->getSubOrderNotTake($pid, $order_id);
if ($order_count > 0) {
return false;
} else {
return true;
}
}
}

View File

@ -100,6 +100,11 @@ class StoreOrderSuccessServices extends BaseServices
event('NoticeListener', [$orderInfo, 'admin_pay_success_code']);
// 推送订单
event('OutPushListener', ['order_pay_push', ['order_id' => (int)$orderInfo['id']]]);
// 小程序订单管理 (自提商品)
if ($orderInfo['shipping_type'] == 2) {
event('OrderShipping', ['product', $orderInfo, 4, '', '']);
}
$res = $res1 && $resPink;
return false !== $res;
}

View File

@ -42,6 +42,37 @@ class StoreOrderTakeServices extends BaseServices
$this->dao = $dao;
}
/**
* 小程序订单服务收货
* @param $merchant_trade_no
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*
* @date 2023/05/18
* @author yyw
*/
public function miniOrderTakeOrder($merchant_trade_no)
{
//查找订单信息
$order = $this->dao->getOne(['order_id' => $merchant_trade_no]);
if (!$order) {
return true;
}
if ($order['pid'] == -1) { // 有子订单
// 查找待收货的子订单
$son_order_list = $this->dao->getSubOrderNotSendList((int)$order['id']);
foreach ($son_order_list as $son_order) {
$this->takeOrder($son_order['order_id'], $son_order['uid']);
}
} else {
$this->takeOrder($merchant_trade_no, $order['uid']);
}
return true;
}
/**
* 用户订单收货
* @param $uni

View File

@ -141,7 +141,7 @@ class QrcodeServices extends BaseServices
/** @var SystemAttachmentServices $systemAttchment */
$systemAttchment = app()->make(SystemAttachmentServices::class);
try {
$imageInfo = $systemAttchment->getInfo(['name'=>$name]);
$imageInfo = $systemAttchment->getInfo(['name' => $name]);
$siteUrl = sys_config('site_url');
if (!$imageInfo) {
$codeUrl = PosterServices::setHttpType($siteUrl . $link, request()->isSsl() ? 0 : 1);//二维码链接
@ -165,6 +165,7 @@ class QrcodeServices extends BaseServices
return '';
}
}
/**
* 获取二维码完整路径,不存在则自动生成
* @param string $name

View File

@ -63,6 +63,24 @@ class UploadService
'appid' => sys_config('tengxun_appid'),
];
break;
case 5://京东云
$config = [
'accessKey' => sys_config('jd_accessKey'),
'secretKey' => sys_config('jd_secretKey'),
];
break;
case 6://华为云
$config = [
'accessKey' => sys_config('hw_accessKey'),
'secretKey' => sys_config('hw_secretKey'),
];
break;
case 7://天翼云
$config = [
'accessKey' => sys_config('ty_accessKey'),
'secretKey' => sys_config('ty_secretKey'),
];
break;
case 1:
break;
default:
@ -77,6 +95,7 @@ class UploadService
$config['uploadUrl'] = $res['domain'];
$config['storageName'] = $res['name'];
$config['storageRegion'] = $res['region'];
$config['cdn'] = $res['cdn'];
}
$thumb = SystemConfigService::more(['thumb_big_height', 'thumb_big_width', 'thumb_mid_height', 'thumb_mid_width', 'thumb_small_height', 'thumb_small_width',]);
@ -116,7 +135,7 @@ class UploadService
/** @var SystemStorageServices $storageServices */
$storageServices = app()->make(SystemStorageServices::class);
$storageArr = $storageServices->cacheDriver()->remember('storage_list', function () use ($storageServices) {
return $storageServices->selectList([], 'domain')->toArray();
return $storageServices->selectList([], 'domain,type')->toArray();
});
foreach ($storageArr as $item) {
if ($fileHost == $item['domain']) {

View File

@ -129,7 +129,11 @@ class ExportServices extends BaseServices
}
$custom_form = '';
foreach ($item['custom_form'] as $custom_form_value) {
$custom_form .= $custom_form_value['title'] . ':' . $custom_form_value['value'] . ';';
if (is_string($custom_form_value['value'])) {
$custom_form .= $custom_form_value['title'] . ':' . $custom_form_value['value'] . ';';
} elseif (is_array($custom_form_value['value'])) {
$custom_form .= $custom_form_value['title'] . ':' . implode(',', $custom_form_value['value']) . ';';
}
}
$goodsName = [];
@ -354,8 +358,8 @@ class ExportServices extends BaseServices
$one_data = [
'card_number' => $item['card_number'],
'card_password' => $item['card_password'],
'user_name' => $userList[$item['use_uid']]['real_name'] ?: $userList[$item['use_uid']]['nickname'],
'user_phone' => $userList[$item['use_uid']] ? $userList[$item['use_uid']]['phone'] : "",
'user_name' => $userList[$item['use_uid']]['real_name'] ?? $userList[$item['use_uid']]['nickname'] ?? '',
'user_phone' => $userList[$item['use_uid']]['phone'] ?? "",
'use_time' => $item['use_time'],
'use_uid' => $item['use_uid'] ? '已领取' : '未领取'
];

View File

@ -106,7 +106,7 @@ class OrderPayServices
*/
public function beforePay(array $orderInfo, string $payType, array $options = [])
{
$wehcat = $payType == PayServices::WEIXIN_PAY;
$wechat = $payType == PayServices::WEIXIN_PAY;
$payType = $this->getPayType($payType);
@ -136,8 +136,8 @@ class OrderPayServices
$options['openid'] = $openid;
break;
case PayServices::ALLIN_PAY:
if ($wehcat) {
$options['wechat'] = $wehcat;
if ($wechat) {
$options['wechat'] = $wechat;
}
break;
}

View File

@ -12,6 +12,7 @@ declare (strict_types=1);
namespace app\services\pc;
use app\services\activity\coupon\StoreCouponIssueServices;
use app\services\BaseServices;
use app\services\product\product\StoreCategoryServices;
use app\services\product\product\StoreProductServices;
@ -42,6 +43,7 @@ class HomeServices extends BaseServices
} else {
$item['star'] = '3.0';
}
$item['checkCoupon'] = app()->make(StoreCouponIssueServices::class)->checkProductCoupon($item['id']);
}
$info['productList'] = get_thumb_water($productList, 'big');
}

View File

@ -97,11 +97,11 @@ class StoreCategoryServices extends BaseServices
if ($show !== '') $where['is_show'] = $show;
if (!$type) $where['pid'] = 0;
$data = get_tree_children($this->dao->getTierList($where, ['id', 'id as value', 'cate_name as label', 'cate_name as title', 'pid']), 'children', 'id');
foreach ($data as &$item) {
if (!isset($item['children'])) {
$item['disabled'] = true;
}
}
// foreach ($data as &$item) {
// if (!isset($item['children'])) {
// $item['disabled'] = true;
// }
// }
return $data;
}
@ -156,8 +156,8 @@ class StoreCategoryServices extends BaseServices
$f[] = Form::select('pid', '上级分类', (int)($info['pid'] ?? ''))->setOptions($this->menus())->filterable(1);
}
$f[] = Form::input('cate_name', '分类名称', $info['cate_name'] ?? '')->maxlength(8)->required();
$f[] = Form::frameImage('pic', '分类图标(180*180)', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'pic')), $info['pic'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$f[] = Form::frameImage('big_pic', '分类大图(468*340)', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'big_pic')), $info['big_pic'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$f[] = Form::frameImage('pic', '分类图标(180*180)', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'pic')), $info['pic'] ?? '')->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
$f[] = Form::frameImage('big_pic', '分类大图(468*340)', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'big_pic')), $info['big_pic'] ?? '')->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
$f[] = Form::number('sort', '排序', (int)($info['sort'] ?? 0))->min(0)->precision(0);
$f[] = Form::radio('is_show', '状态', $info['is_show'] ?? 1)->options([['label' => '显示', 'value' => 1], ['label' => '隐藏', 'value' => 0]]);
return $f;

View File

@ -63,16 +63,16 @@ class StoreProductReplyServices extends BaseServices
public function createForm(int $product_id)
{
if ($product_id == 0) {
$field[] = Form::frameImage('image', '商品', Url::buildUrl(config('app.admin_prefix', 'admin') . '/store.StoreProduct/index', array('fodder' => 'image')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
$field[] = Form::frameImage('image', '商品', Url::buildUrl(config('app.admin_prefix', 'admin') . '/store.StoreProduct/index', array('fodder' => 'image')))->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
} else {
$field[] = Form::hidden('product_id', $product_id);
}
$field[] = Form::frameImage('avatar', '用户头像', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'avatar')))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$field[] = Form::frameImage('avatar', '用户头像', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'avatar')))->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
$field[] = Form::input('nickname', '用户名称')->col(24);
$field[] = Form::input('comment', '评价文字')->type('textarea');
$field[] = Form::rate('product_score', '商品分数', 0)->allowHalf(false);
$field[] = Form::rate('service_score', '服务分数', 0)->allowHalf(false);
$field[] = Form::frameImages('pics', '评价图片', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'pics', 'type' => 'many', 'maxLength' => 8)))->maxLength(8)->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->props(['closeBtn' => false, 'okBtn' => false]);
$field[] = Form::frameImages('pics', '评价图片', Url::buildUrl(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'pics', 'type' => 'many', 'maxLength' => 8)))->maxLength(8)->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true])->props(['closeBtn' => false, 'okBtn' => false]);
$field[] = Form::dateTime('add_time', '评论时间', '')->placeholder('请选择评论时间(不选择默认当前添加时间)')->style(['width' => '300px']);
return create_form('添加虚拟评论', $field, Url::buildUrl('/product/reply/save_fictitious_reply'), 'POST');
}
@ -131,10 +131,12 @@ class StoreProductReplyServices extends BaseServices
public function getRecProductReply(int $productId)
{
$res = $this->dao->getProductReply($productId);
if ($res) {
$res = $res->toArray();
// $res['cart_info'] = isset($res['cart_info']) ? json_decode($res['cart_info'], true) : [];
$res['suk'] = isset($res['cart_info']['productInfo']['attrInfo']) ? $res['cart_info']['productInfo']['attrInfo']['suk'] : '';
if ($res['suk'] == '') {
$res['suk'] = isset($res['cart_info']['productInfo']['attrInfo']) ? $res['cart_info']['productInfo']['attrInfo']['suk'] : '';
}
$res['nickname'] = anonymity($res['nickname']);
$res['merchant_reply_time'] = date('Y-m-d H:i', $res['merchant_reply_time']);
$res['add_time'] = time_tran($res['add_time']);
@ -214,7 +216,7 @@ class StoreProductReplyServices extends BaseServices
[$page, $limit] = $this->getPageValue();
$list = $this->dao->replyList($id, $type, $page, $limit);
foreach ($list as &$item) {
$item['suk'] = isset($item['cart_info']['productInfo']['attrInfo']) ? $item['cart_info']['productInfo']['attrInfo']['suk'] : '';
$item['suk'] = $item['suk'] != '' ? $item['suk'] : (isset($item['cart_info']['productInfo']['attrInfo']) ? $item['cart_info']['productInfo']['attrInfo']['suk'] : '');
$item['nickname'] = anonymity($item['nickname']);
$item['merchant_reply_time'] = date('Y-m-d H:i', $item['merchant_reply_time']);
$item['add_time'] = time_tran($item['add_time']);

View File

@ -127,6 +127,9 @@ class StoreProductServices extends BaseServices
/** @var StoreCategoryServices $categoryService */
$categoryService = app()->make(StoreCategoryServices::class);
$cateList = $categoryService->getCateParentAndChildName($cateIds);
$preantCateList = $categoryService->getColumn([
['id', 'in', $cateIds]
], 'cate_name', 'id');
foreach ($list as &$item) {
$cateName = array_filter($cateList, function ($val) use ($item) {
if (in_array($val['id'], explode(',', $item['cate_id']))) {
@ -137,6 +140,9 @@ class StoreProductServices extends BaseServices
foreach ($cateName as $k => $v) {
$item['cate_name'][] = $v['one'] . '/' . $v['two'];
}
if (!count($item['cate_name']) && isset($preantCateList[$item['cate_id']])) {
$item['cate_name'][] = $preantCateList[$item['cate_id']];
}
$item['cate_name'] = is_array($item['cate_name']) ? implode(',', $item['cate_name']) : '';
$item['stock_attr'] = $item['stock'] > 0;//库存
$item['product_type'] = $this->productType[$item['virtual_type']];
@ -620,7 +626,7 @@ class StoreProductServices extends BaseServices
$cateGory = $storeCategoryServices->getColumn([['id', 'IN', $cate_id]], 'id,pid', 'id');
foreach ($cate_id as $cid) {
if ($cid && isset($cateGory[$cid]['pid'])) {
$cateData[] = ['product_id' => $id, 'cate_id' => $cid, 'cate_pid' => $cateGory[$cid]['pid'], 'status' => $data['is_show'], 'add_time' => $time];
$cateData[] = ['product_id' => $id, 'cate_id' => $cid, 'cate_pid' => $cateGory[$cid]['pid'] ?: $cid, 'status' => $data['is_show'], 'add_time' => $time];
}
}
$storeProductCateServices->change($id, $cateData);
@ -661,7 +667,7 @@ class StoreProductServices extends BaseServices
ProductCopyJob::dispatch('copySliderImage', [$res->id, $s_image, count($slider_image)]);
} else {
//下载图片
$s_image_down[] = app()->make(CopyTaobaoServices::class)->downloadCopyImage($s_image);
$s_image_down[] = app()->make(CopyTaobaoServices::class)->downloadCopyImage(!is_int(strpos($s_image, 'http')) ? 'http://' . ltrim($s_image, '\//') : $s_image);
}
}
@ -676,9 +682,20 @@ class StoreProductServices extends BaseServices
}
}
//下载商品规格图
$productAttrValue = app()->make(StoreProductAttrValueServices::class);
$attrValueList = $productAttrValue->getColumn(['product_id' => $res->id, 'type' => 0], 'image', 'id');
foreach ($attrValueList as $value_id => $value_image) {
if (sys_config('queue_open', 0) == 1) {
ProductCopyJob::dispatch('copyAttrImage', [$value_id, $value_image]);
} else {
$v_img = app()->make(CopyTaobaoServices::class)->downloadCopyImage(!is_int(strpos($value_image, 'http')) ? 'http://' . ltrim($value_image, '\//') : $value_image);
$productAttrValue->update($value_id, ['image' => $v_img]);
}
}
if (sys_config('queue_open', 0) == 0) {
$this->update($res->id, ['slider_image' => $s_image_down ? json_encode($s_image_down) : '', 'image' => $s_image_down[0]]);
app()->make(StoreProductAttrValueServices::class)->update(['product_id' => $res->id], ['image' => $s_image_down[0]]);
$storeDescriptionServices->saveDescription((int)$res->id, $description);
}
}
@ -865,6 +882,16 @@ class StoreProductServices extends BaseServices
$item['cost'] = floatval($item['cost']);
$item['is_product_type'] = 1;
$item['logistics'] = explode(',', $item['logistics']);
$attrs = $this->getProductRules($item['id'], 0)['attrs'];
foreach ($attrs as $items) {
$item['attrs'][] = [
'image' => $items['pic'],
'price' => $items['price'],
'ot_price' => $items['ot_price'],
'suk' => implode(',', $items['detail']),
'unique' => $items['unique'],
];
}
}
return $data;
}
@ -942,6 +969,7 @@ class StoreProductServices extends BaseServices
$valueNew[$count]['stock'] = intval($sukValue[$suk]['stock']);
$valueNew[$count]['quota'] = intval($sukValue[$suk]['quota']);
$valueNew[$count]['bar_code'] = $sukValue[$suk]['bar_code'];
$valueNew[$count]['unique'] = $sukValue[$suk]['unique'];
$valueNew[$count]['weight'] = $sukValue[$suk]['weight'] ? floatval($sukValue[$suk]['weight']) : 0;
$valueNew[$count]['volume'] = $sukValue[$suk]['volume'] ? floatval($sukValue[$suk]['volume']) : 0;
$valueNew[$count]['brokerage'] = $sukValue[$suk]['brokerage'] ? floatval($sukValue[$suk]['brokerage']) : 0;

View File

@ -77,10 +77,9 @@ class StoreProductAttrServices extends BaseServices
$productVirtual = app()->make(StoreProductVirtualServices::class);
foreach ($data['valueGroup'] as &$item) {
$res = $storeProductAttrValueServices->save($item);
if ($item['is_virtual'] && (count($item['virtual_list']) || $item['disk_info'] != '') && !$item['coupon_id']) {
if ($item['is_virtual'] && count($item['virtual_list']) && !$item['coupon_id'] && $item['disk_info'] == '') {
$productVirtual->delete(['product_id' => $id, 'attr_unique' => $item['unique'], 'uid' => 0]);
$sales = $productVirtual->count(['product_id' => $id, 'attr_unique' => $item['unique']]);
$storeProductAttrValueServices->update(['id' => $res['id']], ['stock' => $item['stock'] - $sales, 'sales' => $sales]);
foreach ($item['virtual_list'] as &$items) {
$data = [
'product_id' => $id,
@ -93,6 +92,8 @@ class StoreProductAttrServices extends BaseServices
$productVirtual->save($data);
}
}
$allStock = $productVirtual->count(['product_id' => $id, 'attr_unique' => $item['unique']]);
$storeProductAttrValueServices->update(['id' => $res['id']], ['stock' => $allStock - $sales, 'sales' => $sales]);
}
}
return true;

View File

@ -91,7 +91,7 @@ class StoreProductAttrValueServices extends BaseServices
*/
public function getSkuArray(array $where)
{
return $this->dao->getColumn($where, 'bar_code,cost,price,ot_price,stock,image as pic,weight,volume,brokerage,brokerage_two,quota', 'suk');
return $this->dao->getColumn($where, 'bar_code,cost,price,ot_price,stock,image as pic,weight,volume,brokerage,brokerage_two,quota,unique', 'suk');
}
/**

View File

@ -260,7 +260,7 @@ class ExpressServices extends BaseServices
$data['partner_name'] = $express['partner_name'] ?? '';
$data['is_code'] = $express['is_code'] ?? '';
$data['net'] = $express['net'] ?? '';
$data['is_show'] = 1;
$data['is_show'] = 0;
$data['status'] = 0;
if ($express['partner_id'] == 0 && $express['partner_key'] == 0 && $express['net'] == 0 && $express['check_man'] == 0 && $express['partner_name'] == 0 && $express['is_code'] == 0) {
$data['status'] = 1;

View File

@ -86,11 +86,9 @@ class ShippingTemplatesNoDeliveryServices extends BaseServices
{
$freeIdList = $this->dao->getShippingGroupArray(['temp_id' => $tempId], 'uniqid', 'uniqid', '');
$freeData = [];
$infos = $this->dao->getShippingArray(['uniqid' => $freeIdList, 'temp_id' => $tempId], '*', 'uniqid');
foreach ($freeIdList as $uniqid) {
$info = $infos[$uniqid];
$freeData[] = [
'place' => $this->getNoDeliveryTemp($uniqid, $info['province_id']),
'place' => $this->getNoDeliveryTemp($uniqid),
];
}
foreach ($freeData as &$item) {
@ -102,10 +100,9 @@ class ShippingTemplatesNoDeliveryServices extends BaseServices
/**
* 获取不送达的省份
* @param string $uniqid
* @param int $provinceId
* @return array
*/
public function getNoDeliveryTemp(string $uniqid, int $provinceId)
public function getNoDeliveryTemp(string $uniqid)
{
/** @var ShippingTemplatesNoDeliveryCityServices $service */
$service = app()->make(ShippingTemplatesNoDeliveryCityServices::class);
@ -115,7 +112,7 @@ class ShippingTemplatesNoDeliveryServices extends BaseServices
$childrenData[] = [
'city_id' => $item['province_id'],
'name' => $item['name'] ?? '全国',
'children' => $this->getCityTemp($uniqid, $provinceId)
'children' => $this->getCityTemp($uniqid, $item['province_id'])
];
}
return $childrenData;

View File

@ -663,12 +663,12 @@ class TradeStatisticServices extends BaseServices
*/
public function getRechargeTotalMoney(array $where, string $selectType, string $group = "", bool $isNum = false)
{
/** 用户充值金额 */
/** @var UserRechargeServices $userRechageService */
$userRechageService = app()->make(UserRechargeServices::class);
$rechargeSumField = "price";
$whereInRecharge['paid'] = 1;
$whereInRecharge['refund_price'] = '0.00';
$whereInRecharge['no_recharge_type'] = 'system';
$whereInRecharge['timeKey'] = $this->TimeConvert($where['time'], $isNum);
$whereInRecharge['store_id'] = 0;
$totalMoney = $userRechageService->getRechargeMoneyByWhere($whereInRecharge, $rechargeSumField, $selectType, $group);

View File

@ -545,10 +545,6 @@ class SystemCrudServices extends BaseServices
}
}
//读取字段
//读取数据库字段信息
$tableInfo = $this->getTableInfo($tableName);
//获取主键
foreach ($tableField as $value) {
if ($value['primaryKey']) {

View File

@ -76,7 +76,7 @@ class SystemMenusServices extends BaseServices
$systemRoleServices = app()->make(SystemRoleServices::class);
$rules = $systemRoleServices->getRoleArray(['status' => 1, 'id' => $rouleId], 'rules');
$rulesStr = Arr::unique($rules);
$menusList = $this->dao->getMenusRoule(['route' => $level ? $rulesStr : '']);
$menusList = $this->dao->getMenusRoule(['route' => $level ? $rulesStr : '', 'is_show_path' => 1]);
$unique = $this->dao->getMenusUnique(['unique' => $level ? $rulesStr : '']);
return [Arr::getMenuIviewList($this->getMenusData($menusList)), $unique];
}
@ -120,9 +120,10 @@ class SystemMenusServices extends BaseServices
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
protected function getFormCascaderMenus(int $value = 0)
protected function getFormCascaderMenus(int $value = 0, $auth_type = 0)
{
$menuList = $this->dao->getMenusRoule(['is_del' => 0], ['id as value', 'pid', 'menu_name as label']);
$where = ['is_del' => 0];
$menuList = $this->dao->getMenusRoule($where, ['id as value', 'pid', 'menu_name as label']);
$menuList = $this->getMenusData($menuList);
if ($value) {
$data = get_tree_value($menuList, $value);
@ -144,17 +145,14 @@ class SystemMenusServices extends BaseServices
public function createMenusForm(array $formData = [])
{
$field[] = Form::input('menu_name', '按钮名称', $formData['menu_name'] ?? '')->required('按钮名称必填');
// $field[] = Form::select('pid', '父级id', $formData['pid'] ?? 0)->setOptions($this->getFormSelectMenus())->filterable(1);
$field[] = Form::input('menu_path', '路由名称', $formData['menu_path'] ?? '')->placeholder('请输入前台跳转路由地址')->required('请填写前台路由地址');
$field[] = Form::input('unique_auth', '权限标识', $formData['unique_auth'] ?? '')->placeholder('不填写则后台自动生成');
$params = $formData['params'] ?? '';
// $field[] = Form::input('params', '参数', is_array($params) ? '' : $params)->placeholder('举例:a/123/b/234');
$field[] = Form::frameInput('icon', '图标', $this->url(config('app.admin_prefix', 'admin') . '/widget.widgets/icon', ['fodder' => 'icon']), $formData['icon'] ?? '')->icon('md-add')->height('505px')->modal(['footer-hide' => true]);
$field[] = Form::frameInput('icon', '图标', $this->url(config('app.admin_prefix', 'admin') . '/widget.widgets/icon', ['fodder' => 'icon']), $formData['icon'] ?? '')->icon('md-add')->height('560px')->modal(['footer-hide' => true]);
$field[] = Form::number('sort', '排序', (int)($formData['sort'] ?? 0))->precision(0);
$field[] = Form::radio('auth_type', '类型', $formData['auth_type'] ?? 1)->options([['value' => 2, 'label' => '接口'], ['value' => 1, 'label' => '菜单(包含页面按钮)']]);
$field[] = Form::radio('auth_type', '类型', $formData['auth_type'] ?? 1)->options([['value' => 1, 'label' => '菜单'], ['value' => 3, 'label' => '按钮'], ['value' => 2, 'label' => '接口']]);
$field[] = Form::radio('is_show', '权限状态', $formData['is_show'] ?? 1)->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']]);
$field[] = Form::radio('is_show_path', '是否显示', $formData['is_show_path'] ?? 0)->options([['value' => 1, 'label' => '显示'], ['value' => 0, 'label' => '隐藏']]);
[$menuList, $data] = $this->getFormCascaderMenus((int)($formData['pid'] ?? 0));
[$menuList, $data] = $this->getFormCascaderMenus((int)($formData['pid'] ?? 0), 3);
$field[] = Form::cascader('menu_list', '父级id', $data)->data($menuList)->filterable(true);
return $field;
}
@ -248,7 +246,7 @@ class SystemMenusServices extends BaseServices
public function getMenus($roles): array
{
$field = ['menu_name', 'pid', 'id'];
$where = ['is_del' => 0];
$where = ['is_del' => 0, 'is_show_path' => 1];
if (!$roles) {
$menus = $this->dao->getMenusRoule($where, $field);
} else {

View File

@ -295,7 +295,7 @@ class SystemRouteServices extends BaseServices
$delete[] = $item['id'];
$deleteData[] = [
'path' => $item['path'],
'methods' => $item['method']
'method' => $item['method']
];
}
}

View File

@ -257,6 +257,10 @@ class SystemAdminServices extends BaseServices
}
unset($data['conf_pwd']);
if (strlen(trim($data['pwd'])) < 6 || strlen(trim($data['pwd'])) > 32) {
throw new AdminException(400762);
}
if ($this->dao->count(['account' => $data['account'], 'is_del' => 0])) {
throw new AdminException(400596);
}
@ -319,6 +323,11 @@ class SystemAdminServices extends BaseServices
if ($data['conf_pwd'] != $data['pwd']) {
throw new AdminException(400264);
}
if (strlen(trim($data['pwd'])) < 6 || strlen(trim($data['pwd'])) > 32) {
throw new AdminException(400762);
}
$adminInfo->pwd = $this->passwordHash($data['pwd']);
}
//修改账号

View File

@ -41,14 +41,24 @@ class SystemAttachmentCategoryServices extends BaseServices
* 获取分类列表
* @param array $where
* @return array
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getAll(array $where)
{
$list = $this->dao->getList($where);
foreach ($list as &$item) {
$item['title'] = $item['name'];
$item['children'] = [];
if ($where['name'] == '' && $this->dao->count(['pid' => $item['id']])) $item['loading'] = false;
if ($where['all'] == 1) {
$list = $this->tidyMenuTier($list);
} else {
foreach ($list as &$item) {
$item['title'] = $item['name'];
if ($where['name'] == '' && $this->dao->count(['pid' => $item['id']])) {
$item['loading'] = false;
$item['children'] = [];
}
}
}
return compact('list');
}
@ -67,7 +77,11 @@ class SystemAttachmentCategoryServices extends BaseServices
if ($menu['pid'] == $pid) {
unset($menusList[$k]);
$menu['children'] = $this->tidyMenuTier($menusList, $menu['id']);
if ($menu['children']) $menu['expand'] = true;
if (count($menu['children'])) {
$menu['expand'] = true;
} else {
unset($menu['children']);
}
$navList[] = $menu;
}
}

View File

@ -14,6 +14,7 @@ namespace app\services\system\attachment;
use app\services\BaseServices;
use app\dao\system\attachment\SystemAttachmentDao;
use app\services\product\product\CopyTaobaoServices;
use crmeb\exceptions\AdminException;
use crmeb\exceptions\ApiException;
use crmeb\exceptions\UploadException;
@ -25,6 +26,7 @@ use app\services\other\UploadService;
* @package app\services\attachment
* @method getYesterday() 获取昨日生成数据
* @method delYesterday() 删除昨日生成数据
* @method scanUploadImage($scan_token) 获取扫码上传的图片数据
*/
class SystemAttachmentServices extends BaseServices
{
@ -66,6 +68,7 @@ class SystemAttachmentServices extends BaseServices
if ($site_url) {
$item['satt_dir'] = (strpos($item['satt_dir'], $site_url) !== false || strstr($item['satt_dir'], 'http') !== false) ? $item['satt_dir'] : $site_url . $item['satt_dir'];
$item['att_dir'] = (strpos($item['att_dir'], $site_url) !== false || strstr($item['att_dir'], 'http') !== false) ? $item['satt_dir'] : $site_url . $item['att_dir'];
$item['time'] = date('Y-m-d H:i:s', $item['time']);
}
}
$where['module_type'] = 1;
@ -109,7 +112,7 @@ class SystemAttachmentServices extends BaseServices
* @param int $type
* @return mixed
*/
public function upload(int $pid, string $file, int $upload_type, int $type, $menuName)
public function upload(int $pid, string $file, int $upload_type, int $type, $menuName, $uploadToken = '')
{
$realName = false;
if ($upload_type == 0) {
@ -139,6 +142,7 @@ class SystemAttachmentServices extends BaseServices
$data['module_type'] = 1;
$data['time'] = $fileInfo['time'] ?? time();
$data['pid'] = $pid;
$data['scan_token'] = $uploadToken;
$this->dao->save($data);
}
return $res->filePath;
@ -154,8 +158,7 @@ class SystemAttachmentServices extends BaseServices
*/
public function move(array $data)
{
$res = $this->dao->move($data);
if (!$res) throw new AdminException(400600);
$this->dao->move($data);
}
/**
@ -282,4 +285,54 @@ class SystemAttachmentServices extends BaseServices
}
return $res;
}
/**
* 网络图片上传
* @param $data
* @return bool
* @throws \Exception
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/13
*/
public function onlineUpload($data)
{
//生成附件目录
if (make_path('attach', 3, true) === '') {
throw new AdminException(400555);
}
//上传图片
/** @var SystemAttachmentServices $systemAttachmentService */
$systemAttachmentService = app()->make(SystemAttachmentServices::class);
$siteUrl = sys_config('site_url');
foreach ($data['images'] as $image) {
$uploadValue = app()->make(CopyTaobaoServices::class)->downloadImage($image);
if (is_array($uploadValue)) {
//TODO 拼接图片地址
if ($uploadValue['image_type'] == 1) {
$imagePath = $siteUrl . $uploadValue['path'];
} else {
$imagePath = $uploadValue['path'];
}
//写入数据库
if (!$uploadValue['is_exists']) {
$systemAttachmentService->save([
'name' => $uploadValue['name'],
'real_name' => $uploadValue['name'],
'att_dir' => $imagePath,
'satt_dir' => $imagePath,
'att_size' => $uploadValue['size'],
'att_type' => $uploadValue['mime'],
'image_type' => $uploadValue['image_type'],
'module_type' => 1,
'time' => time(),
'pid' => $data['pid']
]);
}
}
}
return true;
}
}

View File

@ -452,7 +452,7 @@ class SystemConfigServices extends BaseServices
$data['value'] = json_decode($data['value'], true) ?: '';
if ($data['value'] != '') $data['value'] = set_file_url($data['value']);
$formbuider[] = $this->builder->frameImage($data['menu_name'], $data['info'], $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => $data['menu_name']], true), $data['value'])
->icon('ios-image')->width('950px')->height('505px')->modal(['footer-hide' => true])->appendRule('suffix', [
->icon('ios-image')->width('950px')->height('560px')->modal(['footer-hide' => true])->appendRule('suffix', [
'type' => 'div',
'class' => 'tips-info',
'domProps' => ['innerHTML' => $data['desc']]
@ -463,7 +463,7 @@ class SystemConfigServices extends BaseServices
if ($data['value'])
$data['value'] = set_file_url($data['value']);
$formbuider[] = $this->builder->frameImages($data['menu_name'], $data['info'], $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => $data['menu_name'], 'type' => 'many', 'maxLength' => 5], true), $data['value'])
->maxLength(5)->icon('ios-images')->width('950px')->height('505px')->modal(['footer-hide' => true])
->maxLength(5)->icon('ios-images')->width('950px')->height('560px')->modal(['footer-hide' => true])
->appendRule('suffix', [
'type' => 'div',
'class' => 'tips-info',

View File

@ -102,7 +102,7 @@ class SystemConfigTabServices extends BaseServices
$form[] = Form::select('pid', '父级分类', isset($formData['pid']) ? (string)$formData['pid'] : '')->setOptions($this->getSelectForm())->filterable(true);
$form[] = Form::input('title', '分类名称', $formData['title'] ?? '');
$form[] = Form::input('eng_title', '分类字段英文', $formData['eng_title'] ?? '');
$form[] = Form::frameInput('icon', '图标', $this->url(config('app.admin_prefix', 'admin') . '/widget.widgets/icon', ['fodder' => 'icon'], true), $formData['icon'] ?? '')->icon('ios-ionic')->height('505px')->modal(['footer-hide' => true]);
$form[] = Form::frameInput('icon', '图标', $this->url(config('app.admin_prefix', 'admin') . '/widget.widgets/icon', ['fodder' => 'icon'], true), $formData['icon'] ?? '')->icon('ios-ionic')->height('560px')->modal(['footer-hide' => true]);
$form[] = Form::radio('type', '类型', $formData['type'] ?? 0)->options([
['value' => 0, 'label' => '系统'],
['value' => 3, 'label' => '其它']

View File

@ -204,7 +204,7 @@ class SystemGroupDataServices extends BaseServices
} else {
$image = '';
}
$f[] = Form::frameImage($value["title"], $value["name"], $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => $value["title"], 'big' => 1], true), $image)->icon('ios-image')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$f[] = Form::frameImage($value["title"], $value["name"], $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => $value["title"], 'big' => 1], true), $image)->icon('ios-image')->width('950px')->height('560px')->modal(['footer-hide' => true]);
break;
case 'uploads':
if ($fvalue) {
@ -213,7 +213,7 @@ class SystemGroupDataServices extends BaseServices
} else {
$images = [];
}
$f[] = Form::frameImages($value["title"], $value["name"], $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => $value["title"], 'big' => 1, 'type' => 'many', 'maxLength' => 5], true), $images)->maxLength(5)->icon('ios-images')->width('950px')->height('505px')->modal(['footer-hide' => true])->spin(0);
$f[] = Form::frameImages($value["title"], $value["name"], $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => $value["title"], 'big' => 1, 'type' => 'many', 'maxLength' => 5], true), $images)->maxLength(5)->icon('ios-images')->width('950px')->height('560px')->modal(['footer-hide' => true])->spin(0);
break;
default:
$f[] = Form::input($value["title"], $value["name"], $fvalue);

View File

@ -125,6 +125,24 @@ class SystemStorageServices extends BaseServices
'appid' => sys_config('tengxun_appid', ''),
];
break;
case 5:// cos 京东云
$config = [
'accessKey' => sys_config('jd_accessKey', ''),
'secretKey' => sys_config('jd_secretKey', ''),
];
break;
case 6:// cos 华为云
$config = [
'accessKey' => sys_config('hw_accessKey', ''),
'secretKey' => sys_config('hw_secretKey', ''),
];
break;
case 7:// cos 天翼云
$config = [
'accessKey' => sys_config('ty_accessKey', ''),
'secretKey' => sys_config('ty_secretKey', ''),
];
break;
}
return $config;
}
@ -171,7 +189,10 @@ class SystemStorageServices extends BaseServices
try {
$upload = UploadService::init($storageInfo->type);
$upload->deleteBucket($storageInfo->name, $storageInfo->region);
$res = $upload->deleteBucket($storageInfo->name, $storageInfo->region);
if (false === $res) {
throw new AdminException($upload->getError());
}
} catch (\Throwable $e) {
throw new AdminException($e->getMessage());
}
@ -216,6 +237,18 @@ class SystemStorageServices extends BaseServices
$make->update('tengxun_secretKey', ['value' => json_encode($secretKey)], 'menu_name');
$make->update('tengxun_appid', ['value' => json_encode($appid)], 'menu_name');
break;
case 5:// oss 京东云
$make->update('jd_accessKey', ['value' => json_encode($accessKey)], 'menu_name');
$make->update('jd_secretKey', ['value' => json_encode($secretKey)], 'menu_name');
break;
case 6:// oss 华为云
$make->update('hw_accessKey', ['value' => json_encode($accessKey)], 'menu_name');
$make->update('hw_secretKey', ['value' => json_encode($secretKey)], 'menu_name');
break;
case 7:// oss 天翼云
$make->update('ty_accessKey', ['value' => json_encode($accessKey)], 'menu_name');
$make->update('ty_secretKey', ['value' => json_encode($secretKey)], 'menu_name');
break;
}
$make->cacheDriver()->clear();
}
@ -338,6 +371,56 @@ class SystemStorageServices extends BaseServices
}
}
break;
case 5:// cos 京东云
$upload = UploadService::init($type);
$res = $upload->listbuckets();
$list = $res['Buckets'];
$location = explode('.', $res['@metadata']['effectiveUri'])[1] ?? 'cn-north-1';
$config = $this->getStorageConfig($type);
foreach ($list as $item) {
if (!$this->dao->count(['name' => $item['Name'], 'access_key' => $config['accessKey']])) {
$data[] = [
'type' => $type,
'access_key' => $config['accessKey'],
'name' => $item['Name'],
'region' => $location,
'acl' => 'public-read',
'status' => 0,
'domain' => $this->getDomain($type, $item['Name'], $location),
'is_delete' => 0,
'add_time' => time(),
'update_time' => time()
];
}
}
break;
case 6:// cos 华为云
case 7:// cos 天翼云
$upload = UploadService::init($type);
$list = $upload->listbuckets();
if (!empty($list['Name'])) {
$newList = $list;
$list = [];
$list[] = $newList;
}
$config = $this->getStorageConfig($type);
foreach ($list as $item) {
if (!$this->dao->count(['name' => $item['Name'], 'access_key' => $config['accessKey']])) {
$data[] = [
'type' => $type,
'access_key' => $config['accessKey'],
'name' => $item['Name'],
'region' => $item['Location'],
'acl' => 'public-read',
'status' => 0,
'domain' => $this->getDomain($type, $item['Name'], $item['Location']),
'is_delete' => 0,
'add_time' => strtotime($item['CreationDate']),
'update_time' => time()
];
}
}
break;
}
if ($data) {
$this->dao->saveAll($data);
@ -383,6 +466,15 @@ class SystemStorageServices extends BaseServices
case 4:// cos 腾讯云
$domainName = 'https://' . $name . ($appid ? '-' . $appid : '') . '.cos.' . $reagion . '.myqcloud.com';
break;
case 5:// cos 京东云
$domainName = 'https://' . $name . '.s3.' . $reagion . '.jdcloud-oss.com';
break;
case 6:// cos 华为云
$domainName = 'https://' . $name . '.obs.' . $reagion . '.myhuaweicloud.com';
break;
case 7:// cos 天翼云
$domainName = 'https://' . $name . '.obs.' . $reagion . '.ctyun.cn';
break;
}
return $domainName;
}
@ -395,11 +487,11 @@ class SystemStorageServices extends BaseServices
*/
public function getConfig(int $type)
{
$res = ['name' => '', 'region' => '', 'domain' => ''];
$res = ['name' => '', 'region' => '', 'domain' => '', 'cdn' => ''];
try {
$config = $this->dao->get(['type' => $type, 'status' => 1, 'is_delete' => 0]);
if ($config) {
return ['name' => $config->name, 'region' => $config->region, 'domain' => $config->domain];
return ['name' => $config->name, 'region' => $config->region, 'domain' => $config->domain, 'cdn' => $config->cdn];
}
} catch (\Throwable $e) {
}
@ -415,9 +507,10 @@ class SystemStorageServices extends BaseServices
*/
public function getUpdateDomainForm(int $id)
{
$domain = $this->dao->value(['id' => $id], 'domain');
$storage = $this->dao->get(['id' => $id], ['domain', 'cdn']);
$rule = [
FormBuilder::input('domain', '空间域名', $domain),
FormBuilder::input('domain', '空间域名', $storage['domain']),
FormBuilder::input('cdn', 'cdn域名', $storage['cdn']),
];
return create_form('修改空间域名', $rule, '/system/config/storage/domain/' . $id);
}
@ -458,7 +551,11 @@ class SystemStorageServices extends BaseServices
$resDomain = $upload->getDomianInfo($domain);
$info->cname = $resDomain['cname'] ?? '';
}
return $info->save();
$info->save();
}
if ($info->cdn != $data['cdn']) {
$info->cdn = $data['cdn'];
$info->save();
}
$this->cacheDriver()->clear();

View File

@ -101,9 +101,9 @@ class SystemStoreStaffServices extends BaseServices
public function createStoreStaffForm(array $formData = [])
{
if ($formData) {
$field[] = $this->builder->frameImage('image', '更换头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image'),true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true]);
$field[] = $this->builder->frameImage('image', '更换头像', $this->url(config('app.admin_prefix', 'admin') . '/widget.images/index', array('fodder' => 'image'),true), $formData['avatar'] ?? '')->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true]);
} else {
$field[] = $this->builder->frameImage('image', '商城用户', $this->url(config('app.admin_prefix', 'admin') . '/system.User/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('505px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
$field[] = $this->builder->frameImage('image', '商城用户', $this->url(config('app.admin_prefix', 'admin') . '/system.User/list', ['fodder' => 'image'], true))->icon('ios-add')->width('950px')->height('560px')->modal(['footer-hide' => true])->Props(['srcKey' => 'image']);
}
$field[] = $this->builder->hidden('uid', $formData['uid'] ?? 0);
$field[] = $this->builder->hidden('avatar', $formData['avatar'] ?? '');

View File

@ -82,11 +82,29 @@ class OutUserServices extends BaseServices
return compact('list', 'count');
}
/**
* 获取用户详情
* @param $uid
* @return mixed
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/06/20
*/
public function userInfo($uid)
{
$fields = ['uid', 'real_name', 'mark', 'nickname', 'avatar', 'phone', 'now_money', 'brokerage_price', 'integral', 'exp', 'sign_num', 'user_type', 'status', 'level',
'agent_level', 'spread_open', 'spread_uid', 'spread_time', 'user_type', 'is_promoter', 'pay_count', 'is_ever_level', 'is_money_level', 'overdue_time', 'add_time'];
return app()->make(UserServices::class)->get($uid, $fields);
}
/**
* 添加/修改用户
* @param int $uid
* @param array $data
* @return int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function saveUser(int $uid, array $data): int
{
@ -151,6 +169,10 @@ class OutUserServices extends BaseServices
* @param int $id
* @param array $data
* @return bool
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function otherGive(int $id, array $data): bool
{

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