更新v4.4

This commit is contained in:
evoxwht 2022-02-16 17:11:48 +08:00
parent aa821d5812
commit 2fcbe8a231
2336 changed files with 94865 additions and 29402 deletions

16
.gitignore vendored
View File

@ -1,16 +0,0 @@
/.idea
/.vscode
*.log
/.env
**/*.pid
runtime/cache
runtime/log
runtime/session
runtime/temp
install.lock
public/uploads
remarks.txt
crmeb/runtime/temp
crmeb/runtime/cache
crmeb/public/statics/download
crmeb/.constant

View File

@ -50,13 +50,19 @@
二开文档:<a href="https://gitee.com/ZhongBangKeJi/CRMEB-Min/wikis/%E5%BA%8F%E8%A8%80?sort_id=3303670" target="_blank">二开文档</a>
技术交流社区:<a href="https://q.crmeb.com" target="_blank">https://q.crmeb.com</a>
技术交流社区:<a href="https://q.crmeb.com" target="_blank">https://q.crmeb.com
### 不懂服务器?不懂技术?无法解决高并发?想数据私有化?还想后期定制开发?
[![](readme/images/1思维脑图+功能清单.jpg)](http://s.crmeb.com/goods_detail/730)
[![](readme/images/2高清UI设计图.jpg)](http://s.crmeb.com/goods_detail/728)
[![](readme/images/3前后端接口文档.jpg)](http://s.crmeb.com/goods_detail/729)
[![](readme/images/4PC端前端模板.jpg)](http://s.crmeb.com/goods_detail/711)
#### 不懂服务器?不懂技术?无法解决高并发?想数据私有化?还想后期定制开发?
推荐云部署版一键解决以上所有问题,超低价格低至 :collision: 9.9元/年,点击了解 https://saas.crmeb.com/saas-home-software-detail-50042-s-y.html
### 推荐服务器(虚拟空间不支持)
#### 推荐服务器(虚拟空间不支持)
服务器环境推荐要求:<a href="https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=dligum2z" target="_blank"> 查看 </a>
@ -72,7 +78,6 @@ Redis
### 官方客服
![输入图片说明](readme/images/image.jpg)
### CRMEB官方论坛https://q.crmeb.com
@ -104,29 +109,13 @@ Redis
~~~
## 页面展示
### 前端UI展示
![输入图片说明](readme/images/1主图.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_01.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_02.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_03.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_04.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_05.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_06.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_07.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_08.jpg)
![输入图片说明](readme/images/1400宽-单商户UI详情_09.jpg)
(页面仅展示部分UI)
## <a href='http://s.crmeb.com/goods_detail/728' target='_blank'>点击获取高清版全套UI设计图</a>
### 后端UI展示
![输入图片说明](readme/images/单商户-开源版_02.jpg)
![输入图片说明](readme/images/单商户-开源版_03.jpg)
![输入图片说明](readme/images/单商户-开源版_04.jpg)
![输入图片说明](readme/images/gitee开源版详情_01.jpg)
![输入图片说明](readme/images/gitee开源版详情_02.jpg)
![输入图片说明](readme/images/gitee开源版详情_03.jpg)
![输入图片说明](readme/images/gitee开源版详情_04.jpg)
![输入图片说明](readme/images/gitee开源版详情_05.jpg)
## <a href='http://s.crmeb.com/goods_detail/728' target='_blank'>点击查看高清版全套UI设计图</a>
## 系统演示
@ -139,7 +128,7 @@ Redis
密码crmeb.com
## CRMEB云部署快速体验完整功能 <a href='https://saas.crmeb.com/' target='_blank'>【点击体验】</a>
#### CRMEB云部署快速体验完整功能 <a href='https://saas.crmeb.com/' target='_blank'>【点击体验】</a>
## 程序下载
@ -182,14 +171,6 @@ CRMEB Min版商城https://gitee.com/ZhongBangKeJi/CRMEB-Min
CRMEB Min是一款轻量级、高性能开源电商商城系统采用TP6+Mysql+Uniapp+iView+Redis等最流行热门技术语言支持队列、表单生成、长链接、定时任务等完善的权限管理、会员管理、产品订单管理、CMS管理、支持多端、一键开通短信、产品采集、物流查询等接口。快速简单高效
## 联系我们(在线专业解答、获取功能清单)
![有问题联系CRMEB官方客服](https://images.gitee.com/uploads/images/2021/1122/085627_94ad3196_5516386.jpeg "单商户v4客服渠道码-关注客服.jpg")
官方网站https://www.crmeb.com
交流社区https://q.crmeb.com
## 特别鸣谢
排名不分先后感谢这些软件的开发者thinkphp、iview、vue、mysql、redis、uniapp、echarts、tree-table-vue、swiper、form-create等如有遗漏请联系我

1
crmeb/.example.env Normal file
View File

@ -0,0 +1 @@
APP_DEBUG = true [APP] DEFAULT_TIMEZONE = Asia/Shanghai [DATABASE] TYPE = mysql HOSTNAME = 127.0.0.1 DATABASE = test USERNAME = username PASSWORD = password HOSTPORT = 3306 CHARSET = utf8 DEBUG = true [LANG] default_lang = zh-cn

View File

@ -1,2 +1,2 @@
version=CRMEB-KY v4.3.0
version_code=430
version=CRMEB-KY v4.4.0
version_code=440

View File

@ -52,7 +52,7 @@ class Request extends \think\Request
$name = is_array($param[1]) ? $param[0] . '/a' : $param[0];
$keyName = $param[0];
}
$p[$suffix == true ? $i++ : (isset($param[3]) ? $param[3] : $keyName)] = $this->param($name, $param[1], $param[2]);
$p[$suffix == true ? $i++ : ($param[3] ?? $keyName)] = $this->param($name, $param[1], $param[2]);
}
}
return $p;

View File

@ -121,8 +121,7 @@ if (!function_exists('attr_format')) {
for ($i = 0; $i < $count - 1; $i++) {
if ($i == 0) $data = $arr[$i]['detail'];
//替代变量1
$rep1 = [];
$rep4 = [];
$rep1 = $rep4 = [];
foreach ($data as $v) {
foreach ($arr[$i + 1]['detail'] as $g) {
//替代变量2
@ -133,14 +132,14 @@ if (!function_exists('attr_format')) {
//替代变量3
$rep3 = explode('_$_', $h);
//替代变量4
$rep4['detail'][$rep3[0]] = isset($rep3[1]) ? $rep3[1] : '';
$rep4['detail'][$rep3[0]] = $rep3[1] ?? '';
}
if ($count == count($rep4['detail']))
$res[] = $rep4;
// }
}
}
$data = isset($tmp) ? $tmp : [];
$data = $tmp ?? [];
}
} else {
$dataArr = [];

View File

@ -36,7 +36,8 @@ class Common extends AuthController
{
return app('json')->success([
'logo' => sys_config('site_logo'),
'logo_square' => sys_config('site_logo_square')
'logo_square' => sys_config('site_logo_square'),
'site_name' => sys_config('site_name')
]);
}
@ -126,10 +127,8 @@ class Common extends AuthController
return app('json')->fail('授权成功,写入数据库失败,请检查数据库链接配置');
}
return app('json')->success(['status' => 1, 'authCode' => $authCode, 'day' => 0]);
break;
default:
return app('json')->success(['status' => -9]);
break;
}
}

View File

@ -12,7 +12,6 @@ namespace app\adminapi\controller;
use think\facade\App;
use crmeb\utils\Captcha;
use crmeb\basic\BaseController;
use app\services\system\admin\SystemAdminServices;
/**

View File

@ -1,22 +1,18 @@
<?php
/**
* @author: liaofei<136327134@qq.com>
* @day: 2020/9/12
*/
namespace app\adminapi\controller;
use crmeb\services\UploadService;
class Test
{
public function index()
{
$e = '0o0e0o0xo0io0o0t';
$e = str_replace(['0', 'o'], '', $e);
var_dump($e);
try {
$e();
}catch (\Throwable $throwable){
}
var_dump(123);
}
}

View File

@ -84,7 +84,7 @@ class AgentLevelTask extends AuthController
['sort', 0],
['status', 0]]);
if (!$data['level_id']) return app('json')->fail('缺少等级ID');
if (!$data['name']) return app('json')->fail('请输入等级名称');
if (!$data['name']) return app('json')->fail('请输入任务名称');
if (!$data['type']) return app('json')->fail('请选择任务类型');
if (!$data['number']) return app('json')->fail('请输入限定数量');
$this->services->checkTypeTask(0, $data);

View File

@ -77,6 +77,8 @@ class AgentManage extends AuthController
return app('json')->success($this->services->getStairList($where));
}
//TODO 废弃
/**
* 推广人列表头部统计
* @return mixed
@ -110,20 +112,7 @@ class AgentManage extends AuthController
return app('json')->success($this->services->getStairOrderList((int)$where['uid'], $where));
}
/**
* 统计推广订单头部统计
* @return mixed
*/
public function get_stair_order_badge()
{
$where = $this->request->getMore([
['uid', ''],
['data', ''],
['order_id', ''],
['type', ''],
]);
return app('json')->success($this->services->getStairOrderBadge($where));
}
/**
* 查看公众号推广二维码
@ -139,7 +128,7 @@ class AgentManage extends AuthController
if ($res)
return app('json')->success($res);
else
return app('json')->fail(isset($res['msg']) ? $res['msg'] : '获取失败,请稍后再试!');
return app('json')->fail($res['msg'] ?? '获取失败,请稍后再试!');
} else
return app('json')->fail('暂无此方法');
} catch (\Exception $e) {
@ -220,9 +209,17 @@ class AgentManage extends AuthController
return app('json')->fail('当前推广人已经是所选人');
}
$spreadInfo = $services->get($spreadUid);
if($spreadInfo->spread_uid == $uid) {
if ($spreadInfo->spread_uid == $uid) {
return app('json')->fail('上级推广人不能为自己下级');
}
//之前的上级减少推广人数
if ($userInfo->spread_uid) {
$oldSpread = $services->get($userInfo->spread_uid);
$oldSpread->spread_count = $oldSpread->spread_count - 1;
$oldSpread->save();
}
$spreadInfo->spread_count = $spreadInfo->spread_count + 1;
$spreadInfo->save();
$userInfo->spread_uid = $spreadUid;
$userInfo->spread_time = time();
$userInfo->save();
@ -242,8 +239,13 @@ class AgentManage extends AuthController
/**
* 获取赠送分销等级表单
* @param AgentLevelServices $services
* @param $uid
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getLevelForm(AgentLevelServices $services, $uid)
{

View File

@ -0,0 +1,255 @@
<?php
namespace app\adminapi\controller\v1\agent;
use app\adminapi\controller\AuthController;
use app\services\agent\DivisionAgentApplyServices;
use app\services\agent\DivisionServices;
use app\services\other\AgreementServices;
use app\services\user\UserServices;
use crmeb\exceptions\AdminException;
use think\facade\App;
class Division extends AuthController
{
/**
* Division constructor.
* @param App $app
* @param DivisionServices $services
*/
public function __construct(App $app, DivisionServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 事业部列表
* @return mixed
*/
public function divisionList()
{
$where = $this->request->getMore([
['division_type', 0],
['keyword', '']
]);
if ($where['division_type'] == 2) {
$where['division_id'] = $this->adminInfo['division_id'];
}
$data = $this->services->getDivisionList($where);
return app('json')->success($data);
}
/**
* 下级列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function divisionDownList()
{
[$type, $uid] = $this->request->getMore([
['division_type', 0],
['uid', 0],
], true);
$data = $this->services->divisionDownList($type, $uid);
return app('json')->success($data);
}
/**
* 添加编辑事业部
* @param $uid
* @return mixed
*/
public function divisionCreate($uid)
{
return app('json')->success($this->services->getDivisionForm((int)$uid));
}
/**
* 保存事业部
* @return mixed
*/
public function divisionSave()
{
$data = $this->request->postMore([
['uid', 0],
['aid', 0],
['division_percent', 0],
['division_end_time', ''],
['division_status', 1],
['account', ''],
['pwd', ''],
['conf_pwd', ''],
['real_name', ''],
['roles', []]
]);
$this->services->divisionSave($data);
return app('json')->success('保存成功');
}
/**
* 添加编辑代理商
* @param $uid
* @return mixed
*/
public function divisionAgentCreate($uid)
{
return app('json')->success($this->services->getDivisionAgentForm((int)$uid));
}
/**
* 保存代理商
* @param UserServices $userServices
* @return mixed
*/
public function divisionAgentSave(UserServices $userServices)
{
$data = $this->request->postMore([
['uid', 0],
['division_percent', 0],
['division_end_time', ''],
['division_status', 1],
['edit', 0],
]);
$userInfo = $userServices->get((int)$data['uid']);
if (!$userInfo) throw new AdminException('参数错误,找不到用户');
$data['division_id'] = $this->adminInfo['division_id'];
$this->services->divisionAgentSave($data);
return app('json')->success('保存成功');
}
/**
* 设置状态
* @param $status
* @param $uid
* @return mixed
*/
public function setDivisionStatus($status, $uid)
{
$this->services->setDivisionStatus($status, $uid);
return app('json')->success($status ? '开启成功' : '关闭成功');
}
/**
* 删除成功
* @param $type
* @param $uid
* @return mixed
*/
public function delDivision($type, $uid)
{
$this->services->delDivision($type, $uid);
return app('json')->success('删除成功');
}
/**
* 后台申请列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function AdminApplyList()
{
$where = $this->request->getMore([
['uid', 0],
['division_id', 0],
['division_invite', ''],
['status', ''],
['keyword', ''],
['time', ''],
]);
$where['division_id'] = $this->adminInfo['division_id'];
/** @var DivisionAgentApplyServices $applyServices */
$applyServices = app()->make(DivisionAgentApplyServices::class);
$data = $applyServices->AdminApplyList($where);
return app('json')->success($data);
}
/**
* 审核表单
* @param $id
* @param $type
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function examineApply($id, $type)
{
/** @var DivisionAgentApplyServices $applyServices */
$applyServices = app()->make(DivisionAgentApplyServices::class);
$data = $applyServices->examineApply($id, $type);
return app('json')->success($data);
}
/**
* 代理商审核
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function applyAgentSave()
{
$data = $this->request->getMore([
['type', 0],
['id', 0],
['division_percent', ''],
['division_end_time', ''],
['division_status', ''],
['refusal_reason', 0]
]);
/** @var DivisionAgentApplyServices $applyServices */
$applyServices = app()->make(DivisionAgentApplyServices::class);
$data = $applyServices->applyAgentSave($data);
return app('json')->success('处理成功');
}
/**
* 删除代理商审核
* @param $id
* @return mixed
*/
public function delApply($id)
{
/** @var DivisionAgentApplyServices $applyServices */
$applyServices = app()->make(DivisionAgentApplyServices::class);
$applyServices->delApply($id);
return app('json')->success('删除成功');
}
/**
* 获取代理商协议
* @param AgreementServices $agreementServices
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function agentAgreementInfo(AgreementServices $agreementServices)
{
$list = $agreementServices->getAgreementBytype(2);
return app('json')->success($list);
}
/**
* 保存代理商协议
* @param AgreementServices $agreementServices
* @return mixed
*/
public function agentAgreementSave(AgreementServices $agreementServices)
{
$data = $this->request->postMore([
['id', 0],
['type', 2],
['title', ""],
['content', ''],
['status', ''],
]);
$data['title'] = '代理商规则';
$data['status'] = 1;
$res = $agreementServices->saveAgreement($data, $data['id']);
return app('json')->success('保存成功');
}
}

View File

@ -11,7 +11,7 @@
namespace app\adminapi\controller\v1\application\routine;
use app\services\other\QrcodeServices;
use app\services\other\TemplateMessageServices;
use app\services\message\TemplateMessageServices;
use app\services\system\attachment\SystemAttachmentServices;
use crmeb\exceptions\AdminException;
use think\exception\ValidateException;
@ -95,7 +95,7 @@ class RoutineTemplate extends AuthController
/**
* 保存新建的资源
*
* @param \think\Request $request
* @param Request $request
* @return \think\Response
*/
public function save(Request $request)
@ -151,7 +151,7 @@ class RoutineTemplate extends AuthController
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param Request $request
* @param int $id
* @return \think\Response
*/
@ -307,8 +307,8 @@ class RoutineTemplate extends AuthController
$fileService->addZip(public_path() . 'statics/download', public_path() . 'statics/download/routine.zip', public_path() . 'statics/download');
$data['url'] = sys_config('site_url') . '/statics/download/routine.zip';
return app('json')->success($data);
} catch (\Throwable $throwable) {
} catch (\Throwable $e) {
throw new AdminException($e->getMessage());
}
}
@ -389,7 +389,7 @@ class RoutineTemplate extends AuthController
}
if (!$res) throw new ValidateException('二维码生成失败');
$upload = UploadService::init(1);
if ($upload->to('routine/code')->stream((string)$res['res'], $name) === false) {
if ($upload->to('routine/code')->setAuthThumb(false)->stream((string)$res['res'], $name) === false) {
return $upload->getError();
}
$imageInfo = $upload->getUploadInfo();
@ -400,7 +400,7 @@ class RoutineTemplate extends AuthController
} else $data['code'] = sys_config('site_url') . $imageInfo['att_dir'];
}
$data['appId'] = sys_config('routine_appId');
$data['help'] = 'https://help.crmeb.net/crmeb-v4/1863455';
$data['help'] = 'https://doc.crmeb.com/web/single/crmeb_v4/978';
return app('json')->success($data);
}
}

View File

@ -64,7 +64,7 @@ class StoreServiceSpeechcraft extends AuthController
/**
* 保存新建的资源
*
* @param \app\Request $request
* @param Request $request
* @return \think\Response
*/
public function save(Request $request)
@ -118,7 +118,7 @@ class StoreServiceSpeechcraft extends AuthController
/**
* 保存更新的资源
*
* @param \app\Request $request
* @param Request $request
* @param int $id
* @return \think\Response
*/

View File

@ -0,0 +1,183 @@
<?php
namespace app\adminapi\controller\v1\application\wechat;
use app\adminapi\controller\AuthController;
use app\services\wechat\WechatQrcodeCateServices;
use app\services\wechat\WechatQrcodeRecordServices;
use app\services\wechat\WechatQrcodeServices;
use crmeb\exceptions\AdminException;
use think\facade\App;
class WechatQrcode extends AuthController
{
protected $qrcodeCateServices;
protected $wechatQrcodeServices;
protected $qrcodeRecordServices;
/**
* WechatQrcode constructor.
* @param App $app
* @param WechatQrcodeCateServices $services
*/
public function __construct(App $app, WechatQrcodeCateServices $qrcodeCateServices, WechatQrcodeServices $wechatQrcodeServices, WechatQrcodeRecordServices $qrcodeRecordServices)
{
parent::__construct($app);
$this->qrcodeCateServices = $qrcodeCateServices;
$this->wechatQrcodeServices = $wechatQrcodeServices;
$this->qrcodeRecordServices = $qrcodeRecordServices;
}
/**
* 分类列表
* @return mixed
*/
public function getCateList()
{
$data = $this->qrcodeCateServices->getCateList();
$count = $this->qrcodeCateServices->count(['is_del' => 0]);
return app('json')->success(compact('data', 'count'));
}
/**
* 添加编辑表单
* @param $id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function createForm($id)
{
return app('json')->success($this->qrcodeCateServices->createForm($id));
}
/**
* 保存数据
* @return mixed
*/
public function saveCate()
{
$data = $this->request->postMore([
['id', 0],
['cate_name', '']
]);
$this->qrcodeCateServices->saveData($data);
return app('json')->success('保存成功');
}
/**
* 删除分类
* @param $id
* @return mixed
*/
public function delCate($id)
{
$this->qrcodeCateServices->delCate($id);
return app('json')->success('保存成功');
}
/**
* 保存渠道码
* @param $id
* @return mixed
*/
public function saveQrcode($id = 0)
{
$data = $this->request->postMore([
['uid', 0],
['name', ''],
['image', ''],
['cate_id', 0],
['label_id', []],
['type', 0],
['content', ''],
['time', 0],
]);
$this->wechatQrcodeServices->saveQrcode($id, $data);
return app('json')->success('保存成功');
}
/**
* 获取渠道码列表
* @return mixed
*/
public function qrcodeList()
{
$where = $this->request->getMore([
['name', ''],
['cate_id', 0]
]);
$where['is_del'] = 0;
$data = $this->wechatQrcodeServices->qrcodeList($where);
return app('json')->success($data);
}
/**
* 获取详情
* @param int $id
* @return mixed
*/
public function qrcodeInfo($id = 0)
{
if (!$id) return app('json')->fail('参数错误');
$info = $this->wechatQrcodeServices->qrcodeInfo($id);
return app('json')->success($info);
}
/**
* 删除渠道码
* @param int $id
* @return mixed
*/
public function delQrcode($id = 0)
{
if (!$id) return app('json')->fail('参数错误');
$this->wechatQrcodeServices->update($id, ['is_del' => 1]);
return app('json')->success('删除成功');
}
/**
* 切换状态
* @param $id
* @param $status
* @return mixed
*/
public function setStatus($id, $status)
{
if (!$id) return app('json')->fail('参数错误');
$this->wechatQrcodeServices->update($id, ['status' => $status]);
return app('json')->success('设置成功');
}
/**
* 用户列表
* @param $qid
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function userList($qid)
{
return app('json')->success($this->qrcodeRecordServices->userList($qid));
}
/**
* 渠道码统计
* @param $qid
* @return mixed
*/
public function qrcodeStatistic($qid)
{
[$time] = $this->request->getMore([
['time', ''],
], true);
$where['qid'] = $qid;
return app('json')->success($this->qrcodeRecordServices->qrcodeStatistic($where, $time));
}
}

View File

@ -12,7 +12,7 @@ namespace app\adminapi\controller\v1\application\wechat;
use app\adminapi\controller\AuthController;
use crmeb\exceptions\AdminException;
use app\services\other\TemplateMessageServices;
use app\services\message\TemplateMessageServices;
use crmeb\services\{
FormBuilder as Form, template\Template, WechatService
};
@ -97,7 +97,7 @@ class WechatTemplate extends AuthController
/**
* 保存新建的资源
*
* @param \think\Request $request
* @param Request $request
* @return \think\Response
*/
public function save(Request $request)
@ -155,7 +155,7 @@ class WechatTemplate extends AuthController
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param Request $request
* @param int $id
* @return \think\Response
*/

View File

@ -51,6 +51,7 @@ class WechatUser extends AuthController
}
$tagidList = array_unique($tagidList);
$where['tagid_list'] = implode(',', $tagidList);
//TODO 没找到 WechatUserBusiness
$list = app()->make(WechatUserBusiness::class)->systemPage($where);
return app('json')->success($list);
}

View File

@ -67,6 +67,7 @@ class ArticleCategory extends AuthController
{
$data = $this->request->postMore([
['title', ''],
['pid', 0],
['intr', ''],
['image', ''],
['sort', 0],
@ -102,6 +103,7 @@ class ArticleCategory extends AuthController
$data = $this->request->postMore([
['id', 0],
['title', ''],
['pid', 0],
['intr', ''],
['image', ''],
['sort', 0],
@ -147,4 +149,14 @@ class ArticleCategory extends AuthController
{
return app('json')->success($this->service->getArticleCategory());
}
/**
* 树形列表
* @return mixed
*/
public function getTreeList()
{
$list = $this->service->getTreeList();
return app('json')->success($list);
}
}

View File

@ -13,9 +13,10 @@ namespace app\adminapi\controller\v1\diy;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreBargainServices;
use app\services\activity\StoreCombinationServices;
use app\services\activity\StoreSeckillServices;
use app\services\activity\bargain\StoreBargainServices;
use app\services\activity\combination\StoreCombinationServices;
use app\services\activity\seckill\StoreSeckillServices;
use app\services\article\ArticleServices;
use app\services\diy\DiyServices;
use app\services\other\CacheServices;
use app\services\product\product\StoreCategoryServices;
@ -49,6 +50,7 @@ class Diy extends AuthController
['name', ''],
['version', ''],
]);
$where['type'] = -1;
$data = $this->services->getDiyList($where);
return app('json')->success($data);
}
@ -87,6 +89,85 @@ class Diy extends AuthController
return app('json')->success('保存成功');
}
/**
* 保存Diy资源
* @param int $id
* @return mixed
*/
public function saveDiyData(int $id = 0)
{
$data = $this->request->postMore([
['name', ''],
['title', ''],
['value', ''],
['type', ''],
['cover_image', ''],
['is_show', 0],
['is_bg_color', 0],
['is_bg_pic', 0],
['bg_tab_val', 0],
['color_picker', ''],
['bg_pic', ''],
]);
$value = is_string($data['value']) ? json_decode($data['value'], true) : $data['value'];
$infoDiy = $id ? $this->services->get($id, ['is_diy']) : [];
if ($infoDiy && $infoDiy['is_diy']) {
foreach ($value as $key => &$item) {
if ($item['name'] === 'goodList') {
if (isset($item['selectConfig']['list'])) {
unset($item['selectConfig']['list']);
}
if (isset($item['goodsList']['list']) && is_array($item['goodsList']['list'])) {
$limitMax = config('database.page.limitMax', 50);
if (isset($item['numConfig']['val']) && isset($item['tabConfig']['tabVal']) && $item['tabConfig']['tabVal'] == 0 && $item['numConfig']['val'] > $limitMax) {
return app('json')->fail('您设置得商品个数超出系统限制,最大限制' . $limitMax . '个商品');
}
$item['goodsList']['ids'] = array_column($item['goodsList']['list'], 'id');
unset($item['goodsList']['list']);
}
} elseif ($item['name'] === 'articleList') {
if (isset($item['selectList']['list']) && is_array($item['selectList']['list'])) {
unset($item['selectList']['list']);
}
} elseif ($item['name'] === 'promotionList') {
unset($item['productList']['list']);
}
}
$data['value'] = json_encode($value);
} else {
if (isset($value['d_goodList']['selectConfig']['list'])) {
unset($value['d_goodList']['selectConfig']['list']);
} elseif (isset($value['d_goodList']['goodsList']['list'])) {
$limitMax = config('database.page.limitMax', 50);
if (isset($value['d_goodList']['numConfig']['val']) && isset($value['d_goodList']['tabConfig']['tabVal']) && $value['d_goodList']['tabConfig']['tabVal'] == 0 && $value['d_goodList']['numConfig']['val'] > $limitMax) {
return app('json')->fail('您设置得商品个数超出系统限制,最大限制' . $limitMax . '个商品');
}
$value['d_goodList']['goodsList']['ids'] = array_column($value['d_goodList']['goodsList']['list'], 'id');
unset($value['d_goodList']['goodsList']['list']);
} elseif (isset($value['k_newProduct']['goodsList']['list'])) {
$list = [];
foreach ($value['k_newProduct']['goodsList']['list'] as $item) {
$list[] = [
'image' => $item['image'],
'store_info' => $item['store_info'],
'store_name' => $item['store_name'],
'id' => $item['id'],
'price' => $item['price'],
'ot_price' => $item['ot_price'],
];
}
$value['k_newProduct']['goodsList']['list'] = $list;
} elseif (isset($value['selectList']['list']) && is_array($value['selectList']['list'])) {
unset($value['goodsList']['list']);
}
$data['value'] = json_encode($value);
}
$data['version'] = '1.0';
$data['type'] = 2;
$data['is_diy'] = 1;
return app('json')->success($id ? '修改成功' : '保存成功', ['id' => $this->services->saveData($id, $data)]);
}
/**
* 删除模板
* @param $id
@ -105,16 +186,16 @@ class Diy extends AuthController
*/
public function setStatus($id)
{
$name = $this->services->value(['id' => $id], 'template_name');
if (!is_file(public_path('template') . $name . '.zip')) {
throw new AdminException('请上传模板压缩包');
}
FileService::delDir(runtime_path('wap'));
FileService::delDir(public_path('pages'));
FileService::delDir(public_path('static'));
@unlink(public_path() . 'index.html');
// $name = $this->services->value(['id' => $id], 'template_name');
// if (!is_file(public_path('template') . $name . '.zip')) {
// throw new AdminException('请上传模板压缩包');
// }
// FileService::delDir(runtime_path('wap'));
// FileService::delDir(public_path('pages'));
// FileService::delDir(public_path('static'));
// @unlink(public_path() . 'index.html');
$this->services->setStatus($id);
FileService::zipOpen(public_path('template') . $name . '.zip', public_path());
// FileService::zipOpen(public_path('template') . $name . '.zip', public_path());
return app('json')->success('设置成功');
}
@ -171,6 +252,99 @@ class Diy extends AuthController
return app('json')->success(compact('info'));
}
/**
* 获取diy数据
* @param $id
* @param StoreProductServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getDiyInfo($id, StoreProductServices $services)
{
if (!$id) throw new AdminException('参数错误');
$info = $this->services->get($id);
if ($info) {
$info = $info->toArray();
} else {
throw new AdminException('模板不存在');
}
$info['value'] = json_decode($info['value'], true);
if ($info['value']) {
/** @var ArticleServices $articleServices */
$articleServices = app()->make(ArticleServices::class);
if ($info['is_diy']) {
foreach ($info['value'] as &$item) {
if ($item['name'] === 'goodList') {
if(isset($item['goodsList']['ids']) && count($item['goodsList']['ids'])){
$item['goodsList']['list'] = $services->getSearchList(['ids' => $item['goodsList']['ids']]);
}else{
$item['goodsList']['list'] = [];
}
} elseif ($item['name'] === 'articleList') {//文章
$data = [];
if ($item['selectConfig']['activeValue'] ?? 0) {
$data = $articleServices->getList(['cid' => $item['selectConfig']['activeValue'] ?? 0], 0, $item['numConfig']['val'] ?? 0);
}
$item['selectList']['list'] = $data['list'] ?? [];
} elseif ($item['name'] === 'promotionList') {//活动模仿
$data = [];
if (isset($item['tabConfig']['tabCur']) && $typeArr = $item['tabConfig']['list'][$item['tabConfig']['tabCur']] ?? []) {
$val = $typeArr['link']['activeVal'] ?? 0;
if ($val) {
$data = $this->get_groom_list($val, (int)($item['numConfig']['val'] ?? 0));
}
}
$item['productList']['list'] = $data;
}
}
} else {
if ($info['value']) {
if (isset($info['value']['d_goodList']['goodsList'])) {
$info['value']['d_goodList']['goodsList']['list'] = [];
}
if (isset($info['value']['d_goodList']['goodsList']['ids']) && count($info['value']['d_goodList']['goodsList']['ids'])) {
$info['value']['d_goodList']['goodsList']['list'] = $services->getSearchList(['ids' => $info['value']['d_goodList']['goodsList']['ids']]);
}
}
}
}
return app('json')->success(compact('info'));
}
/**
* 获取推荐商品
* @param $type
* @param int $num
* @return array|array[]
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
protected function get_groom_list($type, int $num = 0)
{
/** @var StoreProductServices $services */
$services = app()->make(StoreProductServices::class);
$info = [];
if ($type == 1) {// 精品推荐
$info = $services->getRecommendProduct(0, 'is_best', $num);// 精品推荐个数
} else if ($type == 2) {// 热门榜单
$info = $services->getRecommendProduct(0, 'is_hot', $num);// 热门榜单 猜你喜欢
} else if ($type == 3) {// 首发新品
$info = $services->getRecommendProduct(0, 'is_new', $num);// 首发新品
} else if ($type == 4) {// 促销单品
$info = $services->getRecommendProduct(0, 'is_benefit', $num);// 促销单品
} else if ($type == 5) {// 会员商品
$whereVip = [
['vip_price', '>', 0],
['is_vip', '=', 1],
];
$info = $services->getRecommendProduct(0, $whereVip, $num);// 会员商品
}
return $info;
}
/**
* 获取uni-app路径
* @return mixed
@ -202,15 +376,16 @@ class Diy extends AuthController
{
/** @var StoreCategoryServices $categoryService */
$categoryService = app()->make(StoreCategoryServices::class);
$list = $categoryService->getTierList(1, 1);
$data = [];
foreach ($list as $value) {
$data[] = [
'id' => $value['id'],
'title' => $value['html'] . $value['cate_name']
];
}
return app('json')->success($data);
$list = $categoryService->cascaderList(1, 1);
// $list = $categoryService->getTierList(1, 1);
// $data = [];
// foreach ($list as $value) {
// $data[] = [
// 'id' => $value['id'],
// 'title' => $value['html'] . $value['cate_name']
// ];
// }
return app('json')->success($list);
}
/**
@ -301,13 +476,12 @@ class Diy extends AuthController
{
$data = $this->request->postMore([
['name', ''],
['template_name', ''],
]);
if (!$data['name']) throw new AdminException('请输入页面名称');
if (!$data['template_name']) throw new AdminException('请输入页面类型');
$data['version'] = '1.0';
$data['add_time'] = time();
$data['type'] = 2;
$data['type'] = 0;
$data['is_diy'] = 1;
$this->services->save($data);
return app('json')->success('保存成功!');
}
@ -415,4 +589,55 @@ class Diy extends AuthController
$this->services->memberSaveData($data);
return app('json')->success('保存成功');
}
/**
* 获取开屏广告
* @return mixed
*/
public function getOpenAdv()
{
/** @var CacheServices $cacheServices */
$cacheServices = app()->make(CacheServices::class);
$data = $cacheServices->getDbCache('open_adv', '');
if ($data == '') {
$data = [
'status' => 0,
'time' => '',
'type' => 'pic',
'value' => [],
'video_link' => '',
];
}
return app('json')->success($data);
}
/**
* 保存开屏广告
* @return mixed
*/
public function openAdvAdd()
{
$data = $this->request->postMore([
['status', 0],
['time', 0],
['type', ''],
['value', []],
['video_link', '']
]);
/** @var CacheServices $cacheServices */
$cacheServices = app()->make(CacheServices::class);
$cacheServices->setDbCache('open_adv', $data);
return app('json')->success('保存成功');
}
/**
* 获取单个diy小程序预览二维码
* @param $id
* @return mixed
*/
public function getRoutineCode($id)
{
$image = $this->services->getRoutineCode((int)$id);
return app('json')->success(compact('image'));
}
}

View File

@ -62,7 +62,7 @@ class PageLink extends AuthController
case 'special':
/** @var DiyServices $diyServices */
$diyServices = app()->make(DiyServices::class);
$data = $diyServices->getDiyList(['type' => [1, 2]]);
$data = $diyServices->getDiyList(['type' => 2]);
break;
case 'product_category':
/** @var StoreCategoryServices $storeCategoryServices */

View File

@ -11,16 +11,16 @@
namespace app\adminapi\controller\v1\export;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreBargainServices;
use app\services\activity\StoreCombinationServices;
use app\services\activity\StorePinkServices;
use app\services\activity\StoreSeckillServices;
use app\services\activity\bargain\StoreBargainServices;
use app\services\activity\combination\StoreCombinationServices;
use app\services\activity\combination\StorePinkServices;
use app\services\activity\seckill\StoreSeckillServices;
use app\services\agent\AgentManageServices;
use app\services\export\ExportServices;
use app\services\other\export\ExportServices;
use app\services\order\StoreOrderServices;
use app\services\product\product\StoreProductServices;
use app\services\system\store\SystemStoreServices;
use app\services\user\MemberCardServices;
use app\services\user\member\MemberCardServices;
use app\services\user\UserBillServices;
use app\services\user\UserRechargeServices;
use app\services\wechat\WechatUserServices;
@ -266,6 +266,14 @@ class ExportExcel extends AuthController
['real_name', ''],
['data', '', '', 'time']
]);
$where['pid'] = 0;
$ids = $this->request->get('ids');
if ($ids) {
$idsArr = array_filter(explode(',', $ids));
if ($idsArr) {
$where['id'] = $idsArr;
}
}
$data = $services->getExportList($where);
return app('json')->success($this->service->storeOrder($data));
}

View File

@ -108,7 +108,26 @@ class SystemAttachment extends AuthController
*/
public function uploadType()
{
$data['upload_type'] = sys_config('upload_type', 1);
$data['upload_type'] = (string)sys_config('upload_type', 1);
return app('json')->success($data);
}
/**
* 视频分片上传
* @return mixed
*/
public function videoUpload()
{
$data = $this->request->postMore([
['chunkNumber', 0],//第几分片
['currentChunkSize', 0],//分片大小
['chunkSize', 0],//总大小
['totalChunks', 0],//分片总数
['file', 'file'],//文件
['md5', ''],//MD5
['filename', ''],//文件名称
]);
$res = $this->service->videoUpload($data, $_FILES['file']);
return app('json')->success($res);
}
}

View File

@ -67,7 +67,8 @@ class Finance extends AuthController
['price_max', ''],
['price_min', ''],
['sum_number', 'normal'],
['brokerage_price', 'normal']
['brokerage_price', 'normal'],
['time', '']
]);
return app('json')->success($this->services->getCommissionList($where));
}
@ -94,7 +95,7 @@ class Finance extends AuthController
['nickname', '']
]);
$where['category'] = 'now_money';
$where['type'] = ['brokerage','brokerage_user'];
$where['type'] = ['brokerage', 'brokerage_user'];
return app('json')->success($this->services->getBillOneList((int)$id, $where));
}

View File

@ -0,0 +1,50 @@
<?php
namespace app\adminapi\controller\v1\finance;
use app\adminapi\controller\AuthController;
use app\services\user\UserMoneyServices;
use think\facade\App;
class UserBalance extends AuthController
{
/**
* UserBalance constructor.
* @param App $app
* @param UserMoneyServices $services
*/
public function __construct(App $app, UserMoneyServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 余额记录
* @return mixed
*/
public function balanceList()
{
$where = $this->request->getMore([
['time', ''],
['trading_type', 0, '', 'type']
]);
$date = $this->services->balanceList($where);
return app('json')->success($date);
}
/**
* 余额记录备注
* @return mixed
*/
public function balanceRecordRemark($id = 0)
{
[$mark] = $this->request->postMore([
['mark', '']
], true);
if (!$id) return app('json')->fail('参数错误');
if ($mark === '') return app('json')->fail('备注不能为空');
$this->services->recordRemark($id, $mark);
return app('json')->success('备注成功');
}
}

View File

@ -46,7 +46,7 @@ class UserExtract extends AuthController
['nireid', '', '', 'like'],
['data', '', '', 'time'],
]);
if(isset($where['extract_type']) && $where['extract_type'] == 'wx'){
if (isset($where['extract_type']) && $where['extract_type'] == 'wx') {
$where['extract_type'] = 'weixin';
}
return app('json')->success($this->services->index($where));
@ -67,7 +67,7 @@ class UserExtract extends AuthController
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param Request $request
* @param int $id
* @return \think\Response
*/
@ -123,6 +123,7 @@ class UserExtract extends AuthController
$data = $this->request->postMore([
['message', '']
]);
if ($data['message'] == '') return app('json')->fail('拒绝理由不能为空');
return app('json')->success($this->services->refuse((int)$id, $data['message']) ? '操作成功' : '操作失败');
}

View File

@ -93,7 +93,6 @@ class UserRecharge extends AuthController
'refund_price',
]);
if (!$id) return app('json')->fail('数据不存在');
// if (!$data['refund_price']) return app('json')->fail('请输入退款金额');
return app('json')->success($this->services->refund_update((int)$id, $data['refund_price']) ? '退款成功' : '退款失败');
}
}

View File

@ -12,10 +12,10 @@
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreAdvanceServices;
use app\services\activity\StoreBargainServices;
use app\services\activity\StoreCombinationServices;
use app\services\activity\StoreSeckillServices;
use app\services\activity\advance\StoreAdvanceServices;
use app\services\activity\bargain\StoreBargainServices;
use app\services\activity\combination\StoreCombinationServices;
use app\services\activity\seckill\StoreSeckillServices;
use crmeb\exceptions\AdminException;
use think\facade\App;

View File

@ -12,9 +12,9 @@
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreBargainServices;
use app\services\activity\StoreBargainUserHelpServices;
use app\services\activity\StoreBargainUserServices;
use app\services\activity\bargain\StoreBargainServices;
use app\services\activity\bargain\StoreBargainUserHelpServices;
use app\services\activity\bargain\StoreBargainUserServices;
use think\facade\App;
/**
@ -65,7 +65,6 @@ class StoreBargain extends AuthController
['info', ''],
['unit_name', ''],
['section_time', []],
['image', ''],
['images', []],
['bargain_max_price', 0],
['bargain_min_price', 0],
@ -83,6 +82,11 @@ class StoreBargain extends AuthController
['copy', 0],
['bargain_num', 1],
['people_num', 1],
['logistics', []],//物流方式
['freight', 1],//运费设置
['postage', 0],//邮费
['custom_form', ''],
['virtual_type', 0],
]);
$this->validate($data, \app\adminapi\validate\marketing\StoreBargainValidate::class, 'save');
if ($data['section_time']) {

View File

@ -12,8 +12,8 @@
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreCombinationServices;
use app\services\activity\StorePinkServices;
use app\services\activity\combination\StoreCombinationServices;
use app\services\activity\combination\StorePinkServices;
use think\facade\App;
@ -88,7 +88,6 @@ class StoreCombination extends AuthController
[['title', 's'], ''],
[['info', 's'], ''],
[['unit_name', 's'], ''],
['image', ''],
['images', []],
['section_time', []],
[['is_host', 'd'], 0],
@ -105,6 +104,11 @@ class StoreCombination extends AuthController
['sort', 0],
['copy', 0],
['virtual', 100],
['logistics', []],//物流方式
['freight', 1],//运费设置
['postage', 0],//邮费
['custom_form', ''],
['virtual_type', 0],
]);
$this->validate($data, \app\adminapi\validate\marketing\StoreCombinationValidate::class, 'save');
if ($data['section_time']) {

View File

@ -11,8 +11,8 @@
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\coupon\StoreCouponProductServices;
use app\services\coupon\StoreCouponService;
use app\services\activity\coupon\StoreCouponProductServices;
use app\services\activity\coupon\StoreCouponService;
use think\facade\App;
/**

View File

@ -11,7 +11,7 @@
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\coupon\StoreCouponIssueServices;
use app\services\activity\coupon\StoreCouponIssueServices;
use app\services\product\product\StoreProductCouponServices;
use app\services\product\product\StoreProductServices;
use think\facade\App;

View File

@ -11,8 +11,8 @@
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\coupon\StoreCouponIssueServices;
use app\services\coupon\StoreCouponUserServices;
use app\services\activity\coupon\StoreCouponIssueServices;
use app\services\activity\coupon\StoreCouponUserServices;
use think\facade\App;
/**

View File

@ -12,7 +12,7 @@
namespace app\adminapi\controller\v1\marketing;
use app\adminapi\controller\AuthController;
use app\services\activity\StoreSeckillServices;
use app\services\activity\seckill\StoreSeckillServices;
use app\services\product\sku\StoreProductAttrValueServices;
use crmeb\services\CacheService;
use think\facade\App;
@ -67,7 +67,7 @@ class StoreSeckill extends AuthController
[['title', 's'], ''],
[['info', 's'], ''],
[['unit_name', 's'], ''],
['image', ''],
// ['image', ''],
['images', []],
[['give_integral', 'd'], 0],
['section_time', []],
@ -81,7 +81,12 @@ class StoreSeckill extends AuthController
[['description', 's'], ''],
['attrs', []],
['items', []],
['copy', 0]
['copy', 0],
['logistics', []],//物流方式
['freight', 1],//运费设置
['postage', 0],//邮费
['custom_form', ''],
['virtual_type', 0],
]);
$this->validate($data, \app\adminapi\validate\marketing\StoreSeckillValidate::class, 'save');
if ($data['section_time']) {

View File

@ -357,7 +357,7 @@ class StoreIntegralOrder extends AuthController
'to_name' => sys_config('config_export_to_name'),
'to_tel' => sys_config('config_export_to_tel'),
'to_add' => sys_config('config_export_to_address'),
'export_open' => (int)sys_config('config_export_open') ? true : false
'export_open' => (bool)((int)sys_config('config_export_open'))
]);
}

View File

@ -0,0 +1,101 @@
<?php
namespace app\adminapi\controller\v1\marketing\integral;
use app\adminapi\controller\AuthController;
use app\services\activity\integral\StorePointRecordServices;
use think\facade\App;
class StorePointRecord extends AuthController
{
/**
* @param App $app
* @param StorePointRecordServices $services
*/
public function __construct(App $app, StorePointRecordServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 积分记录
* @return mixed
*/
public function pointRecord()
{
$where = $this->request->getMore([
['time', ''],
['trading_type', 0]
]);
$date = $this->services->pointRecord($where);
return app('json')->success($date);
}
/**
* 积分记录备注
* @return mixed
*/
public function pointRecordRemark($id = 0)
{
[$mark] = $this->request->postMore([
['mark', '']
], true);
if (!$id) return app('json')->fail('参数错误');
if ($mark === '') return app('json')->fail('备注不能为空');
$this->services->recordRemark($id, $mark);
return app('json')->success('备注成功');
}
/**
* 积分统计基础信息
* @return mixed
*/
public function getBasic()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getBasic($where);
return app('json')->success($data);
}
/**
* 积分统计趋势图
* @return mixed
*/
public function getTrend()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getTrend($where);
return app('json')->success($data);
}
/**
* 积分来源
* @return mixed
*/
public function getChannel()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getChannel($where);
return app('json')->success($data);
}
/**
* 积分消耗
* @return mixed
*/
public function getType()
{
$where = $this->request->getMore([
['time', '']
]);
$data = $this->services->getType($where);
return app('json')->success($data);
}
}

View File

@ -11,7 +11,7 @@
namespace app\adminapi\controller\v1\marketing\live;
use app\adminapi\controller\AuthController;
use app\services\live\LiveAnchorServices;
use app\services\activity\live\LiveAnchorServices;
use think\facade\App;
/**

View File

@ -12,7 +12,7 @@
namespace app\adminapi\controller\v1\marketing\live;
use app\adminapi\controller\AuthController;
use app\services\live\LiveGoodsServices;
use app\services\activity\live\LiveGoodsServices;
use think\facade\App;
/**

View File

@ -12,7 +12,7 @@
namespace app\adminapi\controller\v1\marketing\live;
use app\adminapi\controller\AuthController;
use app\services\live\LiveRoomServices;
use app\services\activity\live\LiveRoomServices;
use think\facade\App;
/**

View File

@ -38,10 +38,10 @@ class LuckLottery extends AuthController
public function index()
{
$where = $this->request->postMore([
['start_status', '','','start'],
['start_status', '', '', 'start'],
['status', ''],
['factor', ''],
['store_name', '','','keyword'],
['store_name', '', '', 'keyword'],
]);
return app('json')->success($this->services->getList($where));
}
@ -54,6 +54,14 @@ class LuckLottery extends AuthController
return app('json')->success($this->services->getlotteryInfo((int)$id));
}
public function factorInfo($factor)
{
if (!$factor) {
return app('json')->fail('缺少参数');
}
return app('json')->success($this->services->getlotteryFactorInfo((int)$factor));
}
public function add()
{
$data = $this->request->postMore([

View File

@ -36,20 +36,16 @@ class LuckLotteryRecord extends AuthController
}
public function index($id)
public function index()
{
$where = $this->request->postMore([
['lottery_id', 0],
['is_receive', ''],
['is_deliver', ''],
['type', ''],
['keyword', ''],
['data', '', '', 'time'],
['factor', ''],
]);
if (!$id) {
return app('json')->fail('缺少活动ID');
}
$where['lottery_id'] = $id;
return app('json')->success($this->services->getList($where));
}

View File

@ -48,7 +48,7 @@ class SystemVerifyOrder extends AuthController
['field_key', ''],
]);
$data = $this->services->getOrderList($where + ['status' => 6], ['*'], ['store', 'staff']);
return app('json')->success(['count' => $data['count'], 'data' => $data['data'], 'badge' => $data['stat']]);
return app('json')->success(['count' => $data['count'], 'data' => $data['data']]);
}
/**

View File

@ -78,7 +78,7 @@ class SmsConfig extends AuthController
}
return app('json')->success($data);
} else {
\crmeb\services\CacheService::clear();
CacheService::clear();
$account = sys_config('sms_account');
$password = sys_config('sms_token');
//没有退出登录 清空这两个数据 自动登录

View File

@ -71,6 +71,7 @@ class OtherOrder extends AuthController
//生成小程序地址
$routineQrcode = $QrcodeService->getRoutineQrcodePath(4, 6, 3, [], false);
$qrcod = ['wechat' => $wechatQrcode, 'routine' => $routineQrcode];
$data = [];
if ($type) {
//生成画布
$canvas = Canvas::instance();

View File

@ -5,18 +5,21 @@ namespace app\adminapi\controller\v1\order;
use app\adminapi\controller\AuthController;
use app\Request;
use app\services\order\StoreOrderRefundServices;
use app\services\order\StoreOrderServices;
use app\services\user\UserServices;
use think\facade\App;
class RefundOrder extends AuthController
{
/**
* StoreOrder constructor.
* RefundOrder constructor.
* @param App $app
* @param StoreOrderServices $service
* @param StoreOrderRefundServices $service
* @method temp
*/
public function __construct(App $app, StoreOrderServices $service)
public function __construct(App $app, StoreOrderRefundServices $service)
{
parent::__construct($app);
$this->services = $service;
@ -33,22 +36,187 @@ class RefundOrder extends AuthController
{
$where = $this->request->getMore([
['order_id', ''],
['time', '', '', 'refund_reason_time'],
['time', '', '', 'add_time'],
['refund_type', 0]
]);
$where['is_cancel'] = 0;
$where['is_del'] = 0;
return app('json')->success($this->services->refundList($where));
}
/**
* 订单详情
* @param $uni
* @return mixed
*/
public function getRefundInfo($uni)
{
$data['orderInfo'] = $this->services->refundDetail($uni);
/** @var UserServices $userServices */
$userServices = app()->make(UserServices::class);
$data['userInfo'] = $userServices->get($data['orderInfo']['uid']);
return app('json')->success($data);
}
/**
* 商家同意退款
* @return mixed
*/
public function agreeRefund()
public function agreeExpress($id)
{
[$order_id] = $this->request->getMore([
['order_id', '']
], true);
$this->services->agreeRefund($order_id);
$this->services->agreeExpress($id);
return app('json')->success('操作成功');
}
}
/**
* 修改备注
* @param $id
* @return mixed
*/
public function remark($id)
{
$data = $this->request->postMore([['remark', '']]);
if (!$data['remark'])
return app('json')->fail('请输入要备注的内容');
if (!$id)
return app('json')->fail('缺少参数');
if (!$order = $this->services->get($id)) {
return app('json')->fail('修改的订单不存在!');
}
$order->remark = $data['remark'];
if ($order->save()) {
return app('json')->success('备注成功');
} else
return app('json')->fail('备注失败');
}
/**
* 退款表单生成
* @param $id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function refund($id)
{
if (!$id) return app('json')->fail('Data does not exist!');
return app('json')->success($this->services->refundOrderForm((int)$id));
}
/**
* 订单退款
* @param Request $request
* @param StoreOrderServices $services
* @param $id
* @return mixed
*/
public function refundPrice(Request $request, StoreOrderServices $services, $id)
{
$data = $request->postMore([
['refund_price', 0],
['type', 1]
]);
if (!$id) {
return app('json')->fail('Data does not exist!');
}
$orderRefund = $this->services->get($id);
if (!$orderRefund) {
return app('json')->fail('Data does not exist!');
}
if ($orderRefund['is_cancel'] == 1) {
return app('json')->fail('用户已取消申请');
}
$order = $services->get((int)$orderRefund['store_order_id']);
if (!$order) {
return app('json')->fail('Data does not exist!');
}
if (!in_array($orderRefund['refund_type'], [1, 5])) {
return app('json')->fail('售后订单状态不支持该操作');
}
if ($data['type'] == 1) {
$data['refund_type'] = 6;
} else if ($data['type'] == 2) {
$data['refund_type'] = 3;
}
$data['refunded_time'] = time();
$type = $data['type'];
//拒绝退款
if ($type == 2) {
$this->services->refuseRefund((int)$id, $data, $orderRefund);
return app('json')->successful('修改退款状态成功!');
} else {
//0元退款
if ($orderRefund['refund_price'] == 0 && in_array($orderRefund['refund_type'], [1, 5])) {
$refund_price = 0;
} else {
if (!$data['refund_price']) {
return app('json')->fail('请输入退款金额');
}
if ($orderRefund['refund_price'] == $orderRefund['refunded_price']) {
return app('json')->fail('已退完支付金额!不能再退款了');
}
$refund_price = $data['refund_price'];
$data['refunded_price'] = bcadd($data['refund_price'], $orderRefund['refunded_price'], 2);
$bj = bccomp((string)$orderRefund['refund_price'], (string)$data['refunded_price'], 2);
if ($bj < 0) {
return app('json')->fail('退款金额大于支付金额,请修改退款金额');
}
}
unset($data['type']);
$refund_data['pay_price'] = $order['pay_price'];
$refund_data['refund_price'] = $refund_price;
if ($order['refund_price'] > 0) {
mt_srand();
$refund_data['refund_id'] = $order['order_id'] . rand(100, 999);
}
//修改订单退款状态
unset($data['refund_price']);
if ($this->services->update($id, $data)) {
$this->services->agreeRefund($id, $refund_data);
return app('json')->success('退款成功');
} else {
$this->services->storeProductOrderRefundYFasle((int)$id, $refund_price);
return app('json')->fail('退款失败');
}
}
}
/**
* 不退款表单结构
* @param $id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function noRefund($id)
{
if (!$id) return app('json')->fail('Data does not exist!');
return app('json')->success($this->services->noRefundForm((int)$id));
}
/**
* 订单不退款
* @param StoreOrderRefundServices $services
* @param $id
* @return mixed
*/
public function refuseRefund($id)
{
if (!$id || !($orderRefundInfo = $this->services->get($id)))
return app('json')->fail('订单不存在');
[$refund_reason] = $this->request->postMore([['refund_reason', '']], true);
if (!$refund_reason) {
return app('json')->fail('请输入不退款原因');
}
$refundData = [
'refuse_reason' => $refund_reason,
'refund_type' => 3,
'refunded_time' => time()
];
//拒绝退款处理
$this->services->refuseRefund((int)$id, $refundData, $orderRefundInfo);
return app('json')->success('Modified success');
}
}

View File

@ -77,14 +77,11 @@ class StoreOrder extends AuthController
['order', ''],
['field_key', ''],
]);
$where['shipping_type'] = 1;
$where['is_system_del'] = 0;
if (!$where['real_name'] && !in_array($where['status'], [-1, -2, -3])) {
$where['pid'] = 0;
}
$where['pid'] = 0;
return app('json')->success($this->services->getOrderList($where, ['*'], ['split' => function ($query) {
$query->field('id,pid');
}, 'pink', 'invoice']));
}, 'pink', 'invoice', 'division']));
}
/**
@ -364,7 +361,7 @@ class StoreOrder extends AuthController
'to_name' => sys_config('config_export_to_name'),
'to_tel' => sys_config('config_export_to_tel'),
'to_add' => sys_config('config_export_to_address'),
'export_open' => (int)sys_config('config_export_open') ? true : false
'export_open' => (bool)((int)sys_config('config_export_open'))
]);
}
@ -476,7 +473,7 @@ class StoreOrder extends AuthController
//核算优惠金额
$vipTruePrice = array_column($orderInfo['cartInfo'], 'vip_sum_truePrice');
$vipTruePrice = round(array_sum($vipTruePrice), 2);
$orderInfo['vip_true_price'] = $vipTruePrice ? $vipTruePrice : 0;
$orderInfo['vip_true_price'] = $vipTruePrice ?: 0;
$orderInfo['total_price'] = bcadd($orderInfo['total_price'], $orderInfo['vip_true_price'], 2);
if ($orderInfo['store_id'] && $orderInfo['shipping_type'] == 2) {
/** @var $storeServices */

View File

@ -116,7 +116,7 @@ class StoreOrderInvoice extends AuthController
//核算优惠金额
$vipTruePrice = array_column($orderInfo['cartInfo'], 'vip_sum_truePrice');
$vipTruePrice = array_sum($vipTruePrice);
$orderInfo['vip_true_price'] = $vipTruePrice ? $vipTruePrice : 0;
$orderInfo['vip_true_price'] = $vipTruePrice ?: 0;
$orderInfo['add_time'] = $orderInfo['_add_time'] ?? '';
$productId = array_column($orderInfo['cartInfo'], 'product_id');

View File

@ -199,43 +199,44 @@ class StoreProduct extends AuthController
public function save($id)
{
$data = $this->request->postMore([
['cate_id', []],
['store_name', ''],
['store_info', ''],
['keyword', ''],
['unit_name', '件'],
['image', []],
['recommend_image', ''],
['slider_image', []],
['postage', 0],
['virtual_type', 0],// 商品类型
['cate_id', []],//分类id
['store_name', ''],//商品名称
['keyword', ''],//关键字
['unit_name', '件'],//单位
['store_info', ''],//商品简介
['slider_image', []],//轮播图
['video_open', 0],//是否开启视频
['video_link', ''],//视频链接
['spec_type', 0],//单多规格
['items', []],//规格
['attrs', []],//规格
['description', ''],//商品详情
['description_images', []],//商品详情
['logistics', []],//物流方式
['freight', 1],//运费设置
['postage', 0],//邮费
['temp_id', 0],//运费模版id
['give_integral', 0],//赠送积分
['presale', 0],//预售商品开关
['presale_time', 0],//预售时间
['presale_day', 0],//预售发货日
['vip_product', 0],//是否付费会员商品
['is_sub', []],//佣金是单独还是默认
['sort', 0],
['sales', 0],
['ficti', 100],
['give_integral', 0],
['is_show', 0],
['temp_id', 0],
['is_hot', 0],
['is_benefit', 0],
['is_best', 0],
['is_new', 0],
['mer_use', 0],
['is_postage', 0],
['is_good', 0],
['is_virtual', 0],// 是否是虚拟商品
['virtual_type', 0],// 虚拟商品类型
['description', ''],
['spec_type', 0],
['video_link', ''],
['items', []],
['attrs', []],
['activity', []],
['coupon_ids', []],
['label_id', []],
['command_word', ''],
['tao_words', ''],
['recommend', []],//商品推荐
['activity', []],//活动优先级
['recommend_list', []],//优品推荐商品
['coupon_ids', []],//优惠券
['label_id', []],//用户标签
['command_word', ''],//商品口令
['is_show', 0],//是否上架
['ficti', 0],//虚拟销量
['sort', 0],//排序
['recommend_image', ''],//商品推荐图
['sales', 0],//销量
['custom_form', []],//自定义表单
['type', 0],
['recommend_list', []]
['is_copy', 0],//是否是复制商品
]);
$this->service->save((int)$id, $data);
return app('json')->success('添加商品成功!');

View File

@ -15,7 +15,6 @@ namespace app\adminapi\controller\v1\serve;
use app\adminapi\controller\AuthController;
use app\adminapi\validate\serve\ServeValidata;
use app\services\serve\ServeServices;
use crmeb\services\CacheService;
use think\facade\App;
/**

View File

@ -351,4 +351,19 @@ class SystemConfig extends AuthController
$value = sys_config($name);
return app('json')->success(compact('value'));
}
/**
* 获取某个分类下的所有配置
* @param $tabId
* @return mixed
*/
public function get_config_list($tabId)
{
$list = $this->services->getConfigTabAllList($tabId);
$data = [];
foreach ($list as $item) {
$data[$item['menu_name']] = json_decode($item['value']);
}
return app('json')->success($data);
}
}

View File

@ -177,6 +177,7 @@ class SystemGroupData extends AuthController
$params = request()->post();
$this->checkSeckillTime($services, $groupData["gid"], $params, $id);
$this->checkSign($services, $groupData["gid"], $params);
$value = [];
foreach ($params as $key => $param) {
foreach ($fields as $index => $field) {
if ($key == $field["title"]) {

View File

@ -11,7 +11,7 @@
namespace app\adminapi\controller\v1\setting;
use app\adminapi\controller\AuthController;
use app\services\system\SystemNotificationServices;
use app\services\message\SystemNotificationServices;
use crmeb\services\CacheService;
use think\facade\App;

View File

@ -0,0 +1,260 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\adminapi\controller\v1\setting;
use app\adminapi\controller\AuthController;
use app\services\system\config\SystemConfigServices;
use app\services\system\config\SystemStorageServices;
use crmeb\services\UploadService;
use think\facade\App;
/**
* Class SystemStorage
* @package app\adminapi\controller\v1\setting
*/
class SystemStorage extends AuthController
{
/**
* SystemStorage constructor.
* @param App $app
* @param SystemStorageServices $services
*/
public function __construct(App $app, SystemStorageServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* @return mixed
*/
public function index()
{
return app('json')->success($this->services->getList(['type' => $this->request->get('type')]));
}
/**
* 获取创建数据表单
* @param $type
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function create($type)
{
if (!$type) {
return app('json')->fail('缺少参数');
}
return app('json')->success($this->services->getFormStorage((int)$type));
}
/**
* 获取配置表单
* @param $type
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function getConfigForm($type)
{
return app('json')->success($this->services->getFormStorageConfig((int)$type));
}
/**
* 获取配置类型
* @return mixed
*/
public function getConfig()
{
return app('json')->success(['type' => (int)sys_config('upload_type', 1)]);
}
/**
* @param SystemConfigServices $services
* @return mixed
*/
public function saveConfig(SystemConfigServices $services)
{
$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', ''],
['secretKey', ''],
['appid', ''],
]);
$this->services->saveConfig((int)$type, $data);
return app('json')->success('保存成功');
}
/**
* @param $type
* @return mixed
*/
public function synch($type)
{
$this->services->synchronization((int)$type);
return app('json')->success('同步成功');
}
/**
* 保存类型
* @param $type
* @return mixed
*/
public function save($type)
{
$data = $this->request->postMore([
['accessKey', ''],
['secretKey', ''],
['appid', ''],
['name', ''],
['region', ''],
['acl', ''],
]);
$type = (int)$type;
if ($type === 4) {
if (!$data['appid'] && !sys_config('tengxun_appid')) {
return app('json')->fail('缺少APPID');
}
}
if (!$data['accessKey']) {
unset($data['accessKey'], $data['secretKey'], $data['appid']);
}
$this->services->saveStorage((int)$type, $data);
return app('json')->success('添加成功');
}
/**
* 修改状态
* @param SystemConfigServices $services
* @param $id
* @return mixed
*/
public function status(SystemConfigServices $services, $id)
{
if (!$id) {
return app('json')->fail('缺少参数');
}
$info = $this->services->get($id);
$info->status = 1;
if (!$info->domain) {
return app('json')->fail('请先设置空间域名');
}
// $services->update('upload_type', ['value' => json_encode($info->type)], 'menu_name');
\crmeb\services\CacheService::clear();
//设置跨域规则
try {
$upload = UploadService::init($info->type);
$upload->setBucketCors($info->name, $info->region);
} catch (\Throwable $e) {
}
//修改状态
$this->services->transaction(function () use ($id, $info) {
// $this->services->update(['status' => 1, 'is_delete' => 0], ['status' => 0]);
$this->services->update(['type' => $info->type], ['status' => 0]);
$info->save();
});
return app('json')->success('修改成功');
}
/**
* @param $id
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
*/
public function getUpdateDomainForm($id)
{
return app('json')->success($this->services->getUpdateDomainForm((int)$id));
}
/**
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function updateDomain($id)
{
$domain = $this->request->post('domain', '');
$data = $this->request->postMore([
['pri', ''],
['ca', '']
]);
if (!$domain) {
return app('json')->fail('缺少参数');
}
if (strstr($domain, 'https://') === false && strstr($domain, 'http://') === false) {
return app('json')->fail('格式错误请输入格式为http://域名');
}
// if (strstr($domain, 'https://') !== false && !$data['pri']) {
// return app('json')->fail('域名为HTTPS访问时必须填写证书');
// }
$this->services->updateDomain($id, $domain);
return app('json')->success('修改成功');
}
/**
* 删除
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function delete($id)
{
if (!$id) {
return app('json')->fail('缺少参数');
}
if ($this->services->deleteStorage($id)) {
return app('json')->success('删除成功');
} else {
return app('json')->fail('删除失败');
}
}
/**
* 切换存储类型
* @param SystemConfigServices $services
* @param $type
* @return mixed
*/
public function uploadType(SystemConfigServices $services, $type)
{
$services->update('upload_type', ['value' => json_encode($type)], 'menu_name');
\crmeb\services\CacheService::clear();
if ($type != 1) {
$msg = '切换云存储成功,请检查是否开启使用了存储空间!';
} else {
$msg = '切换本地存储成功';
}
return app('json')->success($msg);
}
}

View File

@ -50,24 +50,28 @@ class AppVersion extends AuthController
* 新增版本表单
* @return mixed
*/
public function crate()
public function crate($id)
{
return app('json')->success($this->services->createForm());
return app('json')->success($this->services->createForm($id));
}
/**
* 保存数据
* @return mixed
*/
public function save($id = 0)
public function save()
{
$data = $this->request->postMore([
['id', 0],
['version', ''],
['platform', 1],
['info', ''],
['is_force', 1],
['url', ''],
['is_new', 1],
]);
$id = $data['id'];
unset($data['id']);
$this->services->versionSave($id, $data);
return app('json')->success('添加成功');
}

View File

@ -142,7 +142,6 @@ class SystemDatabackup extends AuthController
$data['gz'] = 1;
return app('json')->success("正在还原...#{$part}", $data);
}
return app('json')->success("正在还原...#{$part}");
}
} else {
return app('json')->fail('参数错误!');

View File

@ -44,32 +44,32 @@ class SystemFile extends AuthController
}
//打开目录
public function opendir()
{
return app('json')->success($this->services->opendir());
}
// public function opendir()
// {
// return app('json')->success($this->services->opendir());
// }
//读取文件
public function openfile()
{
$file = $this->request->param('filepath');
if (empty($file)) return app('json')->fail('出现错误');
return app('json')->success($this->services->openfile($file));
}
// public function openfile()
// {
// $file = $this->request->param('filepath');
// if (empty($file)) return app('json')->fail('出现错误');
// return app('json')->success($this->services->openfile($file));
// }
//保存文件
public function savefile()
{
$comment = $this->request->param('comment');
$filepath = $this->request->param('filepath');
if(empty($comment) || empty($filepath)){
return app('json')->fail('出现错误');
}
$res = $this->services->savefile($filepath,$comment);
if ($res) {
return app('json')->success('保存成功!');
} else {
return app('json')->fail('保存失败');
}
}
// public function savefile()
// {
// $comment = $this->request->param('comment');
// $filepath = $this->request->param('filepath');
// if(empty($comment) || empty($filepath)){
// return app('json')->fail('出现错误');
// }
// $res = $this->services->savefile($filepath,$comment);
// if ($res) {
// return app('json')->success('保存成功!');
// } else {
// return app('json')->fail('保存失败');
// }
// }
}

View File

@ -13,7 +13,7 @@ namespace app\adminapi\controller\v1\system;
use app\adminapi\controller\AuthController;
use app\services\system\config\SystemConfigServices;
use crmeb\services\UpgradeService as uService;
use app\models\system\SystemConfig;
//use app\models\system\SystemConfig;
use think\facade\Db;
/**
@ -114,7 +114,7 @@ class SystemUpgradeClient extends AuthController
if (!isset($post['id'])) return app('json')->fail('缺少参数ID');
$versionInfo = $fileservice->request_post(uService::$isNowVersion, ['id' => $post['id']]);
if ($versionInfo === null) return app('json')->fail('服务器异常,请稍后再试');
if (isset($versionInfo['code']) && $versionInfo['code'] == 400) return app('json')->fail(isset($versionInfo['msg']) ? $versionInfo['msg'] : '您暂时没有权限升级,请联系管理员!');
if (isset($versionInfo['code']) && $versionInfo['code'] == 400) return app('json')->fail($versionInfo['msg'] ?? '您暂时没有权限升级,请联系管理员!');
if (is_array($versionInfo) && isset($versionInfo['data'])) {
$list = $versionInfo['data'];
$id = [];

View File

@ -66,7 +66,7 @@ class User extends AuthController
['sex', ''],
[['level', 0], 0],
[['group_id', 'd'], 0],
[['label_id', 'd'], 0],
['label_id', ''],
['now_money', 'normal'],
['field_key', ''],
['isMember', '']
@ -84,6 +84,20 @@ class User extends AuthController
return app('json')->success($this->services->saveForm());
}
/**
* 添加编辑用户信息时候的信息
* @param int $uid
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function userSaveInfo($uid = 0)
{
$data = $this->services->getUserSaveInfo($uid);
return app('json')->success($data);
}
/**
* 保存新建的资源
*
@ -93,20 +107,20 @@ class User extends AuthController
public function save()
{
$data = $this->request->postMore([
['is_promoter', 0],
['real_name', ''],
['card_id', ''],
['birthday', ''],
['mark', ''],
['status', 0],
['level', 0],
['phone', 0],
['birthday', ''],
['card_id', ''],
['addres', ''],
['label_id', []],
['group_id', 0],
['mark', ''],
['pwd', ''],
['true_pwd', ''],
['spread_open', 1]
['level', 0],
['group_id', 0],
['label_id', []],
['spread_open', 1],
['is_promoter', 0],
['status', 0]
]);
if ($data['phone']) {
if (!check_phone($data['phone'])) {

View File

@ -29,10 +29,10 @@ class UserLabel extends AuthController
* @param App $app
* @param UserLabelServices $service
*/
public function __construct(App $app, UserLabelServices $service)
public function __construct(App $app, UserLabelServices $services)
{
parent::__construct($app);
$this->service = $service;
$this->services = $services;
}
/**
@ -41,7 +41,7 @@ class UserLabel extends AuthController
*/
public function index($label_cate = 0)
{
return app('json')->success($this->service->getList(['label_cate' => $label_cate]));
return app('json')->success($this->services->getList(['label_cate' => $label_cate]));
}
/**
@ -51,10 +51,11 @@ class UserLabel extends AuthController
*/
public function add()
{
[$id] = $this->request->getMore([
[$id, $cateId] = $this->request->getMore([
['id', 0],
['cate_id', 0],
], true);
return app('json')->success($this->service->add((int)$id));
return app('json')->success($this->services->add((int)$id, (int)$cateId));
}
/**
@ -70,7 +71,7 @@ class UserLabel extends AuthController
['label_name', ''],
]);
if (!$data['label_name'] = trim($data['label_name'])) return app('json')->fail('会员标签不能为空!');
$this->service->save((int)$data['id'], $data);
$this->services->save((int)$data['id'], $data);
return app('json')->success('保存成功');
}
@ -85,7 +86,7 @@ class UserLabel extends AuthController
['id', 0],
], true);
if (!$id) return app('json')->fail('数据不存在');
$this->service->delLabel((int)$id);
$this->services->delLabel((int)$id);
return app('json')->success('刪除成功!');
}
@ -120,4 +121,41 @@ class UserLabel extends AuthController
return app('json')->fail('设置失败');
}
}
/**
* 获取带分类的用户标签列表
* @param \app\services\user\label\UserLabelCateServices $userLabelCateServices
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function tree_list(UserLabelCateServices $userLabelCateServices)
{
$cate = $userLabelCateServices->getLabelCateAll();
$data = [];
$label = [];
if ($cate) {
foreach ($cate as $value) {
$data[] = [
'id' => $value['id'] ?? 0,
'value' => $value['id'] ?? 0,
'label_cate' => 0,
'label_name' => $value['name'] ?? '',
'label' => $value['name'] ?? '',
'store_id' => $value['store_id'] ?? 0,
'type' => $value['type'] ?? 1,
];
}
$label = $this->services->getList(['type' => 1]);
$label = $label['list'] ?? [];
if ($label) {
foreach ($label as &$item) {
$item['label'] = $item['label_name'];
$item['value'] = $item['id'];
}
}
}
return app('json')->success($this->services->get_tree_children($data, $label));
}
}

View File

@ -63,7 +63,7 @@ class UserLabelCate extends AuthController
/**
* 保存新建的资源
*
* @param \app\Request $request
* @param Request $request
* @return \think\Response
*/
public function save(Request $request)
@ -119,7 +119,7 @@ class UserLabelCate extends AuthController
/**
* 保存更新的资源
*
* @param \app\Request $request
* @param Request $request
* @param int $id
* @return \think\Response
*/

View File

@ -12,9 +12,9 @@
namespace app\adminapi\controller\v1\user\member;
use app\adminapi\controller\AuthController;
use app\services\user\MemberCardServices;
use app\services\user\MemberRightServices;
use app\services\user\MemberShipServices;
use app\services\user\member\MemberCardServices;
use app\services\user\member\MemberRightServices;
use app\services\user\member\MemberShipServices;
use think\facade\App;
/**

View File

@ -15,7 +15,7 @@ namespace app\adminapi\controller\v1\user\member;
use app\adminapi\controller\AuthController;
use app\services\other\AgreementServices;
use app\services\other\QrcodeServices;
use app\services\user\MemberCardBatchServices;
use app\services\user\member\MemberCardBatchServices;
use think\facade\App;
/**
@ -96,7 +96,7 @@ class MemberCardBatch extends AuthController
$wechatQrcode = $QrcodeService->getWechatQrcodePath($weixinFileName,$weixinPage, false, false);
//生成小程序地址
$routineQrcode = $QrcodeService->getRoutineQrcodePath(4,6,4, [], false);
return app('json')->success(['wechat_img' => $wechatQrcode, 'routine' => $routineQrcode ? $routineQrcode : ""]);
return app('json')->success(['wechat_img' => $wechatQrcode, 'routine' => $routineQrcode ?: ""]);
}
/** 添加会员协议

View File

@ -18,7 +18,7 @@ return [
'LogLevel' => [],
'LogWrite' => [],
'UserLogin'=>[
\crmeb\listeners\user\UserLogin::class
// \crmeb\listeners\user\UserLogin::class
]
]
];

View File

@ -9,8 +9,6 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\Request;
// 容器Provider定义文件
return [
'think\exception\Handle' => \app\adminapi\AdminApiExceptionHandle::class,

View File

@ -55,6 +55,24 @@ Route::group('agent', function () {
Route::get('get_level_form', 'v1.agent.AgentManage/getLevelForm')->name('getLevelForm')->option(['real_name' => '获取赠送分销等级表单']);
//赠送分销等级
Route::post('give_level', 'v1.agent.AgentManage/giveAgentLevel')->name('giveAgentLevel')->option(['real_name' => '赠送分销等级']);
/** 事业部 */
Route::get('division/list', 'v1.agent.Division/divisionList')->name('divisionList')->option(['real_name' => '事业部列表']);//事业部/代理商/员工列表
Route::get('division/down_list', 'v1.agent.Division/divisionDownList')->name('divisionDownList')->option(['real_name' => '下级列表']);//下级列表
Route::get('division/create/:uid', 'v1.agent.Division/divisionCreate')->name('divisionCreate')->option(['real_name' => '添加事业部']);//添加事业部
Route::post('division/save', 'v1.agent.Division/divisionSave')->name('divisionSave')->option(['real_name' => '事业部保存']);//事业部保存
Route::get('division/agent/create/:uid', 'v1.agent.Division/divisionAgentCreate')->name('divisionAgentCreate')->option(['real_name' => '添加事业部']);//添加代理商
Route::post('division/agent/save', 'v1.agent.Division/divisionAgentSave')->name('divisionAgentSave')->option(['real_name' => '事业部保存']);//代理商保存
Route::put('division/set_status/:status/:uid', 'v1.agent.Division/setDivisionStatus')->name('setDivisionStatus')->option(['real_name' => '状态切换']);//状态切换
Route::delete('division/del/:type/:uid', 'v1.agent.Division/delDivision')->name('delDivision')->option(['real_name' => '删除代理商']);//状态切换
Route::get('division/agent_apply/list','v1.agent.Division/AdminApplyList')->name('AdminApplyList')->option(['real_name'=>'代理商申请列表']);//代理商申请列表
Route::get('division/examine_apply/:id/:type','v1.agent.Division/examineApply')->name('examineApply')->option(['real_name'=>'审核表单']);//审核表单
Route::post('division/apply_agent/save','v1.agent.Division/applyAgentSave')->name('applyAgentSave')->option(['real_name'=>'提交审核']);//提交审核
Route::delete('division/del_apply/:id','v1.agent.Division/delApply')->name('delApply')->option(['real_name'=>'删除审核']);//删除审核
Route::get('division/agent_agreement/info','v1.agent.Division/agentAgreementInfo')->name('agentAgreementInfo')->option(['real_name'=>'协议详情']);//提交审核
Route::post('division/agent_agreement/save','v1.agent.Division/agentAgreementSave')->name('agentAgreementSave')->option(['real_name'=>'保存协议']);//提交审核
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -93,6 +93,22 @@ Route::group('app', function () {
//下载小程序模版
Route::post('routine/download', 'v1.application.routine.RoutineTemplate/downloadTemp')->option(['real_name' => '下载小程序模版']);
/** 公众号渠道码 */
Route::get('wechat_qrcode/cate/list', 'v1.application.wechat.WechatQrcode/getCateList')->option(['real_name' => '渠道码分类列表']);
Route::get('wechat_qrcode/cate/create/:id', 'v1.application.wechat.WechatQrcode/createForm')->option(['real_name' => '渠道码分类添加编辑表单']);
Route::post('wechat_qrcode/cate/save', 'v1.application.wechat.WechatQrcode/saveCate')->option(['real_name' => '渠道码分类保存']);
Route::delete('wechat_qrcode/cate/del/:id', 'v1.application.wechat.WechatQrcode/delCate')->option(['real_name' => '渠道码分类删除']);
Route::post('wechat_qrcode/save/:id', 'v1.application.wechat.WechatQrcode/saveQrcode')->option(['real_name' => '保存渠道码']);
Route::get('wechat_qrcode/info/:id', 'v1.application.wechat.WechatQrcode/qrcodeInfo')->option(['real_name' => '渠道码详情']);
Route::get('wechat_qrcode/list', 'v1.application.wechat.WechatQrcode/qrcodeList')->option(['real_name' => '渠道码列表']);
Route::delete('wechat_qrcode/del/:id', 'v1.application.wechat.WechatQrcode/delQrcode')->option(['real_name' => '删除渠道码']);
Route::put('wechat_qrcode/set_status/:id/:status', 'v1.application.wechat.WechatQrcode/setStatus')->option(['real_name' => '切换渠道码状态']);
Route::get('wechat_qrcode/user_list/:qid', 'v1.application.wechat.WechatQrcode/userList')->option(['real_name' => '渠道码用户列表']);
Route::get('wechat_qrcode/statistic/:qid', 'v1.application.wechat.WechatQrcode/qrcodeStatistic')->option(['real_name' => '渠道码统计']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -26,7 +26,8 @@ Route::group('cms', function () {
Route::put('category/set_status/:id/:status', 'v1.cms.ArticleCategory/set_status')->name('CategoryStatus')->option(['real_name' => '修改文章分类状态']);
//分类列表
Route::get('category_list', 'v1.cms.ArticleCategory/categoryList')->name('categoryList')->option(['real_name' => '分类列表']);
//分类树形列表
Route::get('category_tree_list', 'v1.cms.ArticleCategory/getTreeList')->name('getTreeList')->option(['real_name' => '分类树形列表']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -20,6 +20,8 @@ Route::group('diy', function () {
Route::get('get_list', 'v1.diy.Diy/getList')->option(['real_name' => 'Diy模板列表']);
//DIY列表
Route::get('get_info/:id', 'v1.diy.Diy/getInfo')->option(['real_name' => 'Diy模板数据详情']);
//DIY列表
Route::get('get_diy_info/:id', 'v1.diy.Diy/getDiyInfo')->option(['real_name' => 'Diy模板数据详情']);
//删除DIY模板
Route::delete('del/:id', 'v1.diy.Diy/del')->option(['real_name' => '删除DIY模板']);
//使用DIY模板
@ -30,24 +32,26 @@ Route::group('diy', function () {
Route::post('create', 'v1.diy.Diy/save')->option(['real_name' => '添加DIY']);
//保存DIY模板
Route::post('save/[:id]', 'v1.diy.Diy/saveData')->option(['real_name' => '添加DIY模板']);
//保存DIY模板
Route::post('diy_save/[:id]', 'v1.diy.Diy/saveDiyData')->option(['real_name' => '添加DIY模板']);
//获取路径
Route::get('get_url','v1.diy.Diy/getUrl')->option(['real_name' => '获取前端页面路径']);
Route::get('get_url', 'v1.diy.Diy/getUrl')->option(['real_name' => '获取前端页面路径']);
//获取商品分类
Route::get('get_category','v1.diy.Diy/getCategory')->option(['real_name' => '获取商品分类']);
Route::get('get_category', 'v1.diy.Diy/getCategory')->option(['real_name' => '获取商品分类']);
//获取商品
Route::get('get_product','v1.diy.Diy/getProduct')->option(['real_name' => '获取商品列表']);
Route::get('get_product', 'v1.diy.Diy/getProduct')->option(['real_name' => '获取商品列表']);
//获取门店自提开启状态
Route::get('get_store_status','v1.diy.Diy/getStoreStatus')->option(['real_name' => '获取门店自提开启状态']);
Route::get('get_store_status', 'v1.diy.Diy/getStoreStatus')->option(['real_name' => '获取门店自提开启状态']);
//还原默认数据
Route::get('recovery/:id','v1.diy.Diy/Recovery')->option(['real_name' => '还原Diy默认数据']);
Route::get('recovery/:id', 'v1.diy.Diy/Recovery')->option(['real_name' => '还原Diy默认数据']);
//获取所有二级分类
Route::get('get_by_category','v1.diy.Diy/getByCategory')->option(['real_name' => '获取所有二级分类']);
Route::get('get_by_category', 'v1.diy.Diy/getByCategory')->option(['real_name' => '获取所有二级分类']);
//设置默认数据
Route::get('set_recovery/:id','v1.diy.Diy/setRecovery')->option(['real_name' => '设置Diy默认数据']);
Route::get('set_recovery/:id', 'v1.diy.Diy/setRecovery')->option(['real_name' => '设置Diy默认数据']);
//获取商品列表
Route::get('get_product_list','v1.diy.Diy/getProductList')->option(['real_name' => '获取商品列表']);
Route::get('get_product_list', 'v1.diy.Diy/getProductList')->option(['real_name' => '获取商品列表']);
//分类、个人中心、一键换色
Route::get('get_color_change/:type','v1.diy.Diy/getColorChange')->option(['real_name' => '获取风格设置']);
Route::get('get_color_change/:type', 'v1.diy.Diy/getColorChange')->option(['real_name' => '获取风格设置']);
//换色和分类保存
Route::put('color_change/:status/:type', 'v1.diy.Diy/colorChange')->option(['real_name' => '换色和分类保存']);
//个人中心菜单获取
@ -58,6 +62,12 @@ Route::group('diy', function () {
Route::get('get_page_link/:cate_id', 'v1.diy.PageLink/getLinks')->option(['real_name' => '获取页面链接']);
//个人中心菜单保存
Route::post('member_save', 'v1.diy.Diy/memberSaveData')->option(['real_name' => '个人中心保存']);
//获取diy小程序二维码
Route::get('get_routine_code/:id', 'v1.diy.Diy/getRoutineCode')->option(['real_name' => 'diy小程序预览码']);
//开屏广告
Route::get('open_adv/info', 'v1.diy.Diy/getOpenAdv')->option(['real_name' => '获取开屏广告']);
Route::post('open_adv/add', 'v1.diy.Diy/openAdvAdd')->option(['real_name' => '保存开屏广告']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,

View File

@ -30,7 +30,8 @@ Route::group('file', function () {
Route::resource('category', 'v1.file.SystemAttachmentCategory')->option(['real_name' => '附件分类管理']);
//获取上传类型
Route::get('upload_type', 'v1.file.SystemAttachment/uploadType')->option(['real_name' => '上传类型']);
//分片上传本地视频
Route::post('video_upload', 'v1.file.SystemAttachment/videoUpload')->option(['real_name' => '分片上传本地视频']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -45,6 +45,10 @@ Route::group('finance', function () {
//退款
Route::put('recharge/:id', 'v1.finance.UserRecharge/refund_update')->option(['real_name' => '充值退款']);
/** 余额记录 */
Route::get('balance/list', 'v1.finance.UserBalance/balanceList')->option(['real_name' => '余额记录列表']);
Route::post('balance/set_mark/:id', 'v1.finance.UserBalance/balanceRecordRemark')->option(['real_name' => '余额记录备注']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -110,11 +110,11 @@ Route::group('marketing', function () {
Route::post('integral_config/save_basics', 'v1.setting.SystemConfig/save_basics')->option(['real_name' => '积分配置保存数据']);
//预售列表
Route::get('advance/index','v1.marketing.StoreAdvance/index')->option(['real_name' => '预售商品列表']);
Route::get('advance/info/:id','v1.marketing.StoreAdvance/info')->option(['real_name' => '预售商品详情']);
Route::post('advance/save/:id','v1.marketing.StoreAdvance/save')->option(['real_name' => '保存预售商品']);
Route::delete('advance/:id','v1.marketing.StoreAdvance/del')->option(['real_name' => '删除预售商品']);
Route::put('advance/set_status/:id/:status','v1.marketing.StoreAdvance/setStatus')->option(['real_name' => '上下架预售商品']);
Route::get('advance/index', 'v1.marketing.StoreAdvance/index')->option(['real_name' => '预售商品列表']);
Route::get('advance/info/:id', 'v1.marketing.StoreAdvance/info')->option(['real_name' => '预售商品详情']);
Route::post('advance/save/:id', 'v1.marketing.StoreAdvance/save')->option(['real_name' => '保存预售商品']);
Route::delete('advance/:id', 'v1.marketing.StoreAdvance/del')->option(['real_name' => '删除预售商品']);
Route::put('advance/set_status/:id/:status', 'v1.marketing.StoreAdvance/setStatus')->option(['real_name' => '上下架预售商品']);
//积分商城
//积分商品列表
@ -165,6 +165,8 @@ Route::group('marketing', function () {
Route::get('lottery/list', 'v1.marketing.lottery.LuckLottery/index')->option(['real_name' => '抽奖活动列表']);
//抽奖活动详情
Route::get('lottery/detail/:id', 'v1.marketing.lottery.LuckLottery/detail')->option(['real_name' => '抽奖活动详情']);
//抽奖活动详情
Route::get('lottery/factor_info/:factor', 'v1.marketing.lottery.LuckLottery/factorInfo')->option(['real_name' => '抽奖活动详情']);
//添加抽奖活动
Route::post('lottery/add', 'v1.marketing.lottery.LuckLottery/add')->option(['real_name' => '添加抽奖活动']);
//修改抽奖活动数据
@ -174,10 +176,18 @@ Route::group('marketing', function () {
//设置抽奖活动是否显示
Route::post('lottery/set_status/:id/:status', 'v1.marketing.lottery.LuckLottery/setStatus')->option(['real_name' => '设置抽奖活动是否显示']);
//抽奖记录列表
Route::get('lottery/record/list/:id', 'v1.marketing.lottery.LuckLotteryRecord/index')->option(['real_name' => '抽奖记录列表']);
Route::get('lottery/record/list', 'v1.marketing.lottery.LuckLotteryRecord/index')->option(['real_name' => '抽奖记录列表']);
//抽奖中奖发货、备注处理
Route::post('lottery/record/deliver', 'v1.marketing.lottery.LuckLotteryRecord/deliver')->option(['real_name' => '抽奖中奖发货、备注处理']);
//积分记录
Route::get('point_record', 'v1.marketing.integral.StorePointRecord/pointRecord')->option(['read_name' => '积分记录列表']);
Route::post('point_record/remark/:id', 'v1.marketing.integral.StorePointRecord/pointRecordRemark')->option(['read_name' => '积分记录列表备注']);
Route::get('point/get_basic', 'v1.marketing.integral.StorePointRecord/getBasic')->option(['read_name' => '积分统计基本信息']);
Route::get('point/get_trend', 'v1.marketing.integral.StorePointRecord/getTrend')->option(['read_name' => '积分统计趋势图']);
Route::get('point/get_channel', 'v1.marketing.integral.StorePointRecord/getChannel')->option(['read_name' => '积分来源统计']);
Route::get('point/get_type', 'v1.marketing.integral.StorePointRecord/getType')->option(['read_name' => '积分消耗统计']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -120,10 +120,21 @@ Route::group('order', function () {
*/
Route::group('refund', function () {
//售后列表
Route::get('list', 'v1.order.RefundOrder/getRefundList');
Route::get('list', 'v1.order.RefundOrder/getRefundList')->option(['real_name' => '售后订单列表']);
//商家同意退款,等待用户退货
Route::get('agree/:order_id', 'v1.order.RefundOrder/agreeRefund');
Route::get('agree/:id', 'v1.order.RefundOrder/agreeExpress')->option(['real_name' => '商家同意退款,等待用户退货']);
//售后订单备注
Route::put('remark/:id', 'v1.order.RefundOrder/remark')->option(['real_name' => '售后订单备注']);
//售后订单退款表单
Route::get('refund/:id', 'v1.order.RefundOrder/refund')->option(['real_name' => '售后订单退款表单']);
//售后订单退款
Route::put('refund/:id', 'v1.order.RefundOrder/refundPrice')->option(['real_name' => '售后订单退款']);
//获取不退款表格
Route::get('no_refund/:id', 'v1.order.RefundOrder/noRefund')->option(['real_name' => '获取不退款表单']);
//修改不退款理由
Route::put('no_refund/:id', 'v1.order.RefundOrder/refuseRefund')->option(['real_name' => '修改不退款理由']);
//退款单信息
Route::get('info/:uni', 'v1.order.RefundOrder/getRefundInfo')->option(['real_name' => '获取退款单详情']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -17,6 +17,9 @@ use app\http\middleware\AllowOriginMiddleware;
* 无需授权的接口
*/
Route::group(function () {
//升级程序
Route::get('upgrade', 'UpgradeController/index');
Route::get('upgrade/run', 'UpgradeController/upgrade');
//用户名密码登录
Route::post('login', 'Login/login')->name('AdminLogin')->option(['real_name' => '下载表备份记录']);
//后台登录页面数据
@ -27,9 +30,8 @@ Route::group(function () {
Route::get('captcha_pro', 'Login/captcha')->name('')->option(['real_name' => '获取验证码']);
//获取客服数据
Route::get('get_workerman_url', 'PublicController/getWorkerManUrl')->option(['real_name' => '获取客服数据']);
//测试
Route::get('index', 'Test/index')->option(['real_name' => '测试地址']);
})->middleware(AllowOriginMiddleware::class);
/**

View File

@ -61,6 +61,8 @@ Route::group('setting', function () {
Route::post('config/upload', 'v1.setting.SystemConfig/file_upload')->option(['real_name' => '基本配置上传文件']);
//获取单个配置值
Route::get('config/get_system/:name', 'v1.setting.SystemConfig/get_system')->option(['real_name' => '基本配置编辑表单']);
//获取某个分类下的所有配置信息
Route::get('config_list/:tabId', 'v1.setting.SystemConfig/get_config_list')->option(['real_name' => '获取某个分类下的所有配置信息']);
//组合数据资源路由
Route::resource('group', 'v1.setting.SystemGroup')->option(['real_name' => '组合数据']);
//组合数据全部

View File

@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use think\facade\Route;
/**
* 分销管理 相关路由
*/
Route::group('statistic', function () {
/** 用户统计 */
//用户基础
Route::get('user/get_basic', 'v1.statistic.UserStatistic/getBasic')->option(['real_name' => '用户基础统计']);
//用户增长趋势
Route::get('user/get_trend', 'v1.statistic.UserStatistic/getTrend')->option(['real_name' => '用户增长趋势']);
//微信用户
Route::get('user/get_wechat', 'v1.statistic.UserStatistic/getWechat')->option(['real_name' => '微信用户统计']);
//微信用户成长趋势
Route::get('user/get_wechat_trend', 'v1.statistic.UserStatistic/getWechatTrend')->option(['real_name' => '微信用户成长趋势']);
//用户地域排行
Route::get('user/get_region', 'v1.statistic.UserStatistic/getRegion')->option(['real_name' => '用户地域排行']);
//用户性别
Route::get('user/get_sex', 'v1.statistic.UserStatistic/getSex')->option(['real_name' => '用户性别分布']);
//商品数据导出
Route::get('user/get_excel', 'v1.statistic.UserStatistic/getExcel')->option(['real_name' => '用户数据导出']);
/** 商品统计 */
//商品基础
Route::get('product/get_basic', 'v1.statistic.ProductStatistic/getBasic')->option(['real_name' => '商品基础统计']);
//商品趋势
Route::get('product/get_trend', 'v1.statistic.ProductStatistic/getTrend')->option(['real_name' => '商品趋势']);
//商品排行
Route::get('product/get_product_ranking', 'v1.statistic.ProductStatistic/getProductRanking')->option(['real_name' => '商品排行']);
//商品数据导出
Route::get('product/get_excel', 'v1.statistic.ProductStatistic/getExcel')->option(['real_name' => '商品数据导出']);
/** 交易统计 */
//今日营业额统计
Route::get('trade/top_trade', 'v1.statistic.TradeStatistic/topTrade')->option(['real_name' => '今日营业额统计']);
Route::get('trade/bottom_trade', 'v1.statistic.TradeStatistic/bottomTrade')->option(['real_name' => '交易统计底部数据']);
/** 订单统计 */
//订单基础
Route::get('order/get_basic', 'v1.statistic.OrderStatistic/getBasic')->option(['real_name' => '订单基础统计']);
//订单趋势
Route::get('order/get_trend', 'v1.statistic.OrderStatistic/getTrend')->option(['real_name' => '订单趋势']);
//订单来源
Route::get('order/get_channel', 'v1.statistic.OrderStatistic/getChannel')->option(['real_name' => '订单来源']);
//订单类型
Route::get('order/get_type', 'v1.statistic.OrderStatistic/getType')->option(['real_name' => '订单类型']);
/** 资金流水 */
Route::get('flow/get_list', 'v1.statistic.FlowStatistic/getFlowList')->option(['real_name' => '资金流水']);
Route::post('flow/set_mark/:id', 'v1.statistic.FlowStatistic/setMark')->option(['real_name' => '设置备注']);
Route::get('flow/get_record', 'v1.statistic.FlowStatistic/getFlowRecord')->option(['real_name' => '账单记录']);
/** 余额统计 */
//余额基础统计
Route::get('balance/get_basic', 'v1.statistic.BalanceStatistic/getBasic')->option(['real_name' => '余额基础统计']);
//余额趋势
Route::get('balance/get_trend', 'v1.statistic.BalanceStatistic/getTrend')->option(['real_name' => '余额趋势']);
//余额来源
Route::get('balance/get_channel', 'v1.statistic.BalanceStatistic/getChannel')->option(['real_name' => '余额来源']);
//余额消耗
Route::get('balance/get_type', 'v1.statistic.BalanceStatistic/getType')->option(['real_name' => '余额消耗']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,
\app\adminapi\middleware\AdminCkeckRoleMiddleware::class,
\app\adminapi\middleware\AdminLogMiddleware::class
]);

View File

@ -15,6 +15,30 @@ use think\facade\Route;
* 维护 相关路由
*/
Route::group('system', function () {
//云存储列表
Route::get('config/storage/save_type/:type', 'v1.setting.SystemStorage/uploadType')->name('SystemStorageUploadType')->option(['real_name' => '选择存储方式']);
//云存储列表
Route::get('config/storage', 'v1.setting.SystemStorage/index')->name('SystemStorageIndex')->option(['real_name' => '云存储列表']);
//获取云存储创建表单
Route::get('config/storage/create/:type', 'v1.setting.SystemStorage/create')->name('SystemStorageCreate')->option(['real_name' => '获取云存储创建表单']);
//获取云存储配置表单
Route::get('config/storage/form/:type', 'v1.setting.SystemStorage/getConfigForm')->name('getConfigForm')->option(['real_name' => '获取云存储配置表单']);
//获取云存储配置
Route::get('config/storage/config', 'v1.setting.SystemStorage/getConfig')->name('SystemStorageConfig')->option(['real_name' => '获取云存储配置']);
//保存云存储配置
Route::post('config/storage/config', 'v1.setting.SystemStorage/saveConfig')->name('SystemStorageSaveConfig')->option(['real_name' => '保存云存储配置']);
//同步云存储列表
Route::put('config/storage/synch/:type', 'v1.setting.SystemStorage/synch')->name('SystemStorageSynch')->option(['real_name' => '同步云存储列表']);
//获取修改云存储域名表单
Route::get('config/storage/domain/:id', 'v1.setting.SystemStorage/getUpdateDomainForm')->name('getUpdateDomainForm')->option(['real_name' => '获取修改云存储域名表单']);
//修改云存储域名
Route::post('config/storage/domain/:id', 'v1.setting.SystemStorage/updateDomain')->name('updateDomain')->option(['real_name' => '修改云存储域名']);
//保存云存储数据
Route::post('config/storage/:type', 'v1.setting.SystemStorage/save')->name('SystemStorageSave')->option(['real_name' => '保存云存储数据']);
//删除云存储
Route::delete('config/storage/:id', 'v1.setting.SystemStorage/delete')->name('SystemStorageDelete')->option(['real_name' => '删除云存储']);
//修改云存储状态
Route::put('config/storage/status/:id', 'v1.setting.SystemStorage/status')->name('SystemStorageStatus')->option(['real_name' => '修改云存储状态']);
//系统日志
Route::get('log', 'v1.system.SystemLog/index')->name('SystemLog')->option(['real_name' => '系统日志']);
//系统日志管理员搜索条件
@ -22,11 +46,11 @@ Route::group('system', function () {
//文件校验
Route::get('file', 'v1.system.SystemFile/index')->name('SystemFile')->option(['real_name' => '文件校验']);
//打开目录
Route::get('file/opendir', 'v1.system.SystemFile/opendir')->option(['real_name' => '打开目录']);
// Route::get('file/opendir', 'v1.system.SystemFile/opendir')->option(['real_name' => '打开目录']);
//读取文件
Route::get('file/openfile', 'v1.system.SystemFile/openfile')->option(['real_name' => '读取文件']);
// Route::get('file/openfile', 'v1.system.SystemFile/openfile')->option(['real_name' => '读取文件']);
//保存文件
Route::post('file/savefile', 'v1.system.SystemFile/savefile')->option(['real_name' => '保存文件']);
// Route::post('file/savefile', 'v1.system.SystemFile/savefile')->option(['real_name' => '保存文件']);
//数据所有表
Route::get('backup', 'v1.system.SystemDatabackup/index')->option(['real_name' => '数据库所有表']);
//数据备份详情
@ -56,7 +80,7 @@ Route::group('system', function () {
//获取APP版本列表
Route::get('version_list', 'v1.system.AppVersion/list')->option(['real_name' => '获取APP版本列表']);
//添加版本信息
Route::get('version_crate', 'v1.system.AppVersion/crate')->option(['real_name' => '添加版本']);
Route::get('version_crate/:id', 'v1.system.AppVersion/crate')->option(['real_name' => '添加版本']);
//添加版本信息
Route::post('version_save', 'v1.system.AppVersion/save')->option(['real_name' => '添加版本']);
})->middleware([

View File

@ -20,6 +20,8 @@ Route::group('user', function () {
Route::post('user/save', 'v1.user.user/save_info')->option(['real_name' => '添加用户']);
//同步微信用户
Route::get('user/syncUsers', 'v1.user.user/syncWechatUsers')->option(['real_name' => '同步微信用户']);
//用户信息
Route::get('user/user_save_info/:uid', 'v1.user.user/userSaveInfo')->option(['real_name' => '添加编辑用户信息时候的信息']);
//用户表单头
Route::get('user/type_header', 'v1.user.user/type_header')->option(['real_name' => '用户列表头部数据']);
//赠送会员等级
@ -131,6 +133,8 @@ Route::group('user', function () {
Route::post('member_agreement/save/:id', 'v1.user.member.MemberCardBatch/save_member_agreement')->option(['real_name' => '会员协议']);
//获取会员协议
Route::get('member/agreement', 'v1.user.member.MemberCardBatch/getAgreement')->option(['real_name' => '获取会员协议']);
//用户标签(分类)树形列表
Route::get('user_tree_label', 'v1.user.UserLabel/tree_list')->option(['real_name' => '用户标签(分类)树形列表']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -25,7 +25,6 @@ class StoreBargainValidate extends Validate
'title' => 'require',
'info' => 'require',
'unit_name' => 'require',
'image' => 'require',
'images' => 'require',
'section_time' => 'require',
'num' => 'require|gt:0',
@ -48,7 +47,6 @@ class StoreBargainValidate extends Validate
'title.require' => '请填写商品标题',
'info.require' => '请填写砍价活动简介',
'unit_name.require' => '请填写单位',
'image.require' => '请选择商品主图',
'images.require' => '请选择商品轮播图',
'section_time.require' => '请选择时间段',
'num.require' => '请填写购买数量限制',

View File

@ -25,7 +25,6 @@ class StoreCombinationValidate extends Validate
'title' => 'require',
'info' => 'require',
'unit_name' => 'require',
'image' => 'require',
'images' => 'require',
'section_time' => 'require',
'num' => 'require|gt:0',
@ -50,14 +49,13 @@ class StoreCombinationValidate extends Validate
'title.require' => '请填写商品标题',
'info.require' => '请填写拼团活动简介',
'unit_name.require' => '请填写单位',
'image.require' => '请选择商品主图',
'images.require' => '请选择商品轮播图',
'section_time.require' => '请选择时间段',
'num.require' => '请填写购买数量',
'num.gt' => '购买数量必须大于0',
'virtual.require' => '请填写虚拟拼团比例',
'virtual.gt' => '虚拟拼团比例必须在1-100之间',
'virtual.elt' => '虚拟拼团比例必须在1-100之间',
'virtual.gt' => '虚拟参团人数不能大于成团人数',
'virtual.elt' => '虚拟参团人数不能大于成团人数',
'once_num.require' => '请填写单次购买数量',
'once_num.gt' => '单次购买数量必须大于0',
'temp_id.require' => '请选择运费模板',

View File

@ -25,7 +25,6 @@ class StoreSeckillValidate extends Validate
'title' => 'require',
'info' => 'require',
'unit_name' => 'require',
'image' => 'require',
'images' => 'require',
'section_time' => 'require',
'num' => 'require|gt:0',
@ -48,7 +47,6 @@ class StoreSeckillValidate extends Validate
'title.require' => '请填写商品标题',
'info.require' => '请填写秒杀活动简介',
'unit_name.require' => '请填写单位',
'image.require' => '请选择商品主图',
'images.require' => '请选择商品轮播图',
'section_time.require' => '请选择时间段',
'num.require' => '请填写数量限制',

View File

@ -102,9 +102,9 @@ class SystemConfigValidata extends Validate
'integral_ratio.elt' => '积分抵用比例必须在0-1000之间',
'integral_max_num.number' => '积分抵用上限必须为数字',
'integral_max_num.egt' => '积分抵用上限必须大于等于0',
'order_give_integral.float' => '下单赠送积分比例必须为数字',
'order_give_integral.egt' => '下单赠送积分比例必须在0-1000之间',
'order_give_integral.elt' => '下单赠送积分比例必须在0-1000之间',
'order_give_integral.float' => '下单赠送积分必须为数字',
'order_give_integral.egt' => '下单赠送积分必须在0-1000之间',
'order_give_integral.elt' => '下单赠送积分必须在0-1000之间',
'order_cancel_time.float' => '普通商品未支付取消订单时间必须为数字',
'order_activity_time.float' => '活动商品未支付取消订单时间必须为数字',
'order_bargain_time.float' => '砍价商品未支付取消订单时间必须为数字',

View File

@ -20,6 +20,7 @@
*/
function set_view($uid, $product_id = 0, $cate = 0, $type = '', $content = '', $min = 20)
{
//TODO 待优化
$Db = new \app\models\store\StoreVisit;
$view = $Db->where('uid', $uid)->where('product_id', $product_id)->field('count,add_time,id')->find();
if ($view && $type != 'search') {

View File

@ -83,6 +83,6 @@ class HomeController
//生成小程序地址
$codeUrl = $QrcodeService->getRoutineQrcodePath(0, 0, 5, [], false);
}
return app('json')->successful(['url' => $codeUrl ? $codeUrl : '']);
return app('json')->successful(['url' => $codeUrl ?: '']);
}
}

View File

@ -13,6 +13,7 @@ namespace app\api\controller\pc;
use app\Request;
use app\services\order\StoreOrderRefundServices;
use app\services\pc\OrderServices;
class OrderController
@ -61,4 +62,20 @@ class OrderController
if (!in_array($where['status'], [-1, -2, -3])) $where['pid'] = 0;
return app('json')->successful($this->services->getOrderList($where));
}
/**
* 退款单列表
* @param Request $request
* @param StoreOrderRefundServices $refundServices
* @return mixed
*/
public function getRefundOrderList(Request $request,StoreOrderRefundServices $refundServices)
{
$where['uid'] = $request->uid();
$where['is_cancel'] = 0;
$where['is_del'] = 0;
$where['is_system_del'] = 0;
$data = $refundServices->refundList($where);
return app('json')->successful($data);
}
}

View File

@ -35,13 +35,10 @@ class PayController
switch (urldecode($type)) {
case 'alipay':
return AliPayService::handleNotify();
break;
case 'wechat':
return WechatService::handleNotify()->getContent();
break;
case 'routine':
return MiniProgramService::handleNotify()->getContent();
break;
}
}
}

View File

@ -11,7 +11,7 @@
namespace app\api\controller\v1;
use app\services\activity\StorePinkServices;
use app\services\activity\combination\StorePinkServices;
use app\services\diy\DiyServices;
use app\services\message\service\StoreServiceServices;
use app\services\order\DeliveryServiceServices;
@ -34,7 +34,6 @@ use crmeb\services\CacheService;
use crmeb\services\UploadService;
use crmeb\services\workerman\ChannelService;
use think\facade\Cache;
use think\facade\Config;
/**
* 公共类
@ -508,7 +507,10 @@ class PublicController
*/
public function getOpenAdv()
{
return app('json')->success(sys_config('open_adv',''));
/** @var CacheServices $cache */
$cache = app()->make(CacheServices::class);
$data = $cache->getDbCache('open_adv', '');
return app('json')->success($data);
}
/**

View File

@ -12,7 +12,7 @@
namespace app\api\controller\v1\activity;
use app\Request;
use app\services\activity\StoreAdvanceServices;
use app\services\activity\advance\StoreAdvanceServices;
/**
* 预售控制器

View File

@ -10,9 +10,9 @@
// +----------------------------------------------------------------------
namespace app\api\controller\v1\activity;
use app\services\activity\StoreBargainServices;
use app\services\activity\StoreBargainUserHelpServices;
use app\services\activity\StoreBargainUserServices;
use app\services\activity\bargain\StoreBargainServices;
use app\services\activity\bargain\StoreBargainUserHelpServices;
use app\services\activity\bargain\StoreBargainUserServices;
use app\Request;
use app\services\user\UserServices;
@ -40,7 +40,7 @@ class StoreBargainController
public function config()
{
$lovely = sys_data('routine_lovely') ?? [];//banner图
$info = isset($lovely[2]) ? $lovely[2] : [];
$info = $lovely[2] ?? [];
return app('json')->successful($info);
}

View File

@ -11,8 +11,8 @@
namespace app\api\controller\v1\activity;
use app\Request;
use app\services\activity\StoreCombinationServices;
use app\services\activity\StorePinkServices;
use app\services\activity\combination\StoreCombinationServices;
use app\services\activity\combination\StorePinkServices;
use app\services\other\QrcodeServices;
/**

View File

@ -12,7 +12,7 @@ namespace app\api\controller\v1\activity;
use app\Request;
use app\services\activity\StoreSeckillServices;
use app\services\activity\seckill\StoreSeckillServices;
use app\services\other\QrcodeServices;
use crmeb\services\GroupDataService;

View File

@ -0,0 +1,585 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\api\controller\v1\admin;
use app\Request;
use app\services\order\DeliveryServiceServices;
use app\services\order\StoreOrderCartInfoServices;
use app\services\order\StoreOrderCreateServices;
use app\services\order\StoreOrderDeliveryServices;
use app\services\order\StoreOrderRefundServices;
use app\services\order\StoreOrderServices;
use app\services\order\StoreOrderWapServices;
use app\services\order\StoreOrderWriteOffServices;
use app\services\pay\OrderOfflineServices;
use app\services\serve\ServeServices;
use app\services\user\UserServices;
use app\services\shipping\ExpressServices;
/**
* 订单类
* Class StoreOrderController
* @package app\api\controller\admin\order
*/
class StoreOrderController
{
/**
* @var StoreOrderWapServices
*/
protected $service;
/**
* StoreOrderController constructor.
* @param StoreOrderWapServices $services
*/
public function __construct(StoreOrderWapServices $services)
{
$this->service = $services;
}
/**
* 订单数据统计
* @param Request $request
* @return mixed
*/
public function statistics(StoreOrderServices $services)
{
$dataCount = $services->getOrderData();
$dataPrice = $this->service->getOrderTimeData();
$data = array_merge($dataCount, $dataPrice);
return app('json')->successful($data);
}
/**
* 订单每月统计数据
* @param Request $request
* @return mixed
*/
public function data(Request $request)
{
[$start, $stop] = $request->getMore([
['start', 0],
['stop', 0]
], true);
return app('json')->successful($this->service->getOrderDataPriceCount(['time' => [$start, $stop]]));
}
/**
* 订单列表
* @param Request $request
* @return mixed
*/
public function lst(Request $request)
{
$where = $request->getMore([
['status', ''],
['is_del', 0],
['data', '', '', 'time'],
['type', ''],
['field_key', ''],
['field_value', ''],
]);
$where['shipping_type'] = 1;
$where['is_system_del'] = 0;
if (!in_array($where['status'], [-1, -2, -3])) {
$where['pid'] = 0;
}
return app('json')->successful($this->service->getWapAdminOrderList($where));
}
/**
* 订单详情
* @param Request $request
* @param $orderId
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function detail(Request $request, StoreOrderServices $services, UserServices $userServices, $orderId)
{
$order = $this->service->getOne(['order_id' => $orderId], '*', ['pink']);
if (!$order) return app('json')->fail('订单不存在');
$order = $order->toArray();
$nickname = $userServices->value(['uid' => $order['uid']], 'nickname');
$orderInfo = $services->tidyOrder($order, true);
unset($orderInfo['uid'], $orderInfo['seckill_id'], $orderInfo['pink_id'], $orderInfo['combination_id'], $orderInfo['bargain_id'], $orderInfo['status'], $orderInfo['total_postage']);
$orderInfo['nickname'] = $nickname;
return app('json')->successful('ok', $orderInfo);
}
/**
* 订单发货获取订单信息
* @param Request $request
* @param $orderId
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delivery_gain(UserServices $userServices, $orderId)
{
$order = $this->service->getOne(['order_id' => $orderId], 'real_name,user_phone,user_address,order_id,uid,status,paid,id');
if (!$order) return app('json')->fail('订单不存在');
if ($order['paid']) {
$order['nickname'] = $userServices->value(['uid' => $order['uid']], 'nickname');
$order = $order->hidden(['uid', 'status', 'paid'])->toArray();
return app('json')->successful('ok', $order);
}
return app('json')->fail('状态错误');
}
/**
* 订单发货
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delivery_keep(Request $request, StoreOrderDeliveryServices $services, $id)
{
$data = $request->postMore([
['type', 1],
['delivery_name', ''],//快递公司id
['delivery_id', ''],//快递单号
['delivery_code', ''],//快递公司编码
['delivery_type', ''],//快递公司名称
['express_record_type', 2],//发货记录类型
['express_temp_id', ""],//电子面单模板
['to_name', ''],//寄件人姓名
['to_tel', ''],//寄件人电话
['to_addr', ''],//寄件人地址
['sh_delivery_name', ''],//送货人姓名
['sh_delivery_id', ''],//送货人电话
['sh_delivery_uid', ''],//送货人ID
['fictitious_content', '']//虚拟发货内容
]);
if ($data['delivery_type']) {
$data['delivery_name'] = $data['delivery_type'];
unset($data['delivery_type']);
}
$services->delivery((int)$id, $data);
return app('json')->successful('发货成功!');
}
/**
* 订单改价
* @param Request $request
* @param StoreOrderServices $services
* @return mixed
* @throws \Exception
*/
public function price(Request $request, StoreOrderServices $services)
{
[$order_id, $price] = $request->postMore([
['order_id', ''],
['price', '']
], true);
$order = $this->service->getOne(['order_id' => $order_id], 'id,user_phone,id,paid,pay_price,order_id,total_price,total_postage,pay_postage,gain_integral');
if (!$order) return app('json')->fail('订单不存在');
if ($order['paid']) {
return app('json')->fail('订单已支付');
}
if ($price === '') return app('json')->fail('请填写实际支付金额');
if ($price < 0) return app('json')->fail('实际支付金额不能小于0元');
if ($order['pay_price'] == $price) return app('json')->successful('改价成功');
$services->updateOrder($order['id'], ['total_price' => $order['total_price'], 'pay_price' => $price]);
return app('json')->successful('改价成功');
}
/**
* 订单备注
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function remark(Request $request)
{
[$order_id, $remark] = $request->postMore([
['order_id', ''],
['remark', '']
], true);
$order = $this->service->getOne(['order_id' => $order_id], 'id,remark');
if (!$order) return app('json')->fail('订单不存在');
if (!strlen(trim($remark))) return app('json')->fail('请填写备注内容');
$order->remark = $remark;
if (!$order->save())
return app('json')->fail('备注失败');
return app('json')->successful('备注成功');
}
/**
* 订单交易额/订单数量时间统计
* @param Request $request
* @return bool
*/
public function time(Request $request)
{
list($start, $stop, $type) = $request->getMore([
['start', strtotime(date('Y-m'))],
['stop', time()],
['type', 1]
], true);
$start = strtotime(date('Y-m-d 00:00:00', (int)$start));
$stop = strtotime(date('Y-m-d 23:59:59', (int)$stop));
if ($start > $stop) {
$middle = $stop;
$stop = $start;
$start = $middle;
}
$space = bcsub($stop, $start, 0);//间隔时间段
$front = bcsub($start, $space, 0);//第一个时间段
/** @var StoreOrderServices $orderService */
$orderService = app()->make(StoreOrderServices::class);
$order_where = [
'pid' => 0,
'paid' => 1,
'refund_status' => [0, 3],
'is_del' => 0,
'is_system_del' => 0];
if ($type == 1) {//销售额
$frontPrice = $orderService->sum($order_where + ['time' => [$front, $start]], 'pay_price', true);
$afterPrice = $orderService->sum($order_where + ['time' => [$start, $stop]], 'pay_price', true);
$chartInfo = $orderService->chartTimePrice($start, $stop);
$data['chart'] = $chartInfo;//营业额图表数据
$data['time'] = $afterPrice;//时间区间营业额
$increase = (float)bcsub((string)$afterPrice, (string)$frontPrice, 2); //同比上个时间区间增长营业额
$growthRate = abs($increase);
if ($growthRate == 0) $data['growth_rate'] = 0;
else if ($frontPrice == 0) $data['growth_rate'] = (int)bcmul($growthRate, 100, 0);
else $data['growth_rate'] = (int)bcmul((string)bcdiv((string)$growthRate, (string)$frontPrice, 2), '100', 0);//时间区间增长率
$data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
$data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
} else {//订单数
$frontNumber = $orderService->count($order_where + ['time' => [$front, $start]]);
$afterNumber = $orderService->count($order_where + ['time' => [$start, $stop]]);
$chartInfo = $orderService->chartTimeNumber($start, $stop);
$data['chart'] = $chartInfo;//订单数图表数据
$data['time'] = $afterNumber;//时间区间订单数
$increase = $afterNumber - $frontNumber; //同比上个时间区间增长订单数
$growthRate = abs($increase);
if ($growthRate == 0) $data['growth_rate'] = 0;
else if ($frontNumber == 0) $data['growth_rate'] = (int)bcmul($growthRate, 100, 0);
else $data['growth_rate'] = (int)bcmul((string)bcdiv((string)$growthRate, (string)$frontNumber, 2), '100', 0);//时间区间增长率
$data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
$data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
}
return app('json')->successful($data);
}
/**
* 订单支付
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function offline(Request $request, OrderOfflineServices $services)
{
[$orderId] = $request->postMore([['order_id', '']], true);
$orderInfo = $this->service->getOne(['order_id' => $orderId], 'id');
if (!$orderInfo) return app('json')->fail('参数错误');
$id = $orderInfo->id;
$services->orderOffline((int)$id);
return app('json')->successful('确认成功!');
}
/**
* 订单退款
* @param Request $request
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function refund(Request $request, StoreOrderRefundServices $services, StoreOrderServices $orderServices, StoreOrderCartInfoServices $storeOrderCartInfoServices, StoreOrderCreateServices $storeOrderCreateServices)
{
list($orderId, $price, $type) = $request->postMore([
['order_id', ''],
['price', '0'],
['type', 1],
], true);
if (!strlen(trim($orderId))) return app('json')->fail('参数错误');
//退款订单详情
$orderRefund = $services->getOne(['order_id' => $orderId]);
$is_admin = 0;
if (!$orderRefund) {
//主动退款主订单详情
$orderRefund = $orderRefund ?: $orderServices->getOne(['order_id' => $orderId]);
$is_admin = 1;
if ($services->count(['store_order_id' => $orderRefund['id'], 'refund_type' => [0, 1, 2, 4, 5], 'is_cancel' => 0, 'is_del' => 0])) {
return app('json')->fail('请先处理售后申请');
}
}
if (!$is_admin) {
if (!$orderRefund) {
return app('json')->fail('数据不存在!');
}
if ($orderRefund['is_cancel'] == 1) {
return app('json')->fail('用户已取消申请');
}
$orderInfo = $this->service->get((int)$orderRefund['store_order_id']);
if (!$orderInfo) {
return app('json')->fail('数据不存在');
}
if (!in_array($orderRefund['refund_type'], [1, 2, 5])) {
return app('json')->fail('售后订单状态不支持该操作');
}
if ($type == 1) {
$data['refund_type'] = 6;
} else if ($type == 2) {
$data['refund_type'] = 3;
} else {
return app('json')->fail('退款修改状态错误');
}
$data['refunded_time'] = time();
//拒绝退款
if ($type == 2) {
$services->refuseRefund((int)$orderRefund['id'], $data, $orderRefund);
return app('json')->successful('修改退款状态成功!');
} else {
if ($orderRefund['refund_price'] == $orderInfo['refunded_price']) return app('json')->fail('已退完支付金额!不能再退款了');
if (!$price) {
return app('json')->fail('请输入退款金额');
}
$data['refunded_price'] = bcadd($price, $orderRefund['refunded_price'], 2);
$bj = bccomp((float)$orderRefund['refund_price'], (float)$data['refunded_price'], 2);
if ($bj < 0) {
return app('json')->fail('退款金额大于支付金额,请修改退款金额');
}
$refundData['pay_price'] = $orderInfo['pay_price'];
$refundData['refund_price'] = $price;
//修改订单退款状态
if ($services->update((int)$orderRefund['id'], $data)) {
$services->agreeRefund((int)$orderRefund['id'], $refundData);
return app('json')->success('退款成功');
} else {
$services->storeProductOrderRefundYFasle((int)$orderInfo['id'], $price);
return app('json')->fail('退款失败');
}
}
} else {
$order = $orderRefund;
$data['refund_price'] = $price;
$data['type'] = $type;
$id = $order['id'];
//0元退款
if ($order['pay_price'] == 0 && in_array($order['refund_status'], [0, 1])) {
$refund_price = 0;
} else {
if ($order['pay_price'] == $order['refund_price']) {
return app('json')->fail('已退完支付金额!不能再退款了');
}
if (!$data['refund_price']) {
return app('json')->fail('请输入退款金额');
}
$refund_price = $data['refund_price'];
$data['refund_price'] = bcadd($data['refund_price'], $order['refund_price'], 2);
$bj = bccomp((string)$order['pay_price'], (string)$data['refund_price'], 2);
if ($bj < 0) {
return app('json')->fail('退款金额大于支付金额,请修改退款金额');
}
}
if ($data['type'] == 1) {
$data['refund_status'] = 2;
$data['refund_type'] = 6;
} else if ($data['type'] == 2) {
$data['refund_status'] = 0;
$data['refund_type'] = 3;
}
$type = $data['type'];
//拒绝退款
if ($type == 2) {
$this->service->update((int)$order['id'], ['refund_status' => 0, 'refund_type' => 3]);
return app('json')->successful('修改退款状态成功!');
} else {
unset($data['type']);
$refund_data['pay_price'] = $order['pay_price'];
$refund_data['refund_price'] = $refund_price;
//主动退款清楚原本退款单
$services->delete(['store_order_id' => $id]);
//生成退款订单
$refundOrderData['uid'] = $order['uid'];
$refundOrderData['store_id'] = $order['store_id'];
$refundOrderData['store_order_id'] = $id;
$refundOrderData['refund_num'] = $order['total_num'];
$refundOrderData['refund_type'] = $data['refund_type'];
$refundOrderData['refund_price'] = $order['pay_price'];
$refundOrderData['refunded_price'] = $refund_price;
$refundOrderData['refunded_reason'] = '管理员手动退款';
$refundOrderData['order_id'] = $storeOrderCreateServices->getNewOrderId('');
$refundOrderData['refunded_time'] = time();
$refundOrderData['add_time'] = time();
$cartInfos = $storeOrderCartInfoServices->getCartColunm(['oid' => $id], 'id,cart_id,cart_num,cart_info');
foreach ($cartInfos as &$cartInfo) {
$cartInfo['cart_info'] = is_string($cartInfo['cart_info']) ? json_decode($cartInfo['cart_info'], true) : $cartInfo['cart_info'];
}
$refundOrderData['cart_info'] = json_encode(array_column($cartInfos, 'cart_info'));
$res = $services->save($refundOrderData);
//修改订单退款状态
if ($this->service->update($id, $data)) {
$services->agreeRefund((int)$res->id, $refund_data);
return app('json')->success('退款成功');
} else {
$services->storeProductOrderRefundYFasle((int)$id, $refund_price);
return app('json')->fail('退款失败');
}
}
}
}
/**
* 门店核销
* @param Request $request
*/
public function order_verific(Request $request, StoreOrderWriteOffServices $services)
{
list($verifyCode, $isConfirm) = $request->postMore([
['verify_code', ''],
['is_confirm', 0]
], true);
if (!$verifyCode) return app('json')->fail('Lack of write-off code');
$uid = $request->uid();
$orderInfo = $services->writeOffOrder($verifyCode, (int)$isConfirm, $uid);
if ($isConfirm == 0) {
return app('json')->success($orderInfo);
}
return app('json')->success('Write off successfully');
}
/**
* 获取所有配送员列表
* @param DeliveryServiceServices $services
* @return mixed
*/
public function getDeliveryAll(DeliveryServiceServices $services)
{
$list = $services->getDeliveryList();
return app('json')->success($list['list']);
}
/**
* 获取配置信息
* @return mixed
*/
public function getDeliveryInfo()
{
return app('json')->success([
'express_temp_id' => sys_config('config_export_temp_id'),
'to_name' => sys_config('config_export_to_name'),
'id' => sys_config('config_export_id'),
'to_tel' => sys_config('config_export_to_tel'),
'to_add' => sys_config('config_export_to_address')
]);
}
/**
* 获取面单信息
* @param ServeServices $services
* @return mixed
*/
public function getExportTemp(Request $request, ServeServices $services)
{
[$com] = $request->getMore([
['com', ''],
], true);
return app('json')->success($services->express()->temp($com));
}
/**
* 物流公司
* @param ExpressServices $services
* @return mixed
*/
public function getExportAll(ExpressServices $services)
{
return app('json')->success($services->expressList());
}
/**
* 移动端订单管理退款列表
* @param Request $request
* @param StoreOrderRefundServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function refundOrderList(Request $request, StoreOrderRefundServices $services)
{
$where = $request->getMore([
['order_id', ''],
['time', ''],
['refund_type', 0],
]);
$data = $services->refundList($where)['list'];
return app('json')->success($data);
}
/**
* 订单详情
* @param Request $request
* @param $uni
* @return mixed
*/
public function refundOrderDetail(StoreOrderRefundServices $services, $uni)
{
$data = $services->refundDetail($uni);
return app('json')->successful('ok', $data);
}
/**
* 退款备注
* @param StoreOrderRefundServices $services
* @param Request $request
* @return mixed
*/
public function refundRemark(StoreOrderRefundServices $services, Request $request)
{
[$remark, $order_id] = $request->postMore([
['remark', ''],
['order_id', ''],
], true);
if (!$remark)
return app('json')->fail('请输入要备注的内容');
if (!$order_id)
return app('json')->fail('缺少参数');
if (!$order = $services->get(['order_id' => $order_id])) {
return app('json')->fail('修改的订单不存在!');
}
$order->remark = $remark;
if ($order->save()) {
return app('json')->success('备注成功');
} else
return app('json')->fail('备注失败');
}
}

View File

@ -16,7 +16,7 @@ use app\services\order\OtherOrderServices;
use app\services\pay\OrderPayServices;
use app\services\pay\PayServices;
use app\services\pay\YuePayServices;
use app\services\user\MemberCardServices;
use app\services\user\member\MemberCardServices;
use app\services\user\UserServices;
use crmeb\services\CacheService;
use crmeb\services\SystemConfigService;
@ -137,7 +137,6 @@ class OtherOrderController
return app('json')->status('wechat_pay', '前往支付', $info);
}
}
break;
case PayServices::YUE_PAY:
/** @var YuePayServices $yueServices */
$yueServices = app()->make(YuePayServices::class);
@ -150,7 +149,6 @@ class OtherOrderController
else
return app('json')->status('pay_error', $pay);
}
break;
case PayServices::ALIAPY_PAY:
if (!$quitUrl && $from != 'routine') {
return app('json')->status('pay_error', '请传入支付宝支付回调URL', $info);
@ -172,10 +170,8 @@ class OtherOrderController
$info['pay_key'] = $payKey;
return app('json')->status(PayServices::ALIAPY_PAY . '_pay', '前往支付', $info);
}
break;
case PayServices::OFFLINE_PAY:
return app('json')->status('success', '前往支付', $info);
break;
}
} else return app('json')->fail('订单生成失败!');
}

View File

@ -12,16 +12,17 @@ namespace app\api\controller\v1\order;
use app\Request;
use app\services\pay\PayServices;
use app\services\user\UserServices;
use app\services\shipping\ExpressServices;
use app\services\system\admin\SystemAdminServices;
use app\services\user\UserInvoiceServices;
use app\services\activity\{lottery\LuckLotteryServices,
StoreBargainServices,
StoreCombinationServices,
StorePinkServices,
StoreSeckillServices
bargain\StoreBargainServices,
combination\StoreCombinationServices,
combination\StorePinkServices,
seckill\StoreSeckillServices
};
use app\services\coupon\StoreCouponIssueServices;
use app\services\activity\coupon\StoreCouponIssueServices;
use app\services\order\{OtherOrderServices,
StoreCartServices,
StoreOrderCartInfoServices,
@ -32,8 +33,8 @@ use app\services\order\{OtherOrderServices,
StoreOrderRefundServices,
StoreOrderServices,
StoreOrderSuccessServices,
StoreOrderTakeServices,
StoreOrderWriteOffServices};
StoreOrderTakeServices
};
use app\services\pay\OrderPayServices;
use app\services\pay\YuePayServices;
use app\services\product\product\StoreProductReplyServices;
@ -64,7 +65,8 @@ class StoreOrderController
'weixin' => 0,
'routine' => 1,
'weixinh5' => 2,
'pc' => 3
'pc' => 3,
'app' => 4
];
/**
@ -86,16 +88,17 @@ class StoreOrderController
if (!$services->get(1, ['id'])) {
return app('json')->fail('默认模板未配置,无法下单');
}
[$cartId, $new, $addressId] = $request->postMore([
[$cartId, $new, $addressId, $shipping_type] = $request->postMore([
'cartId',
'new',
['addressId', 0]
['addressId', 0],
['shipping_type', 1],
], true);
if (!is_string($cartId) || !$cartId) {
return app('json')->fail('请提交购买的商品');
}
$user = $request->user()->toArray();
return app('json')->successful($this->services->getOrderConfirmData($user, $cartId, !!$new, $addressId));
return app('json')->successful($this->services->getOrderConfirmData($user, $cartId, !!$new, $addressId, (int)$shipping_type));
}
/**
@ -156,7 +159,7 @@ class StoreOrderController
$uid = (int)$request->uid();
if ($checkOrder = $this->services->getOne(['order_id|unique' => $key, 'uid' => $uid, 'is_del' => 0]))
return app('json')->status('extend_order', '订单已创建,请点击查看完成支付', ['orderId' => $checkOrder['order_id'], 'key' => $key]);
[$addressId, $couponId, $payType, $useIntegral, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, $from, $shipping_type, $real_name, $phone, $storeId, $news, $invoice_id, $quitUrl, $advanceId, $virtual_type] = $request->postMore([
[$addressId, $couponId, $payType, $useIntegral, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, $from, $shipping_type, $real_name, $phone, $storeId, $news, $invoice_id, $quitUrl, $advanceId, $virtual_type, $customForm] = $request->postMore([
[['addressId', 'd'], 0],
[['couponId', 'd'], 0],
['payType', ''],
@ -175,7 +178,8 @@ class StoreOrderController
[['invoice_id', 'd'], 0],
['quitUrl', ''],
[['advanceId', 'd'], 0],
['virtual_type', 0]
['virtual_type', 0],
['custom_form', []],
], true);
$payType = strtolower($payType);
$cartGroup = $this->services->getCacheOrderInfo($uid, $key);
@ -210,7 +214,7 @@ class StoreOrderController
$payType = 'pc';
}
$isChannel = $this->getChennel[$from] ?? ($request->isApp() ? 0 : 1);
$cartInfo = null;
if ($seckill_id || $combinationId || $bargainId || $advanceId) {
$cartInfo = $cartGroup['cartInfo'];
foreach ($cartInfo as $item) {
@ -231,7 +235,7 @@ class StoreOrderController
}
}
$virtual_type = $cartGroup['cartInfo'][0]['productInfo']['virtual_type'] ?? 0;
$order = $createServices->createOrder($uid, $key, $cartGroup, $request->user()->toArray(), $addressId, $payType, !!$useIntegral, $couponId, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, $isChannel, $shipping_type, $real_name, $phone, $storeId, !!$news, $advanceId, $virtual_type);
$order = $createServices->createOrder($uid, $key, $cartGroup, $request->user()->toArray(), $addressId, $payType, !!$useIntegral, $couponId, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, $isChannel, $shipping_type, $real_name, $phone, $storeId, !!$news, $advanceId, $virtual_type, $customForm);
if ($order === false) {
if ($seckill_id || $combinationId || $advanceId || $bargainId) {
foreach ($cartInfo as $item) {
@ -280,7 +284,7 @@ class StoreOrderController
} else {
/** @var OrderPayServices $payServices */
$payServices = app()->make(OrderPayServices::class);
if (!$from && $request->isApp()) {
if ($from == 'app' && $request->isApp()) {
$from = 'weixin';
}
$info['jsConfig'] = $payServices->orderPay($orderInfo, $from);
@ -290,7 +294,6 @@ class StoreOrderController
return app('json')->status('wechat_pay', '订单创建成功', $info);
}
}
break;
case PayServices::YUE_PAY:
/** @var YuePayServices $yueServices */
$yueServices = app()->make(YuePayServices::class);
@ -303,7 +306,6 @@ class StoreOrderController
else
return app('json')->status('pay_error', $pay);
}
break;
case PayServices::ALIAPY_PAY:
if (!$quitUrl && ($request->isH5() || $request->isWechat())) {
return app('json')->status('pay_error', '请传入支付宝支付回调URL', $info);
@ -329,11 +331,10 @@ class StoreOrderController
$info['pay_key'] = $payKey;
return app('json')->status(PayServices::ALIAPY_PAY . '_pay', '订单创建成功', $info);
}
break;
case PayServices::OFFLINE_PAY:
case 'pc':
case 'friend':
return app('json')->status('success', '订单创建成功', $info);
break;
}
} else return app('json')->fail('订单生成失败!');
}
@ -358,7 +359,7 @@ class StoreOrderController
else if ($v['bargain_id']) return app('json')->fail('砍价商品不能再来一单,请在砍价商品内自行下单!');
else if ($v['seckill_id']) return app('json')->fail('秒杀商品不能再来一单,请在秒杀商品内自行下单!');
else if ($v['advance_id']) return app('json')->fail('预售商品不能再来一单,请在预售商品内自行下单!');
else $cateId[] = $services->setCart($request->uid(), (int)$v['product_id'], (int)$v['cart_num'], isset($v['productInfo']['attrInfo']['unique']) ? $v['productInfo']['attrInfo']['unique'] : '', '0', true);
else $cateId[] = $services->setCart($request->uid(), (int)$v['product_id'], (int)$v['cart_num'], $v['productInfo']['attrInfo']['unique'] ?? '', '0', true);
}
if (!$cateId) return app('json')->fail('再来一单失败,请重新下单!');
return app('json')->successful('ok', ['cateId' => implode(',', $cateId)]);
@ -372,14 +373,19 @@ class StoreOrderController
*/
public function pay(Request $request, StorePinkServices $services, OrderPayServices $payServices, YuePayServices $yuePayServices)
{
[$uni, $paytype, $from, $quitUrl] = $request->postMore([
[$uni, $paytype, $from, $quitUrl, $type] = $request->postMore([
['uni', ''],
['paytype', 'weixin'],
['from', 'weixin'],
['quitUrl', '']
['quitUrl', ''],
['type', 0]
], true);
if (!$uni) return app('json')->fail('参数错误!');
$order = $this->services->getUserOrderDetail($uni, (int)$request->uid());
$orderInfo = $this->services->get(['order_id' => $uni]);
$uid = $type == 1 ? (int)$request->uid() : $orderInfo->uid;
$orderInfo->pay_uid = $uid;
$orderInfo->save();
$order = $this->services->get(['order_id' => $uni]);
if (!$order)
return app('json')->fail('订单不存在!');
if ($order['paid'])
@ -390,17 +396,23 @@ class StoreOrderController
if (!Cache::get('pay_' . $order['order_id'])) {
switch ($from) {
case 'weixin':
if (in_array($order->is_channel, [1, 2, 3])) {//0
if ($type == 1) {
$order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
} elseif (in_array($order->is_channel, [1, 2, 3])) {//0
$order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
}
break;
case 'weixinh5':
if (in_array($order->is_channel, [0, 1, 3])) {
if ($type == 1) {
$order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
} elseif (in_array($order->is_channel, [0, 1, 3])) {
$order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
}
break;
case 'routine':
if (in_array($order->is_channel, [0, 2, 3])) {
if ($type == 1) {
$order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
} elseif (in_array($order->is_channel, [0, 2, 3])) {
$order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
}
break;
@ -432,7 +444,6 @@ class StoreOrderController
$payKey = md5($order['order_id']);
CacheService::set($payKey, ['order_id' => $order['order_id'], 'other_pay_type' => false], 300);
return app('json')->status(PayServices::ALIAPY_PAY . '_pay', '订单创建成功', ['jsConfig' => $jsConfig, 'order_id' => $order['order_id'], 'pay_key' => $payKey]);
break;
case PayServices::YUE_PAY:
$pay = $yuePayServices->yueOrderPay($order->toArray(), $request->uid());
if ($pay['status'] === true)
@ -443,13 +454,11 @@ class StoreOrderController
else
return app('json')->status('pay_error', $pay);
}
break;
case PayServices::OFFLINE_PAY:
if ($this->services->setOrderTypePayOffline($order['order_id']))
return app('json')->status('success', '订单创建成功');
else
return app('json')->status('success', '支付失败');
break;
}
return app('json')->fail('支付方式错误');
}
@ -526,17 +535,6 @@ class StoreOrderController
if (!$order) return app('json')->fail('订单不存在');
$order = $order->toArray();
$splitNum = [];
if (isset($order['split']) && $order['split']) {
foreach ($order['split'] as &$item) {
$item = $this->services->tidyOrder($item, true);
if ($item['_status']['_type'] == 3) {
foreach ($item['cartInfo'] ?: [] as $key => $product) {
$item['cartInfo'][$key]['add_time'] = isset($product['add_time']) ? date('Y-m-d H:i', (int)$product['add_time']) : '时间错误';
}
}
}
$splitNum = $storeOrderCartInfoServices->getSplitCartNum($order['cart_id']);
}
//是否开启门店自提
$store_self_mention = sys_config('store_self_mention');
//关闭门店自提后 订单隐藏门店信息
@ -576,7 +574,7 @@ class StoreOrderController
$order['mapKey'] = sys_config('tengxun_map_key');
$order['yue_pay_status'] = (int)sys_config('balance_func_status') && (int)sys_config('yue_pay_status') == 1 ? (int)1 : (int)2;//余额支付 1 开启 2 关闭
$order['pay_weixin_open'] = (int)sys_config('pay_weixin_open') ?? 0;//微信支付 1 开启 0 关闭
$order['ali_pay_status'] = sys_config('ali_pay_status') ? true : false;//支付包支付 1 开启 0 关闭
$order['ali_pay_status'] = (bool)sys_config('ali_pay_status');//支付包支付 1 开启 0 关闭
$orderData = $this->services->tidyOrder($order, true, true);
$vipTruePrice = 0;
foreach ($orderData['cartInfo'] ?? [] as $key => $cart) {
@ -605,32 +603,46 @@ class StoreOrderController
$orderData['refund_cartInfo'] = $orderData['cartInfo'];
$orderData['refund_total_num'] = $orderData['total_num'];
$orderData['refund_pay_price'] = $orderData['pay_price'];
$is_apply_refund = true;
if (in_array($order['pid'], [0, -1])) {
$cart_infos = $storeOrderCartInfoServices->getSplitCartList((int)$order['id'], 'surplus_num,cart_info');
$orderData['refund_cartInfo'] = [];
$orderData['refund_total_num'] = $orderData['refund_pay_price'] = 0;
if ($cart_infos) {
$cart_info = [];
foreach ($cart_infos as $cart) {
$info = $cart['cart_info'];
$info['cart_num'] = $cart['surplus_num'];
$cart_info[] = $info;
}
$orderData['refund_cartInfo'] = $cart_info;
/** @var StoreOrderComputedServices $orderComputeServices */
$orderComputeServices = app()->make(StoreOrderComputedServices::class);
$orderData['refund_total_num'] = $orderComputeServices->getOrderSumPrice($cart_info, 'cart_num', false);
$orderData['refund_pay_price'] = $orderComputeServices->getOrderSumPrice($cart_info, 'truePrice');
} else {//主订单已全部发货 不可申请退款
$is_apply_refund = false;
}
$orderData['is_apply_refund'] = true;
$orderData['help_info'] = [
'pay_uid' => $orderData['pay_uid'],
'pay_nickname' => '',
'pay_avatar' => '',
'help_status' => 0
];
if ($orderData['uid'] != $orderData['pay_uid']) {
/** @var UserServices $userServices */
$userServices = app()->make(UserServices::class);
$payUser = $userServices->get($orderData['pay_uid']);
$orderData['help_info'] = [
'pay_uid' => $orderData['pay_uid'],
'pay_nickname' => $payUser['nickname'],
'pay_avatar' => $payUser['avatar'],
'help_status' => 1
];
}
$orderData['is_apply_refund'] = $is_apply_refund;
return app('json')->successful('ok', $orderData);
}
/**
* 代付订单详情
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function friendDetail(Request $request)
{
[$orderId] = $request->getMore([
['order_id', '']
], true);
$info = $this->services->getFriendDetail($orderId, $request->uid());
return app('json')->successful(compact('info'));
}
/**
* TODO 弃用
* 退款订单详情
* @param Request $request
* @param $uni
@ -723,35 +735,59 @@ class StoreOrderController
*/
public function express(Request $request, StoreOrderCartInfoServices $services, ExpressServices $expressServices, $uni, $type = '')
{
if (!$uni || !($order = $this->services->getUserOrderDetail($uni, $request->uid()))) return app('json')->fail('查询订单不存在!');
if ($type != 'refund' && ($order['delivery_type'] != 'express' || !$order['delivery_id'])) return app('json')->fail('该订单不存在快递单号!');
$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['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);
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['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 = $this->services->getUserOrderDetail($uni, $request->uid()))) return app('json')->fail('查询订单不存在!');
if ($type != 'refund' && ($order['delivery_type'] != 'express' || !$order['delivery_id'])) return app('json')->fail('该订单不存在快递单号!');
$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['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;
}
$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')->successful([
'order' => $orderInfo,
'express' => [
'result' => ['list' => $expressServices->query($cacheName, $express, $orderInfo['delivery_code'])
'result' => ['list' => $expressServices->query($cacheName, $orderInfo['delivery_id'], $orderInfo['delivery_code'])
]
]
]);
@ -856,7 +892,99 @@ class StoreOrderController
}
/**
* 订单退款审核
* 获取可以退货的订单商品列表
* @param Request $request
* @param StoreOrderCartInfoServices $services
* @param $id
* @return mixed
*/
public function refundCartInfo(Request $request, StoreOrderCartInfoServices $services, $id)
{
if (!$id) {
return app('json')->fail('缺少发货ID');
}
[$cart_ids] = $request->postMore([
['cart_ids', []]
], true);
$list = $services->getRefundCartList((int)$id);
if ($cart_ids) {
foreach ($cart_ids as $cart) {
if (!isset($cart['cart_id']) || !$cart['cart_id'] || !isset($cart['cart_num']) || !$cart['cart_num'] || $cart['cart_num'] <= 0) {
return app('json')->fail('请重新选择退款商品,或件数');
}
}
$cart_ids = array_combine(array_column($cart_ids, 'cart_id'), $cart_ids);
foreach ($list as &$item) {
if (isset($cart_ids[$item['cart_id']]['cart_num'])) $item['cart_num'] = $cart_ids[$item['cart_id']]['cart_num'];
}
}
return app('json')->success($list);
}
/**
* 获取退货商品列表
* @param StoreOrderCartInfoServices $services
* @param $id
* @return mixed
*/
public function refundCartInfoList(Request $request)
{
[$cart_ids, $id] = $request->postMore([
['cart_ids', []],
['id', 0],
], true);
if (!$id) {
return app('json')->fail('缺少发货ID');
}
return app('json')->success($this->services->refundCartInfoList((array)$cart_ids, (int)$id));
}
/**
* 用户申请退款
* @param Request $request
* @return mixed
*/
public function applyRefund(Request $request, StoreOrderRefundServices $services, StoreOrderServices $storeOrderServices, $id)
{
if (!$id) {
return app('json')->fail('缺少参数!');
}
$data = $request->postMore([
['text', ''],
['refund_reason_wap_img', ''],
['refund_reason_wap_explain', ''],
['refund_type', 1],
['refund_price', 0.00],
['cart_ids', []]
]);
if ($data['text'] == '') return app('json')->fail('参数错误!');
if ($data['cart_ids']) {
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('请重新选择退款商品,或件数');
}
}
}
$order = $storeOrderServices->get($id);
$uid = (int)$request->uid();
if (!$order || $uid != $order['uid']) {
return app('json')->fail('订单不存在!');
}
$refundData = [
'refund_reason' => $data['text'],
'refund_explain' => $data['refund_reason_wap_explain'],
'refund_img' => json_encode($data['refund_reason_wap_img'] != '' ? explode(',', $data['refund_reason_wap_img']) : []),
];
$res = $services->applyRefund((int)$id, $uid, $order, $data['cart_ids'], (int)$data['refund_type'], (float)$data['refund_price'], $refundData);
if ($res)
return app('json')->successful('提交申请成功');
else
return app('json')->fail('提交失败');
}
/**
* 订单申请退款审核
* @param Request $request
* @return mixed
*/
@ -871,19 +999,20 @@ class StoreOrderController
['cart_id', 0],
['refund_num', 0]
]);
$uni = $data['uni'];
unset($data['uni']);
if ($data['refund_reason_wap_img'] != '') {
$data['refund_reason_wap_img'] = explode(',', $data['refund_reason_wap_img']);
} else {
$data['refund_reason_wap_img'] = [];
}
if (!$uni || $data['text'] == '' || $data['refund_num'] <= 0) return app('json')->fail('参数错误!');
$res = $services->orderApplyRefund($this->services->getUserOrderDetail($uni, (int)$request->uid()), $data['text'], $data['refund_reason_wap_explain'], $data['refund_reason_wap_img'], $data['refund_type'], $data['cart_id'], $data['refund_num']);
if ($res)
return app('json')->successful('提交申请成功');
else
return app('json')->fail('提交失败');
var_dump($data);
// $uni = $data['uni'];
// unset($data['uni']);
// if ($data['refund_reason_wap_img'] != '') {
// $data['refund_reason_wap_img'] = explode(',', $data['refund_reason_wap_img']);
// } else {
// $data['refund_reason_wap_img'] = [];
// }
// if (!$uni || $data['text'] == '' || $data['refund_num'] <= 0) return app('json')->fail('参数错误!');
// $res = $services->orderApplyRefund($this->services->getUserOrderDetail($uni, (int)$request->uid()), $data['text'], $data['refund_reason_wap_explain'], $data['refund_reason_wap_img'], $data['refund_type'], $data['cart_id'], $data['refund_num']);
// if ($res)
// return app('json')->successful('提交申请成功');
// else
// return app('json')->fail('提交失败');
}
/**
@ -957,22 +1086,5 @@ class StoreOrderController
return app('json')->successful($cartProduct);
}
/**
* 门店核销
* @param Request $request
*/
public function order_verific(Request $request, StoreOrderWriteOffServices $services)
{
list($verifyCode, $isConfirm) = $request->postMore([
['verify_code', ''],
['is_confirm', 0]
], true);
if (!$verifyCode) return app('json')->fail('Lack of write-off code');
$uid = $request->uid();
$orderInfo = $services->writeOffOrder($verifyCode, (int)$isConfirm, $uid);
if ($isConfirm == 0) {
return app('json')->success($orderInfo);
}
return app('json')->success('Write off successfully');
}
}

View File

@ -0,0 +1,96 @@
<?php
namespace app\api\controller\v1\order;
use app\Request;
use app\services\order\StoreOrderRefundServices;
class StoreOrderRefundController
{
/**
* @var StoreOrderRefundServices
*/
protected $services;
/**
* StoreOrderRefundController constructor.
* @param StoreOrderRefundServices $services
*/
public function __construct(StoreOrderRefundServices $services)
{
$this->services = $services;
}
/**
* 退款订单列表
* @param Request $request
* @return mixed
*/
public function refundList(Request $request)
{
$where = $request->getMore([
['refund_status', ''],
]);
$where['uid'] = $request->uid();
$where['is_cancel'] = 0;
$where['is_del'] = 0;
$data = $this->services->refundList($where);
return app('json')->success($data);
}
/**
* 退款单详情
* @param Request $request
* @param $uni
* @return mixed
*/
public function refundDetail(Request $request, $uni)
{
$orderData = $this->services->refundDetail($uni);
return app('json')->successful($orderData);
}
/**
* 取消申请
* @param $id
* @return mixed
*/
public function cancelApply(Request $request, $uni)
{
if (!strlen(trim($uni))) return app('json')->fail('参数错误');
$orderRefund = $this->services->get(['order_id' => $uni, 'is_cancel' => 0]);
if (!$orderRefund || $orderRefund['uid'] != $request->uid()) {
return app('json')->fail('订单不存在');
}
if (!in_array($orderRefund['refund_type'], [1, 2, 4, 5])) {
return app('json')->fail('当前状态不能取消申请');
}
$this->services->update($orderRefund['id'], ['is_cancel' => 1]);
$this->services->cancelOrderRefundCartInfo((int)$orderRefund['id'], (int)$orderRefund['store_order_id'], $orderRefund);
return app('json')->success('取消成功');
}
/**
* 用户退货提交快递单号
* @param Request $request
* @param StoreOrderRefundServices $services
* @return mixed
*/
public function applyExpress(Request $request)
{
$data = $request->postMore([
['id', ''],
['refund_express', ''],
['refund_phone', ''],
['refund_express_name', ''],
['refund_img', ''],
['refund_explain', ''],
]);
if ($data['id'] == '') return app('json')->fail('参数错误!');
$res = $this->services->editRefundExpress($data);
if ($res)
return app('json')->successful('提交成功');
else
return app('json')->fail('提交失败');
}
}

View File

@ -11,7 +11,7 @@
namespace app\api\controller\v1\store;
use app\Request;
use app\services\activity\StorePinkServices;
use app\services\activity\combination\StorePinkServices;
use app\services\order\StoreCartServices;
/**

View File

@ -11,7 +11,7 @@
namespace app\api\controller\v1\store;
use app\Request;
use app\services\coupon\StoreCouponIssueServices;
use app\services\activity\coupon\StoreCouponIssueServices;
/**
* 优惠券类

View File

@ -15,6 +15,7 @@ use app\services\other\QrcodeServices;
use app\services\product\product\StoreCategoryServices;
use app\services\product\product\StoreProductReplyServices;
use app\services\product\product\StoreProductServices;
use app\services\user\UserServices;
/**
* 商品类
@ -107,7 +108,7 @@ class StoreProductController
/** @var QrcodeServices $qrcodeService */
$qrcodeService = app()->make(QrcodeServices::class);
$url = $qrcodeService->getRoutineQrcodePath($id, $user['uid'], 0, ['is_promoter' => $user['is_promoter']]);
if ($url === false)
if (!$url)
return app('json')->fail('二维码生成失败');
else
return app('json')->successful(['code' => $url]);
@ -138,9 +139,10 @@ class StoreProductController
* 为你推荐
* @return mixed
*/
public function product_hot()
public function product_hot(Request $request)
{
$list = $this->services->getProducts(['is_hot' => 1, 'is_show' => 1, 'is_del' => 0]);
$vip_user = $request->uid() ? app()->make(UserServices::class)->value(['uid' => $request->uid()], 'is_money_level') : 0;
$list = $this->services->getProducts(['is_hot' => 1, 'is_show' => 1, 'is_del' => 0, 'vip_user' => $vip_user]);
return app('json')->success(get_thumb_water($list, 'mid'));
}
@ -206,5 +208,17 @@ class StoreProductController
return app('json')->successful(get_thumb_water($list, 'small', ['pics']));
}
/**
* 获取预售列表
* @param Request $request
* @return mixed
*/
public function advanceList(Request $request)
{
$where = $request->getMore([
[['time_type', 'd'], 0]
]);
return app('json')->successful($this->services->getAdvanceList($where));
}
}

View File

@ -0,0 +1,130 @@
<?php
namespace app\api\controller\v1\user;
use app\Request;
use app\services\agent\DivisionAgentApplyServices;
use app\services\other\AgreementServices;
use app\services\user\UserServices;
use crmeb\exceptions\AdminException;
use crmeb\services\CacheService;
class DivisionController
{
protected $services = NUll;
/**
* DivisionController constructor.
* @param DivisionAgentApplyServices $services
*/
public function __construct(DivisionAgentApplyServices $services)
{
$this->services = $services;
}
/**
* 申请代理商
* @param Request $request
* @param $id
* @return mixed
*/
public function applyAgent(Request $request, $id)
{
$data = $request->postMore([
['uid', 0],
['agent_name', ''],
['name', ''],
['phone', 0],
['code', 0],
['division_invite', 0],
['images', []]
]);
$verifyCode = CacheService::get('code_' . $data['phone']);
if ($verifyCode != $data['code']) return app('json')->fail('验证码错误');
$this->services->applyAgent($data, $id);
return app('json')->success('提交成功');
}
/**
* 申请详情
* @param Request $request
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function applyInfo(Request $request)
{
$uid = $request->uid();
$data = $this->services->applyInfo($uid);
return app('json')->success($data);
}
/**
* 移动端获取规则
* @param AgreementServices $agreementServices
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getAgentAgreement(AgreementServices $agreementServices)
{
$data = $agreementServices->getAgreementBytype(2);
return app('json')->success($data);
}
/**
* 员工列表
* @param Request $request
* @return mixed
*/
public function getStaffList(Request $request)
{
$where = $request->postMore([
['keyword', ''],
['sort', ''],
]);
$where['agent_id'] = $request->uid();
return app('json')->successful($this->services->getStaffList($request->user(), $where));
}
/**
* 设置员工比例
* @param Request $request
* @return mixed
*/
public function setStaffPercent(Request $request)
{
[$agentPercent, $uid] = $request->postMore([
['agent_percent', ''],
['uid', 0],
], true);
$agentId = $request->uid();
if (!$uid) return app('json')->fail('参数错误');
/** @var UserServices $userService */
$userService = app()->make(UserServices::class);
$upPercent = $userService->value(['uid' => $agentId], 'division_percent');
if ($agentPercent >= $upPercent) return app('json')->fail('比例不能大于您的比例');
$userService->update(['uid' => $uid, 'agent_id' => $agentId], ['division_percent' => $agentPercent]);
return app('json')->success('设置成功');
}
/**
* 删除员工
* @param Request $request
* @param $uid
* @return mixed
*/
public function delStaff(Request $request, $uid)
{
if (!$uid) return app('json')->fail('参数错误');
$agentId = $request->uid();
/** @var UserServices $userService */
$userService = app()->make(UserServices::class);
$userService->update(['uid' => $uid, 'agent_id' => $agentId], ['division_percent' => 0, 'agent_id' => 0, 'division_id' => 0, 'staff_id' => 0, 'division_type' => 0, 'is_staff' => 0]);
return app('json')->success('删除成功');
}
}

View File

@ -12,11 +12,11 @@
namespace app\api\controller\v1\user;
use app\Request;
use app\services\coupon\StoreCouponUserServices;
use app\services\activity\coupon\StoreCouponUserServices;
use app\services\order\OtherOrderServices;
use app\services\other\AgreementServices;
use app\services\user\MemberCardServices;
use app\services\user\MemberRecordServices;
use app\services\user\member\MemberCardServices;
use app\services\user\member\MemberRecordServices;
/** 会员卡
* Class MemberCardController

View File

@ -11,7 +11,7 @@
namespace app\api\controller\v1\user;
use app\Request;
use app\services\system\MessageSystemServices;
use app\services\message\MessageSystemServices;
/**

View File

@ -113,8 +113,8 @@ class UserAddressController
[['type', 'd'], 0]
]);
if (!isset($addressInfo['address']['province']) || !$addressInfo['address']['province'] || $addressInfo['address']['province'] == '省') return app('json')->fail('收货地址格式错误!');
if (!isset($addressInfo['address']['city']) || !$addressInfo['address']['city'] || $addressInfo['address']['city'] == '市') return app('json')->fail('收货地址格式错误!');
if (!isset($addressInfo['address']['district']) || !$addressInfo['address']['district'] || $addressInfo['address']['district'] == '区') return app('json')->fail('收货地址格式错误!');
if (!isset($addressInfo['address']['city']) || !$addressInfo['address']['city'] || $addressInfo['address']['city'] == '市') return app('json')->fail('收货地址格式错误或系统未完善当前地址!');
if (!isset($addressInfo['address']['district']) || !$addressInfo['address']['district'] || $addressInfo['address']['district'] == '区') return app('json')->fail('收货地址格式错误或系统未完善当前地址!');
if (!isset($addressInfo['address']['city_id']) && $addressInfo['type'] == 0) return app('json')->fail('收货地址格式错误!请重新选择!');
if (!$addressInfo['detail']) return app('json')->fail('请填写详细地址!');
$uid = (int)$request->uid();

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