初始版本
This commit is contained in:
85
server/app/common/cache/AdminAccountSafeCache.php
vendored
Executable file
85
server/app/common/cache/AdminAccountSafeCache.php
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
/**
|
||||
* //后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
* Class AdminAccountSafeCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class AdminAccountSafeCache extends BaseCache
|
||||
{
|
||||
|
||||
private $key;//缓存次数名称
|
||||
public $minute = 15;//缓存设置为15分钟,即密码错误次数达到,锁定15分钟
|
||||
public $count = 15; //设置连续输错次数,即15分钟内连续输错误15次后,锁定
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$ip = \request()->ip();
|
||||
$this->key = $this->tagName . $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 记录登录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:51
|
||||
*/
|
||||
public function record()
|
||||
{
|
||||
if ($this->get($this->key)) {
|
||||
//缓存存在,记录错误次数
|
||||
$this->inc($this->key, 1);
|
||||
} else {
|
||||
//缓存不存在,第一次设置缓存
|
||||
$this->set($this->key, 1, $this->minute * 60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 判断是否安全
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:53
|
||||
*/
|
||||
public function isSafe()
|
||||
{
|
||||
$count = $this->get($this->key);
|
||||
if ($count >= $this->count) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除该ip记录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:55
|
||||
*/
|
||||
public function relieve()
|
||||
{
|
||||
$this->delete($this->key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
122
server/app/common/cache/AdminAuthCache.php
vendored
Executable file
122
server/app/common/cache/AdminAuthCache.php
vendored
Executable file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
use app\adminapi\logic\auth\AuthLogic;
|
||||
|
||||
|
||||
/**
|
||||
* 管理员权限缓存
|
||||
* Class AdminAuthCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class AdminAuthCache extends BaseCache
|
||||
{
|
||||
|
||||
private $prefix = 'admin_auth_';
|
||||
private $authConfigList = [];
|
||||
private $cacheMd5Key = ''; //权限文件MD5的key
|
||||
private $cacheAllKey = ''; //全部权限的key
|
||||
private $cacheUrlKey = ''; //管理员的url缓存key
|
||||
private $authMd5 = ''; //权限文件MD5的值
|
||||
private $adminId = '';
|
||||
|
||||
|
||||
public function __construct($adminId = '')
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->adminId = $adminId;
|
||||
// 全部权限
|
||||
$this->authConfigList = AuthLogic::getAllAuth();
|
||||
// 当前权限配置文件的md5
|
||||
$this->authMd5 = md5(json_encode($this->authConfigList));
|
||||
|
||||
$this->cacheMd5Key = $this->prefix . 'md5';
|
||||
$this->cacheAllKey = $this->prefix . 'all';
|
||||
$this->cacheUrlKey = $this->prefix . 'url_' . $this->adminId;
|
||||
|
||||
$cacheAuthMd5 = $this->get($this->cacheMd5Key);
|
||||
$cacheAuth = $this->get($this->cacheAllKey);
|
||||
//权限配置和缓存权限对比,不一样说明权限配置文件已修改,清理缓存
|
||||
if ($this->authMd5 !== $cacheAuthMd5 || empty($cacheAuth)) {
|
||||
$this->deleteTag();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取管理权限uri
|
||||
* @param $adminId
|
||||
* @return array|mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/8/19 15:27
|
||||
*/
|
||||
public function getAdminUri()
|
||||
{
|
||||
//从缓存获取,直接返回
|
||||
$urisAuth = $this->get($this->cacheUrlKey);
|
||||
if ($urisAuth) {
|
||||
return $urisAuth;
|
||||
}
|
||||
|
||||
//获取角色关联的菜单id(菜单或权限)
|
||||
$urisAuth = AuthLogic::getAuthByAdminId($this->adminId);
|
||||
if (empty($urisAuth)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->set($this->cacheUrlKey, $urisAuth, 3600);
|
||||
|
||||
//保存到缓存并读取返回
|
||||
return $urisAuth;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取全部权限uri
|
||||
* @return array|mixed
|
||||
* @author cjhao
|
||||
* @date 2021/9/13 11:41
|
||||
*/
|
||||
public function getAllUri()
|
||||
{
|
||||
$cacheAuth = $this->get($this->cacheAllKey);
|
||||
if ($cacheAuth) {
|
||||
return $cacheAuth;
|
||||
}
|
||||
// 获取全部权限
|
||||
$authList = AuthLogic::getAllAuth();
|
||||
//保存到缓存并读取返回
|
||||
$this->set($this->cacheMd5Key, $this->authMd5);
|
||||
$this->set($this->cacheAllKey, $authList);
|
||||
return $authList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 清理管理员缓存
|
||||
* @return bool
|
||||
* @author cjhao
|
||||
* @date 2021/10/13 18:47
|
||||
*/
|
||||
public function clearAuthCache()
|
||||
{
|
||||
$this->clear($this->cacheUrlKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
110
server/app/common/cache/AdminTokenCache.php
vendored
Executable file
110
server/app/common/cache/AdminTokenCache.php
vendored
Executable file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\auth\AdminSession;
|
||||
|
||||
/**
|
||||
* 管理员token缓存
|
||||
* Class AdminTokenCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class AdminTokenCache extends BaseCache
|
||||
{
|
||||
|
||||
private $prefix = 'token_admin_';
|
||||
|
||||
/**
|
||||
* @notes 通过token获取缓存管理员信息
|
||||
* @param $token
|
||||
* @return false|mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 16:57
|
||||
*/
|
||||
public function getAdminInfo($token)
|
||||
{
|
||||
//直接从缓存获取
|
||||
$adminInfo = $this->get($this->prefix . $token);
|
||||
if ($adminInfo) {
|
||||
return $adminInfo;
|
||||
}
|
||||
|
||||
//从数据获取信息被设置缓存(可能后台清除缓存)
|
||||
$adminInfo = $this->setAdminInfo($token);
|
||||
if ($adminInfo) {
|
||||
return $adminInfo;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 通过有效token设置管理信息缓存
|
||||
* @param $token
|
||||
* @return array|false|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/5 12:12
|
||||
*/
|
||||
public function setAdminInfo($token)
|
||||
{
|
||||
$adminSession = AdminSession::where([['token', '=', $token], ['expire_time', '>', time()]])
|
||||
->find();
|
||||
if (empty($adminSession)) {
|
||||
return [];
|
||||
}
|
||||
$admin = Admin::where('id', '=', $adminSession->admin_id)
|
||||
->with('role')
|
||||
->find();
|
||||
|
||||
$adminInfo = [
|
||||
'admin_id' => $admin->id,
|
||||
'root' => $admin->root,
|
||||
'name' => $admin->name,
|
||||
'account' => $admin->account,
|
||||
'role_name' => $admin->role['name'] ?? '',
|
||||
'role_id' => $admin->role_id,
|
||||
'token' => $token,
|
||||
'terminal' => $adminSession->terminal,
|
||||
'expire_time' => $adminSession->expire_time,
|
||||
];
|
||||
$this->set($this->prefix . $token, $adminInfo, new \DateTime(Date('Y-m-d H:i:s', $adminSession->expire_time)));
|
||||
return $this->getAdminInfo($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除缓存
|
||||
* @param $token
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/3 16:57
|
||||
*/
|
||||
public function deleteAdminInfo($token)
|
||||
{
|
||||
return $this->delete($this->prefix . $token);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
73
server/app/common/cache/BaseCache.php
vendored
Executable file
73
server/app/common/cache/BaseCache.php
vendored
Executable file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
use think\App;
|
||||
use think\Cache;
|
||||
|
||||
/**
|
||||
* 缓存基础类,用于管理缓存
|
||||
* Class BaseCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
abstract class BaseCache extends Cache
|
||||
{
|
||||
/**
|
||||
* 缓存标签
|
||||
* @var string
|
||||
*/
|
||||
protected $tagName;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(app());
|
||||
$this->tagName = get_class($this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 重写父类set,自动打上标签
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param null $ttl
|
||||
* @return bool
|
||||
* @author 段誉
|
||||
* @date 2021/12/27 14:16
|
||||
*/
|
||||
public function set($key, $value, $ttl = null): bool
|
||||
{
|
||||
return $this->store()->tag($this->tagName)->set($key, $value, $ttl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 清除缓存类所有缓存
|
||||
* @return bool
|
||||
* @author 段誉
|
||||
* @date 2021/12/27 14:16
|
||||
*/
|
||||
public function deleteTag(): bool
|
||||
{
|
||||
return $this->tag($this->tagName)->clear();
|
||||
}
|
||||
|
||||
}
|
||||
85
server/app/common/cache/CoachUserAccountSafeCache.php
vendored
Executable file
85
server/app/common/cache/CoachUserAccountSafeCache.php
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
/**
|
||||
* //后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
* Class CoachUserAccountSafeCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class CoachUserAccountSafeCache extends BaseCache
|
||||
{
|
||||
|
||||
private $key;//缓存次数名称
|
||||
public $minute = 15;//缓存设置为15分钟,即密码错误次数达到,锁定15分钟
|
||||
public $count = 15; //设置连续输错次数,即15分钟内连续输错误15次后,锁定
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$ip = \request()->ip();
|
||||
$this->key = $this->tagName . $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 记录登录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:51
|
||||
*/
|
||||
public function record()
|
||||
{
|
||||
if ($this->get($this->key)) {
|
||||
//缓存存在,记录错误次数
|
||||
$this->inc($this->key, 1);
|
||||
} else {
|
||||
//缓存不存在,第一次设置缓存
|
||||
$this->set($this->key, 1, $this->minute * 60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 判断是否安全
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:53
|
||||
*/
|
||||
public function isSafe()
|
||||
{
|
||||
$count = $this->get($this->key);
|
||||
if ($count >= $this->count) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除该ip记录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:55
|
||||
*/
|
||||
public function relieve()
|
||||
{
|
||||
$this->delete($this->key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
108
server/app/common/cache/CoachUserTokenCache.php
vendored
Executable file
108
server/app/common/cache/CoachUserTokenCache.php
vendored
Executable file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
use app\common\enum\coach\CoachEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\coach\CoachUser;
|
||||
use app\common\model\coach\CoachUserSession;
|
||||
use app\common\model\coach\ShopUserSession;
|
||||
|
||||
class CoachUserTokenCache extends BaseCache
|
||||
{
|
||||
|
||||
private $prefix = 'token_coach_user_';
|
||||
|
||||
/**
|
||||
* @notes 通过token获取缓存用户信息
|
||||
* @param $token
|
||||
* @return false|mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 16:57
|
||||
*/
|
||||
public function getCoachUserInfo($token)
|
||||
{
|
||||
//直接从缓存获取
|
||||
$coachUserInfo = $this->get($this->prefix . $token);
|
||||
if ($coachUserInfo) {
|
||||
return $coachUserInfo;
|
||||
}
|
||||
//从数据获取信息被设置缓存(可能后台清除缓存)
|
||||
$coachUserInfo = $this->setCoachUserInfo($token);
|
||||
if ($coachUserInfo) {
|
||||
return $coachUserInfo;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 通过有效token设置用户信息缓存
|
||||
* @param $token
|
||||
* @return array|false|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/5 12:12
|
||||
*/
|
||||
public function setCoachUserInfo($token)
|
||||
{
|
||||
$coachUserSession = CoachUserSession::where([['token', '=', $token], ['expire_time', '>', time()]])->find();
|
||||
if (empty($coachUserSession)) {
|
||||
return [];
|
||||
}
|
||||
$coachUser = CoachUser::where('id', '=', $coachUserSession->coach_user_id)
|
||||
->find();
|
||||
$coachInfo = Coach::where(['coach_user_id'=>$coachUserSession->coach_user_id])
|
||||
->order('id desc')
|
||||
->field('id,audit_status')
|
||||
->findOrEmpty();
|
||||
$coachUserInfo = [
|
||||
'coach_user_id' => $coachUser->id,
|
||||
'coach_id'=> $coachInfo['id'],
|
||||
'token' => $token,
|
||||
'sn' => $coachUser->sn,
|
||||
'account' => $coachUser->account,
|
||||
'avatar' => $coachUser->avatar,
|
||||
'terminal' => $coachUserSession->terminal,
|
||||
'audit_status' => $coachInfo['audit_status'],
|
||||
'expire_time' => $coachUserSession->expire_time,
|
||||
];
|
||||
$this->set($this->prefix . $token, $coachUserInfo, new \DateTime(Date('Y-m-d H:i:s', $coachUserSession->expire_time)));
|
||||
return $this->getCoachUserInfo($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除缓存
|
||||
* @param $token
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/3 16:57
|
||||
*/
|
||||
public function deleteCoachUserInfo($token)
|
||||
{
|
||||
return $this->delete($this->prefix . $token);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
85
server/app/common/cache/ShopUserAccountSafeCache.php
vendored
Executable file
85
server/app/common/cache/ShopUserAccountSafeCache.php
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
/**
|
||||
* //后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
* Class ShopUserAccountSafeCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class ShopUserAccountSafeCache extends BaseCache
|
||||
{
|
||||
|
||||
private $key;//缓存次数名称
|
||||
public $minute = 15;//缓存设置为15分钟,即密码错误次数达到,锁定15分钟
|
||||
public $count = 15; //设置连续输错次数,即15分钟内连续输错误15次后,锁定
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$ip = \request()->ip();
|
||||
$this->key = $this->tagName . $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 记录登录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:51
|
||||
*/
|
||||
public function record()
|
||||
{
|
||||
if ($this->get($this->key)) {
|
||||
//缓存存在,记录错误次数
|
||||
$this->inc($this->key, 1);
|
||||
} else {
|
||||
//缓存不存在,第一次设置缓存
|
||||
$this->set($this->key, 1, $this->minute * 60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 判断是否安全
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:53
|
||||
*/
|
||||
public function isSafe()
|
||||
{
|
||||
$count = $this->get($this->key);
|
||||
if ($count >= $this->count) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除该ip记录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:55
|
||||
*/
|
||||
public function relieve()
|
||||
{
|
||||
$this->delete($this->key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
107
server/app/common/cache/ShopUserTokenCache.php
vendored
Executable file
107
server/app/common/cache/ShopUserTokenCache.php
vendored
Executable file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
use app\common\model\shop\ShopUser;
|
||||
use app\common\model\shop\ShopUserSession;
|
||||
use app\common\model\shop\Shop;
|
||||
|
||||
class ShopUserTokenCache extends BaseCache
|
||||
{
|
||||
|
||||
private $prefix = 'token_shop_user_';
|
||||
|
||||
/**
|
||||
* @notes 通过token获取缓存用户信息
|
||||
* @param $token
|
||||
* @return false|mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 16:57
|
||||
*/
|
||||
public function getShopUserInfo($token)
|
||||
{
|
||||
//直接从缓存获取
|
||||
$shopUserInfo = $this->get($this->prefix . $token);
|
||||
if ($shopUserInfo) {
|
||||
return $shopUserInfo;
|
||||
}
|
||||
|
||||
//从数据获取信息被设置缓存(可能后台清除缓存)
|
||||
$shophUserInfo = $this->setShopUserInfo($token);
|
||||
if ($shophUserInfo) {
|
||||
return $shophUserInfo;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 通过有效token设置用户信息缓存
|
||||
* @param $token
|
||||
* @return array|false|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/5 12:12
|
||||
*/
|
||||
public function setShopUserInfo($token)
|
||||
{
|
||||
$shopUserSession = ShopUserSession::where([['token', '=', $token], ['expire_time', '>', time()]])->find();
|
||||
if (empty($shopUserSession)) {
|
||||
return [];
|
||||
}
|
||||
$shopUser = ShopUser::where('id', '=', $shopUserSession->shop_user_id)
|
||||
->find();
|
||||
$shop = Shop::where(['shop_user_id'=>$shopUserSession->shop_user_id])
|
||||
->order('id desc')
|
||||
->field('id,audit_status')
|
||||
->findOrEmpty();
|
||||
$shopUserInfo = [
|
||||
'shop_user_id' => $shopUser->id,
|
||||
'shop_id'=> $shop['id'],
|
||||
'token' => $token,
|
||||
'sn' => $shopUser->sn,
|
||||
'account' => $shopUser->account,
|
||||
'audit_status' => $shop['audit_status'],
|
||||
'avatar' => $shopUser->avatar,
|
||||
'terminal' => $shopUserSession->terminal,
|
||||
'expire_time' => $shopUserSession->expire_time,
|
||||
];
|
||||
$this->set($this->prefix . $token, $shopUserInfo, new \DateTime(Date('Y-m-d H:i:s', $shopUserSession->expire_time)));
|
||||
return $this->getShopUserInfo($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除缓存
|
||||
* @param $token
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/3 16:57
|
||||
*/
|
||||
public function deleteShopUserInfo($token)
|
||||
{
|
||||
return $this->delete($this->prefix . $token);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
85
server/app/common/cache/UserAccountSafeCache.php
vendored
Executable file
85
server/app/common/cache/UserAccountSafeCache.php
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
/**
|
||||
* //后台账号安全机制,连续输错后锁定,防止账号密码暴力破解
|
||||
* Class AdminAccountSafeCache
|
||||
* @package app\common\cache
|
||||
*/
|
||||
class UserAccountSafeCache extends BaseCache
|
||||
{
|
||||
|
||||
private $key;//缓存次数名称
|
||||
public $minute = 15;//缓存设置为15分钟,即密码错误次数达到,锁定15分钟
|
||||
public $count = 15; //设置连续输错次数,即15分钟内连续输错误15次后,锁定
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$ip = \request()->ip();
|
||||
$this->key = $this->tagName . $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 记录登录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:51
|
||||
*/
|
||||
public function record()
|
||||
{
|
||||
if ($this->get($this->key)) {
|
||||
//缓存存在,记录错误次数
|
||||
$this->inc($this->key, 1);
|
||||
} else {
|
||||
//缓存不存在,第一次设置缓存
|
||||
$this->set($this->key, 1, $this->minute * 60);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 判断是否安全
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:53
|
||||
*/
|
||||
public function isSafe()
|
||||
{
|
||||
$count = $this->get($this->key);
|
||||
if ($count >= $this->count) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除该ip记录错误次数
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 01:55
|
||||
*/
|
||||
public function relieve()
|
||||
{
|
||||
$this->delete($this->key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
104
server/app/common/cache/UserTokenCache.php
vendored
Executable file
104
server/app/common/cache/UserTokenCache.php
vendored
Executable file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserSession;
|
||||
|
||||
class UserTokenCache extends BaseCache
|
||||
{
|
||||
|
||||
private $prefix = 'token_user_';
|
||||
|
||||
/**
|
||||
* @notes 通过token获取缓存用户信息
|
||||
* @param $token
|
||||
* @return false|mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/6/30 16:57
|
||||
*/
|
||||
public function getUserInfo($token)
|
||||
{
|
||||
//直接从缓存获取
|
||||
$userInfo = $this->get($this->prefix . $token);
|
||||
if ($userInfo) {
|
||||
return $userInfo;
|
||||
}
|
||||
|
||||
//从数据获取信息被设置缓存(可能后台清除缓存)
|
||||
$userInfo = $this->setUserInfo($token);
|
||||
if ($userInfo) {
|
||||
return $userInfo;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 通过有效token设置用户信息缓存
|
||||
* @param $token
|
||||
* @return array|false|mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/5 12:12
|
||||
*/
|
||||
public function setUserInfo($token)
|
||||
{
|
||||
$userSession = UserSession::where([['token', '=', $token], ['expire_time', '>', time()]])->find();
|
||||
|
||||
if (empty($userSession)) {
|
||||
return [];
|
||||
}
|
||||
$user = User::where('id', '=', $userSession->user_id)
|
||||
->find();
|
||||
|
||||
$userInfo = [
|
||||
'user_id' => $user->id,
|
||||
'nickname' => $user->nickname,
|
||||
'token' => $token,
|
||||
'sn' => $user->sn,
|
||||
'mobile' => $user->mobile,
|
||||
'avatar' => $user->avatar,
|
||||
'terminal' => $userSession->terminal,
|
||||
'expire_time' => $userSession->expire_time,
|
||||
];
|
||||
|
||||
$this->set($this->prefix . $token, $userInfo, new \DateTime(Date('Y-m-d H:i:s', $userSession->expire_time)));
|
||||
return $this->getUserInfo($token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 删除缓存
|
||||
* @param $token
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/3 16:57
|
||||
*/
|
||||
public function deleteUserInfo($token)
|
||||
{
|
||||
return $this->delete($this->prefix . $token);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
85
server/app/common/command/AppointOrderClose.php
Executable file
85
server/app/common/command/AppointOrderClose.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\OrderLogEnum;
|
||||
use app\common\enum\OrderRefundEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\logic\OrderLogLogic;
|
||||
use app\common\logic\RefundLogic;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\order\OrderLog;
|
||||
use app\common\service\ConfigService;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 关闭超过预约时间的订单
|
||||
* Class AppointOrderClose
|
||||
* @package app\common\command
|
||||
*/
|
||||
class AppointOrderClose extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('appoint_order_close')
|
||||
->setDescription('关闭超过预约时间的订单');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$time = time();
|
||||
|
||||
$orders = Order::where(['order_status' => OrderEnum::ORDER_STATUS_WAIT_RECEIVING,'pay_status' => PayEnum::ISPAID])
|
||||
->where('appoint_time','<',$time)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
if (empty($orders)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
try{
|
||||
foreach ($orders as $order) {
|
||||
//更新订单状态
|
||||
Order::update(['order_status' => OrderEnum::ORDER_STATUS_CLOSE,'cancel_time'=>time()], ['id' => $order['id']]);
|
||||
|
||||
//原路退款
|
||||
(new RefundLogic())->refund($order,$order['order_amount'],0,OrderRefundEnum::TYPE_SYSTEM,1,0);
|
||||
|
||||
//添加订单日志
|
||||
(new OrderLogLogic())->record(OrderLogEnum::TYPE_SYSTEM,OrderLogEnum::SYSTEM_CANCEL_APPOINT_ORDER,$order['id'],0);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch(\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write('关闭超过预约时间的订单失败,失败原因:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
92
server/app/common/command/Crontab.php
Executable file
92
server/app/common/command/Crontab.php
Executable file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
use app\common\enum\CrontabEnum;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use Cron\CronExpression;
|
||||
use think\facade\Console;
|
||||
|
||||
/**
|
||||
* 定时任务
|
||||
* Class Crontab
|
||||
* @package app\command
|
||||
*/
|
||||
class Crontab extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('crontab')
|
||||
->setDescription('定时任务');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$lists = \app\common\model\Crontab::where('status', CrontabEnum::START)->select()->toArray();
|
||||
if(empty($lists)) {
|
||||
return false;
|
||||
}
|
||||
foreach($lists as $item) {
|
||||
$nextTime = (new CronExpression($item['expression']))
|
||||
->getNextRunDate($item['last_time'])
|
||||
->getTimestamp();
|
||||
if($nextTime > time()) {
|
||||
// 未到时间,不执行
|
||||
continue;
|
||||
}
|
||||
// 开始执行
|
||||
self::start($item);
|
||||
}
|
||||
}
|
||||
|
||||
public static function start($item)
|
||||
{
|
||||
// 开始执行
|
||||
$startTime = microtime(true);
|
||||
$error = '';
|
||||
$status = CrontabEnum::START;
|
||||
try {
|
||||
$params = explode(' ', $item['params']);
|
||||
if (is_array($params) && !empty($item['params'])) {
|
||||
Console::call($item['command'], $params);
|
||||
} else {
|
||||
Console::call($item['command']);
|
||||
}
|
||||
// 清除错误信息
|
||||
// \app\common\model\Crontab::where('id', $item['id'])->update(['error' => '']);
|
||||
} catch(\Exception $e) {
|
||||
// 记录错误信息
|
||||
// \app\common\model\Crontab::where('id', $item['id'])->update(['error' => $e->getMessage(), 'status' => CrontabEnum::ERROR]);
|
||||
$error = $e->getMessage();
|
||||
$status = CrontabEnum::ERROR;
|
||||
} finally {
|
||||
$endTime = microtime(true);
|
||||
// 本次执行时间
|
||||
$useTime = round(($endTime - $startTime), 2);
|
||||
// 最大执行时间
|
||||
$maxTime = max($useTime, $item['max_time']);
|
||||
// 更新最后执行时间
|
||||
\app\common\model\Crontab::where('id', $item['id'])
|
||||
->update(['last_time' => time(), 'time' => $useTime, 'max_time' => $maxTime,'error' => $error, 'status' => $status]);
|
||||
}
|
||||
}
|
||||
}
|
||||
53
server/app/common/command/MapKeyReset.php
Executable file
53
server/app/common/command/MapKeyReset.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\MapKeyEnum;
|
||||
use app\common\model\MapKey;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
class MapKeyReset extends Command
|
||||
{
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('map_key_reset')
|
||||
->setDescription('重置地图异常key');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
Db::startTrans();
|
||||
try{
|
||||
MapKey::where(['status'=>MapKeyEnum::STATUS_ABNORMAL])->update(['status'=>MapKeyEnum::STATUS_WAIT,'error_info'=>'']);
|
||||
|
||||
Db::commit();
|
||||
} catch(\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write('重置地图异常key失败,失败原因:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
81
server/app/common/command/OrderAbnormalNotice.php
Executable file
81
server/app/common/command/OrderAbnormalNotice.php
Executable file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\service\ConfigService;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
class OrderAbnormalNotice extends Command
|
||||
{
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('order_abnormal_notice')
|
||||
->setDescription('订单异常通知');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
//当前时间
|
||||
$currentTime = time();
|
||||
$mobile = ConfigService::get('platform', 'mobile','');
|
||||
if(empty($mobile)){
|
||||
return true;
|
||||
}
|
||||
$orders = Order::where(['order_status'=>[OrderEnum::ORDER_STATUS_WAIT_RECEIVING, OrderEnum::ORDER_STATUS_SERVER_FINISH]])
|
||||
->whereRaw("appoint_time+86400 < $currentTime")
|
||||
->field('id')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
if (empty($orders)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Db::startTrans();
|
||||
try{
|
||||
|
||||
foreach ($orders as $order) {
|
||||
// 订单异常通知平台
|
||||
event('Notice', [
|
||||
'scene_id' => NoticeEnum::ORDER_ABNORMAL_NOTICE_PLATFORM,
|
||||
'params' => [
|
||||
'mobile' => $mobile,
|
||||
'order_id' => $order['id']
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
// Db::commit();
|
||||
} catch(\Exception $e) {
|
||||
// Db::rollback();
|
||||
Log::write('订单异常通知失败,失败原因:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
98
server/app/common/command/OrderClose.php
Executable file
98
server/app/common/command/OrderClose.php
Executable file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\OrderLogEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\logic\OrderLogLogic;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\order\OrderLog;
|
||||
use app\common\service\ConfigService;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 关闭超时待付款订单
|
||||
* Class OrderClose
|
||||
* @package app\common\command
|
||||
*/
|
||||
class OrderClose extends Command
|
||||
{
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('order_close')
|
||||
->setDescription('系统关闭超时未付款订单');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$now = time();
|
||||
$ableClose = ConfigService::get('transaction', 'cancel_unpaid_orders',1);
|
||||
$cancelTime = ConfigService::get('transaction', 'cancel_unpaid_orders_times',30) * 60;
|
||||
|
||||
if ($ableClose == YesNoEnum::NO) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$orders = Order::with('order_goods')
|
||||
->whereRaw("create_time+$cancelTime < $now")
|
||||
->where(['order_status'=>OrderEnum::ORDER_STATUS_WAIT_PAY,'pay_status'=>PayEnum::UNPAID])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
if (empty($orders)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
try{
|
||||
foreach ($orders as $order) {
|
||||
//更新订单状态
|
||||
Order::update(['order_status' => OrderEnum::ORDER_STATUS_CLOSE,'cancel_time'=>time()], ['id' => $order['id']]);
|
||||
|
||||
//添加订单日志
|
||||
(new OrderLogLogic())->record(OrderLogEnum::TYPE_SYSTEM,OrderLogEnum::SYSTEM_CANCEL_ORDER,$order['id'],0);
|
||||
|
||||
// 系统取消订单 - 通知买家
|
||||
// event('Notice', [
|
||||
// 'scene_id' => NoticeEnum::SYSTEM_CANCEL_ORDER_NOTICE,
|
||||
// 'params' => [
|
||||
// 'user_id' => $order['user_id'],
|
||||
// 'order_id' => $order['id']
|
||||
// ]
|
||||
// ]);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch(\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write('订单自动关闭失败,失败原因:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
84
server/app/common/command/OrderComment.php
Executable file
84
server/app/common/command/OrderComment.php
Executable file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\goods\GoodsComment;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\order\OrderGoods;
|
||||
use app\common\service\ConfigService;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
class OrderComment extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('order_comment')
|
||||
->setDescription('订单自动评论');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
|
||||
$overTimeComment = ConfigService::get('order_setting', 'over_time_comment') * 60 * 60 * 60;
|
||||
$now = time();
|
||||
$lists = Order::alias('O')
|
||||
->join('order_goods OG','O.id = OG.order_id')
|
||||
->whereRaw("true_server_finish_time+$overTimeComment < $now")
|
||||
->where(['order_status'=>OrderEnum::ORDER_STATUS_SERVER_FINISH,'is_comment'=>0])
|
||||
->where('true_server_finish_time','>',0)
|
||||
->field('O.user_id,O.shop_id,O.coach_id,OG.*')
|
||||
->select()
|
||||
->toArray();
|
||||
if (empty($lists)) {
|
||||
return true;
|
||||
}
|
||||
$overTimeCommentContent = ConfigService::get('order_setting', 'over_time_comment_content');
|
||||
foreach ($lists as $order) {
|
||||
Db::startTrans();
|
||||
try{
|
||||
GoodsComment::create([
|
||||
'goods_id' => $order['goods_id'],
|
||||
'user_id' => $order['user_id'],
|
||||
'order_goods_id' => $order['id'],
|
||||
'service_comment' => 5,
|
||||
'comment' => $overTimeCommentContent,
|
||||
'reply' => '',
|
||||
'coach_id' => $order['coach_id'],
|
||||
'shop_id' => $order['shop_id'],
|
||||
]);
|
||||
\app\common\logic\CoachLogic::updateCoachComment($order['coach_id']);
|
||||
if($order['shop_id']){
|
||||
\app\common\logic\ShopLogic::updateShopComment($order['shop_id']);
|
||||
}
|
||||
OrderGoods::where(['id'=>$order['id']])->update(['is_comment' => 1]);
|
||||
Db::commit();
|
||||
} catch(\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write('订单评论失败:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
180
server/app/common/command/OrderRefund.php
Executable file
180
server/app/common/command/OrderRefund.php
Executable file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\enum\OrderRefundEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\logic\AccountLogLogic;
|
||||
use app\common\model\order\OrderRefundLog;
|
||||
use app\common\model\user\User;
|
||||
use app\common\service\AliPayService;
|
||||
use app\common\service\WeChatConfigService;
|
||||
use app\common\service\WeChatPayService;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
class OrderRefund extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('order_refund')
|
||||
->setDescription('订单退款');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$lists = OrderRefundLog::alias('orl')
|
||||
->join('order_refund or', 'or.id = orl.refund_id')
|
||||
->join('order o', 'o.id = or.order_id')
|
||||
->field('or.order_terminal,or.transaction_id,orl.sn,or.order_amount,or.refund_amount + or.refund_car_amount as refund_amount,orl.refund_id,orl.id as refund_log_id,or.user_id,or.order_id,o.pay_way as refund_way,o.sn as order_sn')
|
||||
->where(['orl.refund_status'=>OrderRefundEnum::STATUS_ING])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
if (empty($lists)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach ($lists as $val) {
|
||||
Db::startTrans();
|
||||
try{
|
||||
switch ($val['refund_way']) {
|
||||
//微信退款
|
||||
case PayEnum::WECHAT_PAY:
|
||||
//微信配置信息
|
||||
$wechatConfig = WeChatConfigService::getWechatConfigByTerminal($val['order_terminal']);
|
||||
if (!file_exists($wechatConfig['cert_path']) || !file_exists($wechatConfig['key_path'])) {
|
||||
throw new \Exception('微信证书不存在,请联系管理员!');
|
||||
}
|
||||
|
||||
//发起退款
|
||||
$result = (new WeChatPayService($val['order_terminal']))->refund([
|
||||
'transaction_id' => $val['transaction_id'],
|
||||
'refund_sn' => $val['sn'],
|
||||
'total_fee' => $val['order_amount'] * 100,//订单金额,单位为分
|
||||
'refund_fee' => intval($val['refund_amount'] * 100),//退款金额
|
||||
]);
|
||||
|
||||
if (isset($result['return_code']) && $result['return_code'] == 'FAIL') {
|
||||
throw new \Exception($result['return_msg']);
|
||||
}
|
||||
|
||||
if (isset($result['err_code_des'])) {
|
||||
throw new \Exception($result['err_code_des']);
|
||||
}
|
||||
|
||||
//更新退款日志记录
|
||||
OrderRefundLog::update([
|
||||
'wechat_refund_id' => $result['refund_id'] ?? 0,
|
||||
'refund_status' => (isset($result['result_code']) && $result['result_code'] == 'SUCCESS') ? 1 : 2,
|
||||
'refund_msg' => json_encode($result, JSON_UNESCAPED_UNICODE),
|
||||
], ['id'=>$val['refund_log_id']]);
|
||||
|
||||
//更新订单退款状态
|
||||
\app\common\model\order\OrderRefund::update([
|
||||
'refund_status' => (isset($result['result_code']) && $result['result_code'] == 'SUCCESS') ? 1 : 2,
|
||||
], ['id'=>$val['refund_id']]);
|
||||
|
||||
if (isset($result['result_code']) && $result['result_code'] == 'SUCCESS') {
|
||||
// 订单退款成功 - 通知买家
|
||||
event('Notice', [
|
||||
'scene_id' => NoticeEnum::ORDER_REFUND_NOTICE,
|
||||
'params' => [
|
||||
'user_id' => $val['user_id'],
|
||||
'order_id' => $val['order_id'],
|
||||
'refund_amount' => $val['refund_amount']
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
break;
|
||||
//余额退款
|
||||
case PayEnum::BALANCE_PAY:
|
||||
//退回余额
|
||||
User::update(['user_money'=>['inc', $val['refund_amount']]],['id'=>$val['user_id']]);
|
||||
//流水记录
|
||||
AccountLogLogic::add($val['user_id'], AccountLogEnum::MONEY,AccountLogEnum::CANCEL_ORDER_ADD_MONEY,AccountLogEnum::INC, $val['refund_amount'], $val['order_sn']);
|
||||
|
||||
//更新订单退款状态
|
||||
\app\common\model\order\OrderRefund::update([
|
||||
'refund_status' => 1,
|
||||
], ['id'=>$val['refund_id']]);
|
||||
//更新退款日志记录
|
||||
OrderRefundLog::update([
|
||||
'refund_status' => 1,
|
||||
], ['id'=>$val['refund_log_id']]);
|
||||
|
||||
// 订单退款成功 - 通知买家
|
||||
event('Notice', [
|
||||
'scene_id' => NoticeEnum::ORDER_REFUND_NOTICE,
|
||||
'params' => [
|
||||
'user_id' => $val['user_id'],
|
||||
'order_id' => $val['order_id'],
|
||||
'refund_amount' => $val['refund_amount']
|
||||
]
|
||||
]);
|
||||
|
||||
break;
|
||||
//支付宝退款
|
||||
case PayEnum::ALI_PAY:
|
||||
//原路退回到支付宝的情况
|
||||
$result = (new AliPayService())->refund($val['order_sn'], $val['refund_amount'], $val['sn']);
|
||||
$result = (array)$result;
|
||||
|
||||
//更新退款日志记录
|
||||
OrderRefundLog::update([
|
||||
'refund_status' => ($result['code'] == '10000' && $result['msg'] == 'Success' && $result['fundChange'] == 'Y') ? 1 : 2,
|
||||
'refund_msg' => json_encode($result, JSON_UNESCAPED_UNICODE),
|
||||
], ['id'=>$val['refund_log_id']]);
|
||||
|
||||
//更新订单退款状态
|
||||
\app\common\model\order\OrderRefund::update([
|
||||
'refund_status' => ($result['code'] == '10000' && $result['msg'] == 'Success' && $result['fundChange'] == 'Y') ? 1 : 2,
|
||||
], ['id'=>$val['refund_id']]);
|
||||
|
||||
if ($result['code'] == '10000' && $result['msg'] == 'Success' && $result['fundChange'] == 'Y') {
|
||||
// 订单退款成功 - 通知买家
|
||||
event('Notice', [
|
||||
'scene_id' => NoticeEnum::ORDER_REFUND_NOTICE,
|
||||
'params' => [
|
||||
'user_id' => $val['user_id'],
|
||||
'order_id' => $val['order_id'],
|
||||
'refund_amount' => $val['refund_amount']
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch(\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write('订单退款失败,失败原因:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
125
server/app/common/command/OrderRefundQuery.php
Executable file
125
server/app/common/command/OrderRefundQuery.php
Executable file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\enum\OrderRefundEnum;
|
||||
use app\common\model\order\OrderRefundLog;
|
||||
use app\common\service\WeChatConfigService;
|
||||
use EasyWeChat\Factory;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
class OrderRefundQuery extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('order_refund_query')
|
||||
->setDescription('订单退款查询');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$lists = OrderRefundLog::alias('orl')
|
||||
->join('order_refund or', 'or.id = orl.refund_id')
|
||||
->field('orl.sn as refund_log_sn,orl.id as refund_log_id,or.id refund_id,or.order_terminal,or.user_id,or.order_id')
|
||||
->where(['orl.refund_status'=>OrderRefundEnum::STATUS_ING])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
if (empty($lists)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
try{
|
||||
foreach ($lists as $val) {
|
||||
|
||||
//微信配置信息
|
||||
$wechatConfig = WeChatConfigService::getWechatConfigByTerminal($val['order_terminal']);
|
||||
if (!file_exists($wechatConfig['cert_path']) || !file_exists($wechatConfig['key_path'])) {
|
||||
throw new \Exception('微信证书不存在,请联系管理员!');
|
||||
}
|
||||
|
||||
$app = Factory::payment($wechatConfig);
|
||||
//通过商户退款单号查询退款状态
|
||||
$result = $app->refund->queryByOutRefundNumber($val['refund_log_sn']);
|
||||
|
||||
if ($result['return_code'] == 'SUCCESS' && $result['result_code'] == 'SUCCESS') {
|
||||
$refund_status = OrderRefundEnum::STATUS_ING;
|
||||
|
||||
if ($result['refund_status_0'] == 'SUCCESS') {
|
||||
$refund_status = OrderRefundEnum::STATUS_SUCCESS;
|
||||
|
||||
//更新订单退款状态
|
||||
\app\common\model\order\OrderRefund::update([
|
||||
'refund_status' => OrderRefundEnum::STATUS_SUCCESS,
|
||||
], ['id'=>$val['refund_id']]);
|
||||
|
||||
if (isset($result['result_code']) && $result['result_code'] == 'SUCCESS') {
|
||||
// 订单退款成功 - 通知买家
|
||||
// event('Notice', [
|
||||
// 'scene_id' => NoticeEnum::REFUND_SUCCESS_NOTICE,
|
||||
// 'params' => [
|
||||
// 'user_id' => $val['user_id'],
|
||||
// 'order_id' => $val['order_id']
|
||||
// ]
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
if ($result['refund_status_0'] == 'REFUNDCLOSE') {
|
||||
$refund_status = OrderRefundEnum::STATUS_FAIL;
|
||||
|
||||
//更新订单退款状态
|
||||
\app\common\model\order\OrderRefund::update([
|
||||
'refund_status' => OrderRefundEnum::STATUS_FAIL,
|
||||
], ['id'=>$val['refund_id']]);
|
||||
}
|
||||
|
||||
//更新退款日志记录
|
||||
OrderRefundLog::update([
|
||||
'wechat_refund_id' => $result['refund_id_0'],
|
||||
'refund_status' => $refund_status,
|
||||
'refund_msg' => json_encode($result, JSON_UNESCAPED_UNICODE),
|
||||
], ['id'=>$val['refund_log_id']]);
|
||||
} else {
|
||||
if (isset($result['return_code']) && $result['return_code'] == 'FAIL') {
|
||||
throw new \Exception($result['return_msg']);
|
||||
}
|
||||
|
||||
if (isset($result['err_code_des'])) {
|
||||
throw new \Exception($result['err_code_des']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch(\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write('订单退款查询失败,失败原因:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
89
server/app/common/command/OrderVerification.php
Executable file
89
server/app/common/command/OrderVerification.php
Executable file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\OrderLogEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\logic\OrderLogLogic;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\service\ConfigService;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 系统自动核销服务中订单
|
||||
* Class OrderVerification
|
||||
* @package app\common\command
|
||||
*/
|
||||
class OrderVerification extends Command
|
||||
{
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('order_verification')
|
||||
->setDescription('系统自动核销服务中订单');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$now = time();
|
||||
$ableAuto = ConfigService::get('transaction', 'verification_orders',1);
|
||||
$confirmTime = ConfigService::get('transaction', 'verification_orders_times',24) * 60 * 60;
|
||||
|
||||
if ($ableAuto == YesNoEnum::NO) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$orders = Order::where([
|
||||
'order_status' => OrderEnum::ORDER_STATUS_SERVICE,
|
||||
'pay_status' => PayEnum::ISPAID
|
||||
])->whereRaw("create_time+$confirmTime < $now")->select();
|
||||
|
||||
if (empty($orders)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($orders as $order) {
|
||||
//更新订单状态
|
||||
Order::update([
|
||||
'order_status' => OrderEnum::ORDER_STATUS_FINISH,
|
||||
'verification_status' => OrderEnum::VERIFICATION,
|
||||
'finish_time' => time(),
|
||||
], ['id' => $order['id']]);
|
||||
|
||||
//添加订单日志
|
||||
(new OrderLogLogic())->record(OrderLogEnum::TYPE_SYSTEM,OrderLogEnum::SYSTEM_CONFIRM_ORDER,$order['id'],0);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write('订单自动核销失败,失败原因:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
62
server/app/common/command/Password.php
Executable file
62
server/app/common/command/Password.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
use app\common\model\auth\Admin;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\input\Argument;
|
||||
use think\console\Output;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 修改超级管理员密码
|
||||
*/
|
||||
class Password extends Command
|
||||
{
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('password')
|
||||
->addArgument('password', Argument::OPTIONAL, "please input new password")
|
||||
->setDescription('修改超级管理员密码');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$password = trim($input->getArgument('password'));
|
||||
if (empty($password)) {
|
||||
$output->error('请输入密码');
|
||||
return;
|
||||
}
|
||||
$passwordSalt = Config::get('project.unique_identification');
|
||||
$newPassword = create_password($password, $passwordSalt);
|
||||
$rootAdmin = Admin::where('root', 1)->findOrEmpty();
|
||||
if ($rootAdmin->isEmpty()) {
|
||||
$output->error('超级管理员不存在');
|
||||
return;
|
||||
}
|
||||
$rootAdmin->password = $newPassword;
|
||||
$rootAdmin->save();
|
||||
$output->info('超级管理修改密码成功!');
|
||||
$output->info('账号:' . $rootAdmin->account);
|
||||
$output->info('密码:' . $password);
|
||||
}
|
||||
}
|
||||
289
server/app/common/command/SettleOrder.php
Executable file
289
server/app/common/command/SettleOrder.php
Executable file
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\command;
|
||||
|
||||
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\enum\accountLog\ShopAccountLogEnum;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\OrderLogEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\logic\CoachAccountLogLogic;
|
||||
use app\common\logic\OrderLogLogic;
|
||||
use app\common\logic\ShopAccountLogLogic;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\settle\Settle;
|
||||
use app\common\model\shop\Shop;
|
||||
use app\common\service\ConfigService;
|
||||
use Exception;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 结算订单
|
||||
* Class SettleOrder
|
||||
* @package app\common\command
|
||||
*/
|
||||
class SettleOrder extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('settle_order')
|
||||
->setDescription('结算订单');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
try {
|
||||
$settleSettingConfig = [
|
||||
//结算方式(包含车费)
|
||||
'commission_settle' => ConfigService::get('settle_setting', 'commission_settle'),
|
||||
//结算周期
|
||||
'commission_settle_cycle' => ConfigService::get('settle_setting', 'commission_settle_cycle'),
|
||||
//结算类型
|
||||
'commission_settle_cycle_type' => ConfigService::get('settle_setting', 'commission_settle_cycle_type'),
|
||||
//结算天
|
||||
'commission_settle_cycle_day' => ConfigService::get('settle_setting', 'commission_settle_cycle_day'),
|
||||
];
|
||||
$whereRaw = '((order_status = '.OrderEnum::ORDER_STATUS_SERVER_FINISH.') or (order_status = '.OrderEnum::ORDER_STATUS_CLOSE.' and total_order_amount > total_refund_amount and pay_status = '.PayEnum::ISPAID.')) and is_settle = 0';
|
||||
$now = time();
|
||||
//结算周期:1-按状态;2-周期
|
||||
if(1 == $settleSettingConfig['commission_settle_cycle']){
|
||||
//订单结束后X天
|
||||
$overTime = $settleSettingConfig['commission_settle_cycle_day'] * 60 * 60 * 24;
|
||||
$whereRaw .= ' and true_server_finish_time + '.$overTime.' < '.$now;
|
||||
}else{
|
||||
//按周期:1-每周、2-每月
|
||||
if( 1== $settleSettingConfig['commission_settle_cycle_type']){
|
||||
$date = date('N');
|
||||
}else{
|
||||
$date = date('j');
|
||||
}
|
||||
if($date != $settleSettingConfig['commission_settle_cycle_day']){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$lists = Order::whereRaw($whereRaw)
|
||||
->append(['order_goods'])
|
||||
->select()
|
||||
->toArray();
|
||||
if(empty($lists)){
|
||||
return true;
|
||||
}
|
||||
$settleData = [
|
||||
'total_order_amount' => 0,
|
||||
'total_car_amount' => 0,
|
||||
'total_gap_amount' => 0,
|
||||
'total_append_amount' => 0,
|
||||
'total_commission' => 0,
|
||||
'total_car_commission' => 0,
|
||||
'total_car_coach_commission'=> 0,
|
||||
'total_car_shop_commission' => 0,
|
||||
'total_coach_commission' => 0,
|
||||
'total_shop_commission' => 0,
|
||||
'settle_num' => 0,
|
||||
'settle_config' => $settleSettingConfig,
|
||||
];
|
||||
$settleOrderData = [];
|
||||
|
||||
Db::startTrans();
|
||||
$settle = Settle::create($settleData);
|
||||
|
||||
foreach ($lists as $order){
|
||||
$goods = $order['order_goods'][0]->toArray();
|
||||
$commissionRatio = $goods['goods_snap']['commission_ratio'] ?? 0;
|
||||
$shopRatio = $goods['goods_snap']['shop_ratio'] ?? 0;
|
||||
$totalAmount = $order['total_order_amount'];
|
||||
$refundAmount = round($order['total_refund_amount'] - $order['refund_car_amount'],2);
|
||||
$totalAmount = round($totalAmount-$refundAmount-$order['car_amount'],2);
|
||||
$orderCarAmount = round($order['car_amount'] - $order['refund_car_amount'],2);
|
||||
$coachCarAmount = 0;
|
||||
$shopCarAmount = 0;
|
||||
$shopCommission = 0;
|
||||
$coachCommission = 0;
|
||||
//用于判断是否商家商品
|
||||
$goodsShopId = $goods['goods_snap']['shop_id'] ?? $order['shop_id'];
|
||||
if($goodsShopId){
|
||||
$shopRatio = round(100 - $commissionRatio,2);
|
||||
}
|
||||
//技师佣金
|
||||
if($totalAmount > 0 && $commissionRatio > 0){
|
||||
$coachCommission = round($totalAmount * ($commissionRatio / 100),2);
|
||||
}
|
||||
//商家佣金
|
||||
if($totalAmount > 0 && $shopRatio > 0 && $order['shop_id']){
|
||||
$shopCommission = round($totalAmount * ($shopRatio / 100),2);
|
||||
}
|
||||
//如果是包含车费
|
||||
if(1 == $settleSettingConfig['commission_settle']){
|
||||
if($orderCarAmount > 0){
|
||||
if($commissionRatio > 0){
|
||||
$coachCarAmount = round($orderCarAmount * ($commissionRatio / 100),2);
|
||||
}
|
||||
//商家车佣金
|
||||
if($shopRatio > 0 && $order['shop_id']){
|
||||
$shopCarAmount = round($orderCarAmount * ($shopRatio / 100),2);
|
||||
}
|
||||
}
|
||||
//
|
||||
}else{
|
||||
$coachCarAmount = $orderCarAmount;
|
||||
// $coachCommission = round($coachCommission+$coachCarAmount,2);
|
||||
}
|
||||
|
||||
if($coachCommission > 0){
|
||||
Coach::where(['id'=>$order['coach_id']])->update([
|
||||
'money'=> Db::raw('money+'.$coachCommission)
|
||||
]);
|
||||
CoachAccountLogLogic::add(
|
||||
$order['coach_id'],
|
||||
CoachAccountLogEnum::MONEY,
|
||||
CoachAccountLogEnum::ORDER_ADD_MONEY,
|
||||
1,
|
||||
$coachCommission,
|
||||
$order['sn']
|
||||
);
|
||||
|
||||
}
|
||||
//车费技师
|
||||
if($coachCarAmount > 0){
|
||||
Coach::where(['id'=>$order['coach_id']])->update([
|
||||
'money'=> Db::raw('money+'.$coachCarAmount)
|
||||
]);
|
||||
CoachAccountLogLogic::add(
|
||||
$order['coach_id'],
|
||||
CoachAccountLogEnum::MONEY,
|
||||
CoachAccountLogEnum::ORDER_ADD_CART_MONEY,
|
||||
1,
|
||||
$coachCarAmount,
|
||||
$order['sn']
|
||||
);
|
||||
|
||||
}
|
||||
if($shopCommission > 0){
|
||||
Shop::where(['id'=>$order['shop_id']])->update([
|
||||
'money'=> Db::raw('money+'.$shopCommission)
|
||||
]);
|
||||
ShopAccountLogLogic::add(
|
||||
$order['shop_id'],
|
||||
ShopAccountLogEnum::MONEY,
|
||||
ShopAccountLogEnum::ORDER_ADD_MONEY,
|
||||
1,
|
||||
$shopCommission,
|
||||
$order['sn']
|
||||
);
|
||||
}
|
||||
//结算商家车费
|
||||
if($shopCarAmount > 0){
|
||||
Shop::where(['id'=>$order['shop_id']])->update([
|
||||
'money'=> Db::raw('money+'.$shopCarAmount)
|
||||
]);
|
||||
ShopAccountLogLogic::add(
|
||||
$order['shop_id'],
|
||||
ShopAccountLogEnum::MONEY,
|
||||
ShopAccountLogEnum::ORDER_ADD_CART_MONEY,
|
||||
1,
|
||||
$shopCarAmount,
|
||||
$order['sn']
|
||||
);
|
||||
}
|
||||
|
||||
$coachCommission = round($coachCommission+$coachCarAmount,2);
|
||||
$shopCommission = round($shopCommission+$shopCarAmount,2);
|
||||
|
||||
$totalCommissionAmount = round($coachCommission+$shopCommission,2);
|
||||
$totalCarCommissionAmount = round($coachCarAmount+$shopCarAmount,2);
|
||||
//标记已结算
|
||||
Order::where(['id'=>$order['id']])->update([
|
||||
'is_settle' => 1,
|
||||
'settle_coach_amount' => $coachCommission,
|
||||
'settle_shop_amount' => $shopCommission,
|
||||
'settle_commission_amount' => $totalCommissionAmount,
|
||||
'settle_coach_car_amount' => $coachCarAmount,
|
||||
'settle_shop_car_amount' => $shopCarAmount,
|
||||
'settle_car_commission_amount' => $totalCarCommissionAmount,
|
||||
'settle_total_commission_amount' => round($totalCommissionAmount+$totalCarCommissionAmount,2),
|
||||
]);
|
||||
(new OrderLogLogic())
|
||||
->record(OrderLogEnum::TYPE_SYSTEM,OrderLogEnum::SYSTEM_SETTLEMENT_ORDER,$order['id']);
|
||||
//结算订单表
|
||||
$settleOrderData[] = [
|
||||
'order_id' => $order['id'],
|
||||
'settle_id' => $settle['id'],
|
||||
//订单总金额
|
||||
'total_order_amount'=> $order['total_order_amount'],
|
||||
'order_amount' => $totalAmount,
|
||||
//订单车费
|
||||
'car_amount' => $orderCarAmount,
|
||||
//技师车费佣金
|
||||
'coach_car_amount' => $coachCarAmount,
|
||||
//商家车费佣金
|
||||
'shop_car_amount' => $shopCarAmount,
|
||||
//总车费佣金
|
||||
'total_car_amount' => round($coachCarAmount+$shopCarAmount,2),
|
||||
'gap_amount' => $order['total_gap_amount'],
|
||||
'append_amount' => $order['total_append_amount'],
|
||||
//技师佣金
|
||||
'coach_commission' => $coachCommission,
|
||||
//商家佣金
|
||||
'shop_commission' => $shopCommission,
|
||||
//总佣金
|
||||
'total_commission' => $totalCommissionAmount,
|
||||
//技师佣金比例和商家佣金比例
|
||||
'commission_ratio' => $goods['goods_snap']['commission_ratio'] ?? 0,
|
||||
'shop_ratio' => $goods['goods_snap']['shop_ratio'] ?? 0,
|
||||
];
|
||||
//结算表
|
||||
$settleData['total_car_amount'] += $order['car_amount'];
|
||||
$settleData['total_gap_amount'] += $order['total_gap_amount'];
|
||||
$settleData['total_append_amount'] += $order['total_append_amount'];
|
||||
$settleData['total_order_amount'] += $order['total_order_amount'];
|
||||
//总技师和商家佣金,总佣金
|
||||
$settleData['total_coach_commission'] += $coachCommission;
|
||||
$settleData['total_shop_commission'] += $shopCommission;
|
||||
$settleData['total_commission'] += $totalCommissionAmount;
|
||||
//总技师和商家车费佣金,总佣金
|
||||
$settleData['total_car_coach_commission'] += $coachCarAmount;
|
||||
$settleData['total_car_shop_commission'] += $shopCarAmount;
|
||||
$settleData['total_car_commission'] += $totalCarCommissionAmount;
|
||||
|
||||
$settleData['settle_num']++;
|
||||
}
|
||||
Settle::where(['id'=>$settle->id])->update($settleData);
|
||||
(new \app\common\model\settle\SettleOrder())->saveAll($settleOrderData);
|
||||
Db::commit();
|
||||
}catch (Exception $e){
|
||||
Db::rollback();
|
||||
Log::write('结算订单计划任务执行失败:'.implode('-', [
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
$e->getFile(),
|
||||
$e->getLine(),
|
||||
$e->getMessage()
|
||||
]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
126
server/app/common/controller/BaseLikeAdminController.php
Executable file
126
server/app/common/controller/BaseLikeAdminController.php
Executable file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
use app\BaseController;
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\service\JsonService;
|
||||
use think\facade\App;
|
||||
|
||||
/**
|
||||
* 控制器基类
|
||||
* Class BaseLikeAdminController
|
||||
* @package app\common\controller
|
||||
*/
|
||||
class BaseLikeAdminController extends BaseController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = [];
|
||||
|
||||
/**
|
||||
* @notes 操作成功
|
||||
* @param string $msg
|
||||
* @param array $data
|
||||
* @param int $code
|
||||
* @param int $show
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/27 14:21
|
||||
*/
|
||||
protected function success(string $msg = 'success', array $data = [], int $code = 1, int $show = 0)
|
||||
{
|
||||
return JsonService::success($msg, $data, $code, $show);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 数据返回
|
||||
* @param $data
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/27 14:21\
|
||||
*/
|
||||
protected function data($data)
|
||||
{
|
||||
return JsonService::data($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 列表数据返回
|
||||
* @param \app\common\lists\BaseDataLists|null $lists
|
||||
* @return \think\response\Json
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/8 00:40
|
||||
*/
|
||||
protected function dataLists(BaseDataLists $lists = null)
|
||||
{
|
||||
//列表类和控制器一一对应,"app/应用/controller/控制器的方法" =》"app\应用\lists\"目录下
|
||||
//(例如:"app/adminapi/controller/auth/AdminController.php的lists()方法" =》 "app/adminapi/lists/auth/AminLists.php")
|
||||
//当对象为空时,自动创建列表对象
|
||||
if (is_null($lists)) {
|
||||
$listName = str_replace('.', '\\', App::getNamespace() . '\\lists\\' . $this->request->controller() . ucwords($this->request->action()));
|
||||
$lists = invoke($listName);
|
||||
}
|
||||
return JsonService::dataLists($lists);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 操作失败
|
||||
* @param string $msg
|
||||
* @param array $data
|
||||
* @param int $code
|
||||
* @param int $show
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/27 14:21
|
||||
*/
|
||||
protected function fail(string $msg = 'fail', array $data = [], int $code = 0, int $show = 1)
|
||||
{
|
||||
return JsonService::fail($msg, $data, $code, $show);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 是否免登录验证
|
||||
* @return bool
|
||||
* @author 段誉
|
||||
* @date 2021/12/27 14:21
|
||||
*/
|
||||
public function isNotNeedLogin() : bool
|
||||
{
|
||||
$notNeedLogin = $this->notNeedLogin;
|
||||
if (empty($notNeedLogin)) {
|
||||
return false;
|
||||
}
|
||||
$action = $this->request->action();
|
||||
|
||||
if (!in_array(trim($action), $notNeedLogin)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
119
server/app/common/controller/BaseLikeShopController.php
Executable file
119
server/app/common/controller/BaseLikeShopController.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
|
||||
use app\BaseController;
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\service\JsonService;
|
||||
use think\facade\App;
|
||||
|
||||
class BaseLikeShopController extends BaseController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = [];
|
||||
|
||||
/**
|
||||
* @notes 操作成功
|
||||
* @param string $msg
|
||||
* @param array $data
|
||||
* @param int $code
|
||||
* @param int $show
|
||||
* @return \think\response\Json
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/8 00:39
|
||||
*/
|
||||
protected function success(string $msg = 'success', array $data = [], int $code = 1, int $show = 0)
|
||||
{
|
||||
return JsonService::success($msg, $data, $code, $show);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 数据返回
|
||||
* @param $data
|
||||
* @return \think\response\Json
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/8 11:13
|
||||
*/
|
||||
protected function data($data)
|
||||
{
|
||||
return JsonService::data($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 列表数据返回
|
||||
* @param \app\common\lists\BaseDataLists|null $lists
|
||||
* @return \think\response\Json
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/8 00:40
|
||||
*/
|
||||
protected function dataLists(BaseDataLists $lists = null)
|
||||
{
|
||||
//列表类和控制器一一对应,"app/应用/controller/控制器的方法" =》"app\应用\lists\"目录下
|
||||
//(例如:"app/adminapi/controller/auth/AdminController.php的lists()方法" =》 "app/adminapi/lists/auth/AminLists.php")
|
||||
//当对象为空时,自动创建列表对象
|
||||
if (is_null($lists)) {
|
||||
$listName = str_replace('.', '\\', App::getNamespace() . '\\lists\\' . $this->request->controller() . ucwords($this->request->action()));
|
||||
$lists = invoke($listName);
|
||||
}
|
||||
return JsonService::dataLists($lists);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 操作失败
|
||||
* @param string $msg
|
||||
* @param array $data
|
||||
* @param int $code
|
||||
* @param int $show
|
||||
* @return \think\response\Json
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/8 00:39
|
||||
*/
|
||||
protected function fail(string $msg = 'fail', array $data = [], int $code = 0, int $show = 1)
|
||||
{
|
||||
return JsonService::fail($msg, $data, $code, $show);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 是否免登录验证
|
||||
* @return bool
|
||||
* @author 令狐冲
|
||||
* @date 2021/8/3 14:36
|
||||
*/
|
||||
public function isNotNeedLogin()
|
||||
{
|
||||
|
||||
$notNeedLogin = $this->notNeedLogin;
|
||||
if (empty($notNeedLogin)) {
|
||||
return false;
|
||||
}
|
||||
$action = $this->request->action();
|
||||
|
||||
if (!in_array(trim($action), $notNeedLogin)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
49
server/app/common/enum/AdEnum.php
Executable file
49
server/app/common/enum/AdEnum.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class AdEnum
|
||||
{
|
||||
//链接类型
|
||||
const LINK_SHOP = 1;//商城页面
|
||||
const LINK_GOODS = 2;//商品页面
|
||||
const LINK_CUSTOM = 3;//自定义链接
|
||||
|
||||
/**
|
||||
* @notes 链接类型
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 6:08 下午
|
||||
*/
|
||||
public static function getLinkDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::LINK_SHOP => '商城页面',
|
||||
self::LINK_GOODS => '商品分类',
|
||||
self::LINK_CUSTOM => '自定义链接'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
}
|
||||
33
server/app/common/enum/AdminTerminalEnum.php
Executable file
33
server/app/common/enum/AdminTerminalEnum.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
/**
|
||||
* 管理后台登录终端
|
||||
* Class terminalEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class AdminTerminalEnum
|
||||
{
|
||||
const PC = 1;
|
||||
const MOBILE = 2;
|
||||
}
|
||||
41
server/app/common/enum/CrontabEnum.php
Executable file
41
server/app/common/enum/CrontabEnum.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
/**
|
||||
* 定时任务枚举
|
||||
* Class CrontabEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class CrontabEnum
|
||||
{
|
||||
/**
|
||||
* 类型
|
||||
* CRONTAB 定时任务
|
||||
*/
|
||||
const CRONTAB = 1;
|
||||
|
||||
/**
|
||||
* 定时任务状态
|
||||
*/
|
||||
const START = 1;
|
||||
const STOP = 2;
|
||||
const ERROR = 3;
|
||||
}
|
||||
184
server/app/common/enum/DefaultEnum.php
Executable file
184
server/app/common/enum/DefaultEnum.php
Executable file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class DefaultEnum
|
||||
{
|
||||
//默认排序
|
||||
const SORT = 0;
|
||||
|
||||
//显示隐藏
|
||||
const HIDE = 0;//隐藏
|
||||
const SHOW = 1;//显示
|
||||
|
||||
//性别
|
||||
const UNKNOWN = 0;//未知
|
||||
const MAN = 1;//男
|
||||
const WOMAN = 2;//女
|
||||
|
||||
//属性
|
||||
const SYSTEM = 1;//系统默认
|
||||
const CUSTOM = 2;//自定义
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取显示状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/8 3:56 下午
|
||||
*/
|
||||
public static function getShowDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::HIDE => '隐藏',
|
||||
self::SHOW => '显示'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 启用状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 4:02 下午
|
||||
*/
|
||||
public static function getEnableDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::HIDE => '停用',
|
||||
self::SHOW => '启用'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 性别
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/10 11:40 上午
|
||||
*/
|
||||
public static function getSexDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::UNKNOWN => '未知',
|
||||
self::MAN => '男',
|
||||
self::WOMAN => '女'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 属性
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 4:41 下午
|
||||
*/
|
||||
public static function getAttrDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::SYSTEM => '系统默认',
|
||||
self::CUSTOM => '自定义'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 是否推荐
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/23 3:30 下午
|
||||
*/
|
||||
public static function getRecommendDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::HIDE => '不推荐',
|
||||
self::SHOW => '推荐'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 56个民族
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/15 16:46
|
||||
*/
|
||||
public static function getNationLists($from = true)
|
||||
{
|
||||
$data = [
|
||||
"汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族", "壮族",
|
||||
"布依族", "朝鲜族", "满族", "侗族", "瑶族", "白族", "土家族", "哈尼族",
|
||||
"哈萨克族", "傣族", "黎族", "僳僳族", "佤族", "畲族", "高山族", "拉祜族",
|
||||
"水族", "东乡族", "纳西族", "景颇族", "柯尔克孜族", "土族", "达斡尔族",
|
||||
"仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族",
|
||||
"普米族", "塔吉克族", "怒族", "乌孜别克族", "俄罗斯族", "鄂温克族", "德昂族",
|
||||
"保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族",
|
||||
"门巴族", "珞巴族", "基诺族"
|
||||
];
|
||||
if(true === $from){
|
||||
return $data;
|
||||
}
|
||||
return $data[$from] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取学历列表
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/15 16:52
|
||||
*/
|
||||
public static function getEducationLists($from = true)
|
||||
{
|
||||
$data = [
|
||||
"小学文化", "初中","高中","大专",
|
||||
"本科","硕士","博士"
|
||||
];
|
||||
if(true === $from){
|
||||
return $data;
|
||||
}
|
||||
return $data[$from] ?? '';
|
||||
|
||||
}
|
||||
}
|
||||
33
server/app/common/enum/FileEnum.php
Executable file
33
server/app/common/enum/FileEnum.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class FileEnum
|
||||
{
|
||||
// 图片类型
|
||||
const IMAGE_TYPE = 10; // 图片类型
|
||||
const VIDEO_TYPE = 20; // 视频类型
|
||||
const FILE_TYPE = 30; // 文件类型
|
||||
|
||||
|
||||
// 图片来源
|
||||
const SOURCE_ADMIN = 0; // 后台
|
||||
const SOURCE_USER = 1; // 用户
|
||||
const SOURCE_COACH = 2; // 技师
|
||||
|
||||
const SOURCE_SHOP = 3 ; //店铺
|
||||
|
||||
}
|
||||
48
server/app/common/enum/GeneratorEnum.php
Executable file
48
server/app/common/enum/GeneratorEnum.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class GeneratorEnum
|
||||
{
|
||||
|
||||
// 模板类型
|
||||
const TEMPLATE_TYPE_SINGLE = 0;// 单表
|
||||
const TEMPLATE_TYPE_TREE = 1; // 树表
|
||||
|
||||
// 生成方式
|
||||
const GENERATE_TYPE_ZIP = 0; // 压缩包下载
|
||||
const GENERATE_TYPE_MODULE = 1; // 生成到模块
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取模板类型描述
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/6/14 11:24
|
||||
*/
|
||||
public static function getTemplateTypeDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::TEMPLATE_TYPE_SINGLE => '单表(增删改查)',
|
||||
self::TEMPLATE_TYPE_TREE => '树表(增删改查)',
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value] ?? '';
|
||||
}
|
||||
}
|
||||
48
server/app/common/enum/GoodsCommentEnum.php
Executable file
48
server/app/common/enum/GoodsCommentEnum.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class GoodsCommentEnum
|
||||
{
|
||||
//回复状态
|
||||
const WAIT = 0;//待回复
|
||||
const FINISH = 1;//已回复
|
||||
|
||||
|
||||
/**
|
||||
* @notes 状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/9 11:21 上午
|
||||
*/
|
||||
public static function getStatusDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::WAIT => '待回复',
|
||||
self::FINISH => '已回复'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
}
|
||||
73
server/app/common/enum/GoodsEnum.php
Executable file
73
server/app/common/enum/GoodsEnum.php
Executable file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class GoodsEnum
|
||||
{
|
||||
//状态
|
||||
const UNSHELVE = 0;//仓库中
|
||||
const SHELVE = 1;//销售中
|
||||
|
||||
const AUDIT_STATUS_WAIT = 0;
|
||||
const AUDIT_STATUS_PASS = 1;
|
||||
const AUDIT_STATUS_REFUSE = 2;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/9 11:21 上午
|
||||
*/
|
||||
public static function getShowDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::UNSHELVE => '仓库中',
|
||||
self::SHELVE => '销售中'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 审核状态列表
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/23 16:14
|
||||
*/
|
||||
public static function getAuditStatusDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::AUDIT_STATUS_WAIT => '待审核',
|
||||
self::AUDIT_STATUS_PASS => '审核通过',
|
||||
self::AUDIT_STATUS_REFUSE => '审核拒绝'
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
32
server/app/common/enum/LoginEnum.php
Executable file
32
server/app/common/enum/LoginEnum.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\enum;
|
||||
|
||||
/**
|
||||
* 登录枚举
|
||||
* Class LoginEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class LoginEnum
|
||||
{
|
||||
/**
|
||||
* 支持的登录方式
|
||||
* ACCOUNT_PASSWORD 账号/手机号密码登录
|
||||
* MOBILE_CAPTCHA 手机验证码登录
|
||||
* THIRD_LOGIN 第三方登录
|
||||
*/
|
||||
const ACCOUNT_PASSWORD = 1;
|
||||
const MOBILE_CAPTCHA = 2;
|
||||
const THIRD_LOGIN = 3;
|
||||
}
|
||||
51
server/app/common/enum/MapKeyEnum.php
Executable file
51
server/app/common/enum/MapKeyEnum.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class MapKeyEnum
|
||||
{
|
||||
//状态
|
||||
const STATUS_WAIT = 0;//未使用
|
||||
const STATUS_USE = 1;//使用中
|
||||
const STATUS_ABNORMAL = 2;//异常
|
||||
|
||||
//类型
|
||||
const TYPE_TENCENT = 1;//腾讯
|
||||
|
||||
/**
|
||||
* @notes 类型
|
||||
* @param $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2024/11/5 下午2:33
|
||||
*/
|
||||
public static function getTypeDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::TYPE_TENCENT => '腾讯地图'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value] ?? '';
|
||||
}
|
||||
}
|
||||
106
server/app/common/enum/MenuEnum.php
Executable file
106
server/app/common/enum/MenuEnum.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class MenuEnum
|
||||
{
|
||||
//商城页面
|
||||
const SHOP_PAGE = [
|
||||
[
|
||||
'is_tab' => 1,
|
||||
'index' => 1,
|
||||
'name' => '商城首页',
|
||||
'path' => '/pages/index/index',
|
||||
'params' => [],
|
||||
'type' => 'shop',
|
||||
],
|
||||
[
|
||||
'is_tab' => 0,
|
||||
'index' => 2,
|
||||
'name' => '找师傅',
|
||||
'path' => '/bundle/pages/master_worker_list/index',
|
||||
'params' => [],
|
||||
'type' => 'shop',
|
||||
],
|
||||
[
|
||||
'is_tab' => 1,
|
||||
'index' => 3,
|
||||
'name' => '预约订单',
|
||||
'path' => '/pages/order/index',
|
||||
'params' => [],
|
||||
'type' => 'shop',
|
||||
],
|
||||
[
|
||||
'is_tab' => 0,
|
||||
'index' => 4,
|
||||
'name' => '地址管理',
|
||||
'path' => '/bundle/pages/user_address/index',
|
||||
'params' => [],
|
||||
'type' => 'shop',
|
||||
],
|
||||
[
|
||||
'is_tab' => 0,
|
||||
'index' => 5,
|
||||
'name' => '个人资料',
|
||||
'path' => '/bundle/pages/user_profile/index',
|
||||
'params' => [],
|
||||
'type' => 'shop',
|
||||
],
|
||||
[
|
||||
'is_tab' => 0,
|
||||
'index' => 6,
|
||||
'name' => '联系客服',
|
||||
'path' => '/bundle/pages/contact_service/index',
|
||||
'params' => [],
|
||||
'type' => 'shop',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
//菜单类型
|
||||
const NAVIGATION_HOME = 1;//首页导航
|
||||
const NAVIGATION_PERSONAL = 2;//个人中心
|
||||
|
||||
//链接类型
|
||||
const LINK_SHOP = 1;//商城页面
|
||||
const LINK_CATEGORY = 2;//分类页面
|
||||
const LINK_CUSTOM = 3;//自定义链接
|
||||
|
||||
/**
|
||||
* @notes 链接类型
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 12:14 下午
|
||||
*/
|
||||
public static function getLinkDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::LINK_SHOP => '商城页面',
|
||||
self::LINK_CATEGORY => '分类页面',
|
||||
self::LINK_CUSTOM => '自定义链接'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
}
|
||||
99
server/app/common/enum/OfficialAccountEnum.php
Executable file
99
server/app/common/enum/OfficialAccountEnum.php
Executable file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\enum;
|
||||
|
||||
/**
|
||||
* 微信公众号枚举
|
||||
* Class OfficialAccountEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class OfficialAccountEnum
|
||||
{
|
||||
/**
|
||||
* 菜单类型
|
||||
* click - 关键字
|
||||
* view - 跳转网页链接
|
||||
* miniprogram - 小程序
|
||||
*/
|
||||
const MENU_TYPE = ['click', 'view', 'miniprogram'];
|
||||
|
||||
/**
|
||||
* 关注回复
|
||||
*/
|
||||
const REPLY_TYPE_FOLLOW = 1;
|
||||
|
||||
/**
|
||||
* 关键字回复
|
||||
*/
|
||||
const REPLY_TYPE_KEYWORD = 2;
|
||||
|
||||
/**
|
||||
* 默认回复
|
||||
*/
|
||||
const REPLY_TYPE_DEFAULT= 3;
|
||||
|
||||
/**
|
||||
* 回复类型
|
||||
* follow - 关注回复
|
||||
* keyword - 关键字回复
|
||||
* default - 默认回复
|
||||
*/
|
||||
const REPLY_TYPE = [
|
||||
self::REPLY_TYPE_FOLLOW => 'follow',
|
||||
self::REPLY_TYPE_KEYWORD => 'keyword',
|
||||
self::REPLY_TYPE_DEFAULT => 'default'
|
||||
];
|
||||
|
||||
/**
|
||||
* 匹配类型 - 全匹配
|
||||
*/
|
||||
const MATCHING_TYPE_FULL = 1;
|
||||
|
||||
/**
|
||||
* 匹配类型 - 模糊匹配
|
||||
*/
|
||||
const MATCHING_TYPE_FUZZY = 2;
|
||||
|
||||
/**
|
||||
* 消息类型 - 事件
|
||||
*/
|
||||
const MSG_TYPE_EVENT = 'event';
|
||||
|
||||
/**
|
||||
* 消息类型 - 文本
|
||||
*/
|
||||
const MSG_TYPE_TEXT = 'text';
|
||||
|
||||
/**
|
||||
* 事件类型 - 关注
|
||||
*/
|
||||
const EVENT_SUBSCRIBE = 'subscribe';
|
||||
|
||||
/**
|
||||
* @notes 获取类型英文名称
|
||||
* @param $type
|
||||
* @return string
|
||||
* @author Tab
|
||||
* @date 2021/7/29 16:32
|
||||
*/
|
||||
public static function getReplyType($type)
|
||||
{
|
||||
return self::REPLY_TYPE[$type] ?? '';
|
||||
}
|
||||
}
|
||||
132
server/app/common/enum/OrderEnum.php
Executable file
132
server/app/common/enum/OrderEnum.php
Executable file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class OrderEnum
|
||||
{
|
||||
//订单状态
|
||||
const ORDER_STATUS_WAIT_PAY = 0; //待支付
|
||||
const ORDER_STATUS_WAIT_RECEIVING = 1; //待接单
|
||||
const ORDER_STATUS_WAIT_DEPART = 2; //待出发
|
||||
const ORDER_STATUS_DEPART = 3; //已出发
|
||||
|
||||
const ORDER_STATUS_ARRIVE = 4; //已到达
|
||||
const ORDER_STATUS_START_SERVER = 5; //服务开始
|
||||
|
||||
const ORDER_STATUS_SERVER_FINISH = 6; //服务完成
|
||||
|
||||
const ORDER_STATUS_CLOSE = 7; //服务关闭
|
||||
|
||||
|
||||
const TRIP_WAY_TAXI = 1;
|
||||
const TRIP_WAY_BUS = 2;
|
||||
|
||||
//核销状态
|
||||
const WAIT_VERIFICATION = 0;//待核销
|
||||
const VERIFICATION = 1;//已核销
|
||||
|
||||
//派单状态
|
||||
const DISPATCH_NO = 0;//未派单
|
||||
const DISPATCH_YES = 1;//已派单
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取出行方式
|
||||
* @param $value
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/9/7 17:10
|
||||
*/
|
||||
public static function getTripWayDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::TRIP_WAY_TAXI => '滴滴/出租车',
|
||||
self::TRIP_WAY_BUS => '公交车/地铁',
|
||||
];
|
||||
if (true === $value) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 订单状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/11 11:03 上午
|
||||
*/
|
||||
public static function getOrderStatusDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::ORDER_STATUS_WAIT_PAY => '待支付',
|
||||
self::ORDER_STATUS_WAIT_RECEIVING => '待接单',
|
||||
self::ORDER_STATUS_WAIT_DEPART => '待出发',
|
||||
self::ORDER_STATUS_DEPART => '已出发',
|
||||
self::ORDER_STATUS_ARRIVE => '已到达',
|
||||
self::ORDER_STATUS_START_SERVER => '服务开始',
|
||||
self::ORDER_STATUS_SERVER_FINISH => '服务完成',
|
||||
self::ORDER_STATUS_CLOSE => '已关闭',
|
||||
];
|
||||
if (true === $value) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 核销状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2021/8/26 4:29 下午
|
||||
*/
|
||||
public static function getVerificationStatusDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::WAIT_VERIFICATION => '待核销',
|
||||
self::VERIFICATION => '已核销',
|
||||
];
|
||||
if (true === $value) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 派单状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/8/29 4:56 下午
|
||||
*/
|
||||
public static function getDispatchDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::DISPATCH_NO => '未派单',
|
||||
self::DISPATCH_YES => '已派单',
|
||||
];
|
||||
if (true === $value) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
}
|
||||
166
server/app/common/enum/OrderLogEnum.php
Executable file
166
server/app/common/enum/OrderLogEnum.php
Executable file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class OrderLogEnum
|
||||
{
|
||||
//操作人类型
|
||||
const TYPE_SYSTEM = 1;//系统
|
||||
const TYPE_ADMIN = 2;//后台
|
||||
const TYPE_USER = 3;//用户
|
||||
|
||||
|
||||
const TYPE_COACH = 4;//技师
|
||||
|
||||
const TYPE_SHOP = 5;//门店
|
||||
|
||||
|
||||
const SYSTEM_CANCEL_ORDER = 101;//系统取消订单
|
||||
|
||||
const SYSTEM_CANCEL_APPOINT_ORDER = 102;//系统取消超过预约时间订单
|
||||
const SYSTEM_SETTLEMENT_ORDER = 103;//系统结算订单
|
||||
|
||||
|
||||
|
||||
const ADMIN_CHANGE_COACH = 201;//管理员更换技师
|
||||
|
||||
const ADMIN_REFUND_ORDER = 202;//管理员退款
|
||||
//订单动作
|
||||
const USER_ADD_ORDER = 301;//提交订单
|
||||
const USER_CANCEL_ORDER = 302;//取消订单
|
||||
const USER_PAY_ORDER = 303;//支付订单
|
||||
|
||||
const USER_PAY_ORDER_GAP = 304;//支付订单差价
|
||||
const USER_PAY_ORDER_APPEND = 305;//支付加钟
|
||||
|
||||
|
||||
const COACH_TAKE_ORDER = 411;//技师接单
|
||||
const COACH_DEPART = 412;//技师出发
|
||||
|
||||
const COACH_ARRIVE = 413;//技师达到
|
||||
|
||||
const COACH_START_SERVER = 414;//服务开始
|
||||
|
||||
const COACH_SERVER_FINISH = 415;//服务完成
|
||||
//
|
||||
const SHOP_CHANGE_COACH = 201;//商家更换技师
|
||||
//服务打卡
|
||||
const COACH_ARRIVE_LOG = 601;
|
||||
const COACH_SERVER_FINISH_LOG = 602;
|
||||
|
||||
/**
|
||||
* @notes 操作人
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/11 2:17 下午
|
||||
*/
|
||||
public static function getOperatorDesc($value = true)
|
||||
{
|
||||
$desc = [
|
||||
self::TYPE_SYSTEM => '系统',
|
||||
self::TYPE_ADMIN => '后台',
|
||||
self::TYPE_USER => '用户',
|
||||
self::TYPE_COACH => '技师',
|
||||
self::TYPE_SHOP => '商家',
|
||||
];
|
||||
|
||||
if (true === $value) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 订单日志
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/11 2:17 下午
|
||||
*/
|
||||
public static function getRecordDesc($value = true)
|
||||
{
|
||||
$desc = [
|
||||
//系统
|
||||
self::SYSTEM_CANCEL_ORDER => '系统取消订单',
|
||||
self::SYSTEM_CANCEL_APPOINT_ORDER => '系统取消超过预约时间订单',
|
||||
self::SYSTEM_SETTLEMENT_ORDER => '系统结算订单',
|
||||
//后台
|
||||
self::ADMIN_CHANGE_COACH => '后台更换技师',
|
||||
self::ADMIN_REFUND_ORDER => '管理员退款',
|
||||
//用户
|
||||
self::USER_ADD_ORDER => '用户提交订单',
|
||||
self::USER_CANCEL_ORDER => '用户取消订单',
|
||||
self::USER_PAY_ORDER => '用户支付订单',
|
||||
self::USER_PAY_ORDER_GAP => '用户支付差价',
|
||||
self::USER_PAY_ORDER_APPEND => '用户支付加钟',
|
||||
//技师
|
||||
self::COACH_TAKE_ORDER => '技师接单',
|
||||
self::COACH_DEPART => '技师出发',
|
||||
self::COACH_ARRIVE => '技师达到',
|
||||
self::COACH_START_SERVER => '服务开始',
|
||||
self::COACH_SERVER_FINISH => '服务完成',
|
||||
|
||||
|
||||
];
|
||||
|
||||
if (true === $value) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$value];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取变动类型
|
||||
* @param $from
|
||||
* @return array|string[]|\string[][]
|
||||
* @author cjhao
|
||||
* @date 2024/9/14 13:04
|
||||
*/
|
||||
public function getChangeType($from = true){
|
||||
$desc = [
|
||||
self::TYPE_SYSTEM => [
|
||||
self::SYSTEM_CANCEL_ORDER => '系统取消订单',
|
||||
],
|
||||
self::TYPE_ADMIN => [
|
||||
self::ADMIN_CHANGE_COACH => '后台更换技师',
|
||||
],
|
||||
self::TYPE_USER => [
|
||||
self::USER_ADD_ORDER => '用户提交订单',
|
||||
self::USER_CANCEL_ORDER => '用户取消订单',
|
||||
self::USER_PAY_ORDER => '用户支付订单',
|
||||
self::USER_PAY_ORDER_GAP => '用户支付差价',
|
||||
self::USER_PAY_ORDER_APPEND => '用户支付加钟',
|
||||
],
|
||||
self::TYPE_COACH => [
|
||||
self::COACH_TAKE_ORDER => '技师接单',
|
||||
self::COACH_DEPART => '技师出发',
|
||||
self::COACH_ARRIVE => '技师达到',
|
||||
self::COACH_START_SERVER => '服务开始',
|
||||
self::COACH_SERVER_FINISH => '服务完成',
|
||||
],
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? [];
|
||||
}
|
||||
}
|
||||
78
server/app/common/enum/OrderRefundEnum.php
Executable file
78
server/app/common/enum/OrderRefundEnum.php
Executable file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class OrderRefundEnum
|
||||
{
|
||||
//操作人类型
|
||||
const TYPE_SYSTEM = 1;//系统
|
||||
const TYPE_ADMIN = 2;//后台
|
||||
const TYPE_USER = 3;//用户
|
||||
|
||||
//退款状态
|
||||
const STATUS_ING = 0;//退款中
|
||||
const STATUS_SUCCESS = 1;//退款成功
|
||||
const STATUS_FAIL = 2;//退款失败
|
||||
|
||||
|
||||
/**
|
||||
* @notes 操作人
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/11 2:17 下午
|
||||
*/
|
||||
public static function getOperatorDesc($value = true)
|
||||
{
|
||||
$desc = [
|
||||
self::TYPE_SYSTEM => '系统',
|
||||
self::TYPE_ADMIN => '后台',
|
||||
self::TYPE_USER => '用户',
|
||||
];
|
||||
|
||||
if (true === $value) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$value];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 退款状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/9/8 6:45 下午
|
||||
*/
|
||||
public static function getStatusDesc($value = true)
|
||||
{
|
||||
$desc = [
|
||||
self::STATUS_ING => '退款中',
|
||||
self::STATUS_SUCCESS => '退款成功',
|
||||
self::STATUS_FAIL => '退款失败',
|
||||
];
|
||||
|
||||
if (true === $value) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$value];
|
||||
}
|
||||
}
|
||||
74
server/app/common/enum/PayEnum.php
Executable file
74
server/app/common/enum/PayEnum.php
Executable file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
|
||||
class PayEnum
|
||||
{
|
||||
//支付类型
|
||||
const WECHAT_PAY = 1; //微信支付
|
||||
const ALI_PAY = 2; //支付宝支付
|
||||
const BALANCE_PAY = 3; //余额支付
|
||||
|
||||
|
||||
//支付状态
|
||||
const UNPAID = 0; //未支付
|
||||
const ISPAID = 1; //已支付
|
||||
|
||||
|
||||
/**
|
||||
* @notes 支付类型
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/11 11:06 上午
|
||||
*/
|
||||
public static function getPayTypeDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::WECHAT_PAY => '微信支付',
|
||||
self::ALI_PAY => '支付宝支付',
|
||||
self::BALANCE_PAY => '余额支付',
|
||||
];
|
||||
if (true === $value) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value] ?? '未知';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 支付状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/11 11:07 上午
|
||||
*/
|
||||
public static function getPayStatusDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::UNPAID => '未支付',
|
||||
self::ISPAID => '已支付',
|
||||
];
|
||||
if (true === $value) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
}
|
||||
40
server/app/common/enum/SmsEnum.php
Executable file
40
server/app/common/enum/SmsEnum.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\enum;
|
||||
|
||||
/**
|
||||
* 短信枚举
|
||||
* Class SmsEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class SmsEnum
|
||||
{
|
||||
/**
|
||||
* 发送状态
|
||||
*/
|
||||
const SEND_ING = 0;
|
||||
const SEND_SUCCESS = 1;
|
||||
const SEND_FAIL = 2;
|
||||
|
||||
/**
|
||||
* 短信平台
|
||||
*/
|
||||
const ALI = 1;
|
||||
const TENCENT = 2;
|
||||
}
|
||||
48
server/app/common/enum/WithdrawApplyEnum.php
Executable file
48
server/app/common/enum/WithdrawApplyEnum.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace app\common\enum;
|
||||
/**
|
||||
* 提现申请枚举类
|
||||
* Class WithdrawApplyEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class WithdrawApplyEnum
|
||||
{
|
||||
|
||||
|
||||
const STATUS_WAIT = 1;
|
||||
const STATUS_SUCCESS = 2;
|
||||
const STATUS_FAILT = 3;
|
||||
|
||||
const STATUS_WAIT_WITHDRAW = 4;
|
||||
|
||||
const STATUS_WAIT_WITHDRAW_SUCCESS = 5;
|
||||
|
||||
const STATUS_WAIT_WITHDRAW_FAILT = 6;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 状态列表
|
||||
* @param $from
|
||||
* @return string
|
||||
* @author cjhao
|
||||
* @date 2024/9/27 10:27
|
||||
*/
|
||||
public function getStatusDesc($from)
|
||||
{
|
||||
$desc = [
|
||||
self::STATUS_WAIT => '待审核',
|
||||
self::STATUS_SUCCESS => '审核成功',
|
||||
self::STATUS_FAILT => '审核失败',
|
||||
self::STATUS_WAIT_WITHDRAW => '提现中',
|
||||
self::STATUS_WAIT_WITHDRAW_SUCCESS => '提现成功',
|
||||
self::STATUS_WAIT_WITHDRAW_FAILT => '提现失败',
|
||||
|
||||
];
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
51
server/app/common/enum/YesNoEnum.php
Executable file
51
server/app/common/enum/YesNoEnum.php
Executable file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\enum;
|
||||
|
||||
/**
|
||||
* 通过枚举类,枚举只有两个值的时候使用
|
||||
* Class YesNoEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class YesNoEnum
|
||||
{
|
||||
const YES = 1;
|
||||
const NO = 0;
|
||||
|
||||
/**
|
||||
* @notes 获取禁用状态
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/8 19:02
|
||||
*/
|
||||
public static function getDisableDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::YES => '禁用',
|
||||
self::NO => '正常'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
}
|
||||
159
server/app/common/enum/accountLog/AccountLogEnum.php
Executable file
159
server/app/common/enum/accountLog/AccountLogEnum.php
Executable file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\accountLog;
|
||||
|
||||
|
||||
class AccountLogEnum
|
||||
{
|
||||
//变动对象
|
||||
const MONEY = 1;//可用余额
|
||||
const EARNINGS = 2;//可提现金额
|
||||
|
||||
//动作
|
||||
const DEC = 1;//减少
|
||||
const INC = 2;//增加
|
||||
|
||||
//可用余额变动类型
|
||||
const ADMIN_INC_MONEY = 100;//管理员增加可用余额
|
||||
const ADMIN_DEC_MONEY = 101;//管理员扣减可用余额
|
||||
const CANCEL_ORDER_ADD_MONEY = 102;//取消订单退还可用余额
|
||||
const WITHDRAW_ADD_MONEY = 103;//佣金提现增加可用余额
|
||||
const USER_RECHARGE_ADD_MONEY = 104;//用户充值增加可用余额
|
||||
const ORDER_DEC_MONEY = 105;//用户下单扣减可用余额
|
||||
const ORDER_APPEND_DEC_MONEY = 106;//用户下单扣减可用余额
|
||||
const ORDER_GAP_DEC_MONEY = 107;//用户下单扣减可用余额
|
||||
const REFUND_ORDER_ADD_MONEY = 108;//用户下单扣减可用余额
|
||||
|
||||
//可提现余额变动类型
|
||||
const ADMIN_INC_EARNINGS = 200;//管理员增加可提现金额
|
||||
const ADMIN_DEC_EARNINGS = 201;//管理员扣减可提现金额
|
||||
const WITHDRAW_DEC_EARNINGS = 202;//佣金提现
|
||||
const WITHDRAW_FAIL_INC_EARNINGS = 203;//提现失败返还可提现金额
|
||||
const ORDER_SETTLEMENT_INC_EARNINGS = 204;//团长佣金结算
|
||||
const AFTER_SALE_DEC_EARNINGS = 205;//售后退款扣减佣金
|
||||
|
||||
|
||||
//可用余额(变动类型汇总)
|
||||
const MONEY_DESC = [
|
||||
self::ADMIN_INC_MONEY,
|
||||
self::ADMIN_DEC_MONEY,
|
||||
self::CANCEL_ORDER_ADD_MONEY,
|
||||
self::WITHDRAW_ADD_MONEY,
|
||||
self::USER_RECHARGE_ADD_MONEY,
|
||||
self::ORDER_DEC_MONEY,
|
||||
];
|
||||
|
||||
//可提现余额(变动类型汇总)
|
||||
const EARNINGS_DESC = [
|
||||
self::ADMIN_INC_EARNINGS,
|
||||
self::ADMIN_DEC_EARNINGS,
|
||||
self::WITHDRAW_DEC_EARNINGS,
|
||||
self::WITHDRAW_FAIL_INC_EARNINGS,
|
||||
self::ORDER_SETTLEMENT_INC_EARNINGS,
|
||||
self::AFTER_SALE_DEC_EARNINGS,
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 动作描述
|
||||
* @param $action
|
||||
* @param false $flag
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:08 下午
|
||||
*/
|
||||
public static function getActionDesc($action, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::DEC => '减少',
|
||||
self::INC => '增加',
|
||||
];
|
||||
if($flag) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$action] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 变动类型描述
|
||||
* @param $changeType
|
||||
* @param false $flag
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:09 下午
|
||||
*/
|
||||
public static function getChangeTypeDesc($changeType, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::ADMIN_INC_MONEY => '管理员增加余额',
|
||||
self::ADMIN_DEC_MONEY => '管理员扣减余额',
|
||||
// self::ADMIN_INC_EARNINGS => '管理员增加可提现金额',
|
||||
// self::ADMIN_DEC_EARNINGS => '管理员扣减可提现金额',
|
||||
// self::WITHDRAW_DEC_EARNINGS => '佣金提现',
|
||||
// self::WITHDRAW_FAIL_INC_EARNINGS => '提现失败返还可提现金额',
|
||||
self::REFUND_ORDER_ADD_MONEY => '订单退款退还余额',
|
||||
self::CANCEL_ORDER_ADD_MONEY => '取消订单',
|
||||
self::ORDER_APPEND_DEC_MONEY => '支付加时',
|
||||
self::ORDER_GAP_DEC_MONEY => '支付差价',
|
||||
// self::WITHDRAW_ADD_MONEY => '佣金提现增加可用余额',
|
||||
self::USER_RECHARGE_ADD_MONEY => '充值余额',
|
||||
self::ORDER_DEC_MONEY => '支付订单',
|
||||
// self::ORDER_SETTLEMENT_INC_EARNINGS => '团长佣金结算',
|
||||
// self::AFTER_SALE_DEC_EARNINGS => '售后退款扣减佣金',
|
||||
];
|
||||
if($flag) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$changeType] ?? '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取可用余额类型描述
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:42 下午
|
||||
*/
|
||||
public static function getMoneyChangeTypeDesc()
|
||||
{
|
||||
$change_type = self::MONEY_DESC;
|
||||
$change_type_desc = self::getChangeTypeDesc('',true);
|
||||
$change_type_desc = array_filter($change_type_desc, function($key) use ($change_type) {
|
||||
return in_array($key, $change_type);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
return $change_type_desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取可提现余额类型描述
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:42 下午
|
||||
*/
|
||||
public static function getEarningsChangeTypeDesc()
|
||||
{
|
||||
$change_type = self::EARNINGS_DESC;
|
||||
$change_type_desc = self::getChangeTypeDesc('',true);
|
||||
$change_type_desc = array_filter($change_type_desc, function($key) use ($change_type) {
|
||||
return in_array($key, $change_type);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
return $change_type_desc;
|
||||
}
|
||||
}
|
||||
168
server/app/common/enum/accountLog/CoachAccountLogEnum.php
Executable file
168
server/app/common/enum/accountLog/CoachAccountLogEnum.php
Executable file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\accountLog;
|
||||
|
||||
|
||||
class CoachAccountLogEnum
|
||||
{
|
||||
//变动对象
|
||||
const MONEY = 1;//可用余额
|
||||
const DEPOSIT = 2; //保证金
|
||||
|
||||
//动作
|
||||
const DEC = 1;//减少
|
||||
const INC = 2;//增加
|
||||
|
||||
//可用余额变动类型
|
||||
const ADMIN_INC_MONEY = 100;//管理员增加可用余额
|
||||
const ADMIN_DEC_MONEY = 101;//管理员扣减可用余额
|
||||
const ORDER_ADD_MONEY = 102;//订单增加可用余额
|
||||
|
||||
const WITHDRAW_DEC_MONEY = 103;//提现佣金
|
||||
const WITHDRAW_INC_MONEY = 104;//提现失败退出佣金
|
||||
|
||||
const ORDER_ADD_CART_MONEY = 105;//订单增加可用余额车费
|
||||
|
||||
//可提现余额变动类型deposit
|
||||
const ADMIN_INC_DEPOSIT = 200;//管理员增加保证金
|
||||
const ADMIN_DEC_DEPOSIT = 201;//管理员扣减保证金
|
||||
|
||||
const RECHARGE_INC_DEPOSIT = 202; //充值增加保证金
|
||||
const WITHDRAW_DEC_DEPOSIT = 203; //提现保证金
|
||||
const WITHDRAW_INC_DEPOSIT = 204; //提现失败退出保证金
|
||||
|
||||
|
||||
//佣金余额(变动类型汇总)
|
||||
const MONEY_DESC = [
|
||||
self::ADMIN_INC_MONEY,
|
||||
self::ADMIN_DEC_MONEY,
|
||||
self::ORDER_ADD_MONEY,
|
||||
self::ORDER_ADD_CART_MONEY,
|
||||
self::WITHDRAW_DEC_MONEY,
|
||||
self::WITHDRAW_INC_MONEY,
|
||||
];
|
||||
|
||||
//保证金
|
||||
const DEPOSIT_DESC = [
|
||||
self::ADMIN_INC_DEPOSIT,
|
||||
self::ADMIN_DEC_DEPOSIT,
|
||||
self::RECHARGE_INC_DEPOSIT,
|
||||
self::WITHDRAW_DEC_DEPOSIT,
|
||||
self::WITHDRAW_INC_DEPOSIT,
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 动作描述
|
||||
* @param $action
|
||||
* @param false $flag
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:08 下午
|
||||
*/
|
||||
public static function getActionDesc($action, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::DEC => '减少',
|
||||
self::INC => '增加',
|
||||
];
|
||||
if($flag) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$action] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 师傅佣金变动类型
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/9/13 13:10
|
||||
*/
|
||||
public static function getCommissionTypeDesc($from = true){
|
||||
$desc = [
|
||||
self::ADMIN_INC_MONEY => '管理员增加佣金',
|
||||
self::ADMIN_DEC_MONEY => '管理员扣减佣金',
|
||||
self::ORDER_ADD_MONEY => '订单佣金结算',
|
||||
self::ORDER_ADD_CART_MONEY => '订单车费结算',
|
||||
self::WITHDRAW_DEC_MONEY => '提现佣金',
|
||||
self::WITHDRAW_INC_MONEY => '提现失败退还佣金',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 保证金变动类型
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/9/13 13:15
|
||||
*/
|
||||
public static function getDepositTypeDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::ADMIN_INC_DEPOSIT => '管理员增加保证金',
|
||||
self::ADMIN_DEC_DEPOSIT => '管理员扣减保证金',
|
||||
self::WITHDRAW_DEC_DEPOSIT => '提现保证金',
|
||||
self::WITHDRAW_INC_DEPOSIT => '提现失败退还保证金',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 变动类型描述
|
||||
* @param $changeType
|
||||
* @param false $flag
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:09 下午
|
||||
*/
|
||||
public static function getChangeTypeDesc($changeType, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::ADMIN_INC_MONEY => '管理员增加佣金',
|
||||
self::ADMIN_DEC_MONEY => '管理员扣减佣金',
|
||||
self::ORDER_ADD_MONEY => '完成订单增加佣金',
|
||||
self::ADMIN_INC_DEPOSIT => '管理员增加保证金',
|
||||
self::ADMIN_DEC_DEPOSIT => '管理员扣减保证金',
|
||||
self::RECHARGE_INC_DEPOSIT => '充值增加保证金',
|
||||
self::WITHDRAW_DEC_DEPOSIT => '提现保证金',
|
||||
self::WITHDRAW_INC_DEPOSIT => '提现失败退还保证金',
|
||||
self::ORDER_ADD_CART_MONEY => '订单车费结算',
|
||||
self::WITHDRAW_DEC_MONEY => '提现佣金',
|
||||
self::WITHDRAW_INC_MONEY => '提现失败退还佣金',
|
||||
];
|
||||
if($flag) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$changeType] ?? '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
166
server/app/common/enum/accountLog/ShopAccountLogEnum.php
Executable file
166
server/app/common/enum/accountLog/ShopAccountLogEnum.php
Executable file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\accountLog;
|
||||
|
||||
|
||||
class ShopAccountLogEnum
|
||||
{
|
||||
//变动对象
|
||||
const MONEY = 1;//可用余额
|
||||
const DEPOSIT = 2; //保证金
|
||||
|
||||
//动作
|
||||
const DEC = 1;//减少
|
||||
const INC = 2;//增加
|
||||
|
||||
//可用余额变动类型
|
||||
const ADMIN_INC_MONEY = 100;//管理员增加可用余额
|
||||
const ADMIN_DEC_MONEY = 101;//管理员扣减可用余额
|
||||
const ORDER_ADD_MONEY = 102;//订单增加可用余额
|
||||
|
||||
const WITHDRAW_DEC_MONEY = 103;//提现佣金
|
||||
const WITHDRAW_INC_MONEY = 104;//提现失败退出佣金
|
||||
const ORDER_ADD_CART_MONEY = 105;//订单增加可用余额车费
|
||||
|
||||
|
||||
//可提现余额变动类型deposit
|
||||
const ADMIN_INC_DEPOSIT = 200;//管理员增加保证金
|
||||
const ADMIN_DEC_DEPOSIT = 201;//管理员扣减保证金
|
||||
|
||||
const RECHARGE_INC_DEPOSIT = 202; //充值增加保证金
|
||||
const WITHDRAW_DEC_DEPOSIT = 203; //提现保证金
|
||||
const WITHDRAW_INC_DEPOSIT = 204; //提现失败退出保证金
|
||||
|
||||
//佣金余额(变动类型汇总)
|
||||
const MONEY_DESC = [
|
||||
self::ADMIN_INC_MONEY,
|
||||
self::ADMIN_DEC_MONEY,
|
||||
self::ORDER_ADD_MONEY,
|
||||
self::WITHDRAW_DEC_MONEY,
|
||||
self::ORDER_ADD_CART_MONEY,
|
||||
self::WITHDRAW_INC_MONEY,
|
||||
];
|
||||
|
||||
//保证金
|
||||
const DEPOSIT_DESC = [
|
||||
self::ADMIN_INC_DEPOSIT,
|
||||
self::ADMIN_DEC_DEPOSIT,
|
||||
self::RECHARGE_INC_DEPOSIT,
|
||||
self::WITHDRAW_DEC_DEPOSIT,
|
||||
self::WITHDRAW_INC_DEPOSIT,
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 动作描述
|
||||
* @param $action
|
||||
* @param false $flag
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:08 下午
|
||||
*/
|
||||
public static function getActionDesc($action, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::DEC => '减少',
|
||||
self::INC => '增加',
|
||||
];
|
||||
if($flag) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$action] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 师傅佣金变动类型
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/9/13 13:10
|
||||
*/
|
||||
public static function getCommissionTypeDesc($from = true){
|
||||
$desc = [
|
||||
self::ADMIN_INC_MONEY => '管理员增加佣金',
|
||||
self::ADMIN_DEC_MONEY => '管理员扣减佣金',
|
||||
self::ORDER_ADD_MONEY => '订单佣金结算',
|
||||
self::ORDER_ADD_CART_MONEY => '订单车费结算',
|
||||
self::WITHDRAW_DEC_MONEY => '提现佣金',
|
||||
self::WITHDRAW_INC_MONEY => '提现失败退还佣金',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 保证金变动类型
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/9/13 13:15
|
||||
*/
|
||||
public static function getDepositTypeDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::ADMIN_INC_DEPOSIT => '管理员增加保证金',
|
||||
self::ADMIN_DEC_DEPOSIT => '管理员扣减保证金',
|
||||
self::RECHARGE_INC_DEPOSIT => '充值增加保证金',
|
||||
self::WITHDRAW_DEC_DEPOSIT => '提现保证金',
|
||||
self::WITHDRAW_INC_DEPOSIT => '提现失败退还保证金',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 变动类型描述
|
||||
* @param $changeType
|
||||
* @param false $flag
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:09 下午
|
||||
*/
|
||||
public static function getChangeTypeDesc($changeType, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::ADMIN_INC_MONEY => '管理员增加佣金',
|
||||
self::ADMIN_DEC_MONEY => '管理员扣减佣金',
|
||||
self::ORDER_ADD_MONEY => '完成订单增加佣金',
|
||||
self::ADMIN_INC_DEPOSIT => '管理员增加保证金',
|
||||
self::ADMIN_DEC_DEPOSIT => '管理员扣减保证金',
|
||||
self::RECHARGE_INC_DEPOSIT => '充值增加保证金',
|
||||
self::WITHDRAW_DEC_DEPOSIT => '提现保证金',
|
||||
self::WITHDRAW_INC_DEPOSIT => '提现失败退还保证金',
|
||||
self::WITHDRAW_DEC_MONEY => '提现佣金',
|
||||
self::WITHDRAW_INC_MONEY => '提现失败退还佣金',
|
||||
self::ORDER_ADD_CART_MONEY => '订单车费结算',
|
||||
];
|
||||
if($flag) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$changeType] ?? '';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
74
server/app/common/enum/coach/CoachEnum.php
Executable file
74
server/app/common/enum/coach/CoachEnum.php
Executable file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
namespace app\common\enum\coach;
|
||||
class CoachEnum
|
||||
{
|
||||
const WORK_STATUS_ONLINE = 1;
|
||||
const WORK_STATUS_DOWNLINE = 0;
|
||||
|
||||
|
||||
const WORK_STATUS_FREEZE = 0;
|
||||
const WORK_STATUS_NORMAL = 1;
|
||||
|
||||
const AUDIT_STATUS_WAIT = 0;
|
||||
const AUDIT_STATUS_PASS = 1;
|
||||
const AUDIT_STATUS_REFUSE = 2;
|
||||
|
||||
/**
|
||||
* @notes 工作状态
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/21 17:36
|
||||
*/
|
||||
public static function getWorkStatusDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::WORK_STATUS_ONLINE => '接单中',
|
||||
self::WORK_STATUS_DOWNLINE => '休息中',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 服务状态
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/21 17:36
|
||||
*/
|
||||
public static function getServerStatusDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::WORK_STATUS_NORMAL => '正常',
|
||||
self::WORK_STATUS_FREEZE => '冻结',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 审核状态列表
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/23 16:14
|
||||
*/
|
||||
public static function getAuditStatusDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::AUDIT_STATUS_WAIT => '待审核',
|
||||
self::AUDIT_STATUS_PASS => '审核通过',
|
||||
self::AUDIT_STATUS_REFUSE => '审核拒绝'
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
55
server/app/common/enum/coach/CoachUserEnum.php
Executable file
55
server/app/common/enum/coach/CoachUserEnum.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\coach;
|
||||
|
||||
/**
|
||||
* 管理后台登录终端
|
||||
* Class terminalEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class CoachUserEnum
|
||||
{
|
||||
|
||||
/**
|
||||
* 性别
|
||||
* SEX_OTHER = 未知
|
||||
* SEX_MEN = 男
|
||||
* SEX_WOMAN = 女
|
||||
*/
|
||||
const SEX_OTHER = 0;
|
||||
const SEX_MEN = 1;
|
||||
const SEX_WOMAN = 2;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 性别描述
|
||||
* @param bool $from
|
||||
* @return string|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/9/7 15:05
|
||||
*/
|
||||
public static function getSexDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::SEX_OTHER => '未知',
|
||||
self::SEX_MEN => '男',
|
||||
self::SEX_WOMAN => '女',
|
||||
];
|
||||
if (true === $from) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
64
server/app/common/enum/coach/CoachUserTerminalEnum.php
Executable file
64
server/app/common/enum/coach/CoachUserTerminalEnum.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\coach;
|
||||
|
||||
/**
|
||||
* 管理后台登录终端
|
||||
* Class terminalEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class CoachUserTerminalEnum
|
||||
{
|
||||
//const OTHER = 0; //其他来源
|
||||
const WECHAT_MMP = 1; //微信小程序
|
||||
const WECHAT_OA = 2; //微信公众号
|
||||
const H5 = 3;//手机H5登录
|
||||
const PC = 4;//电脑PC
|
||||
const IOS = 5;//苹果app
|
||||
const ANDROID = 6;//安卓app
|
||||
|
||||
|
||||
const ALL_TERMINAL = [
|
||||
self::WECHAT_MMP,
|
||||
self::WECHAT_OA,
|
||||
self::H5,
|
||||
self::PC,
|
||||
self::IOS,
|
||||
self::ANDROID,
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 获取终端
|
||||
* @param bool $from
|
||||
* @return array|mixed|string
|
||||
* @author cjhao
|
||||
* @date 2021/7/30 18:09
|
||||
*/
|
||||
public static function getTermInalDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::WECHAT_MMP => '微信小程序',
|
||||
self::WECHAT_OA => '微信公众号',
|
||||
self::H5 => '手机H5',
|
||||
self::PC => '电脑PC',
|
||||
self::IOS => '苹果APP',
|
||||
self::ANDROID => '安卓APP',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
749
server/app/common/enum/notice/NoticeEnum.php
Executable file
749
server/app/common/enum/notice/NoticeEnum.php
Executable file
@@ -0,0 +1,749 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\enum\notice;
|
||||
|
||||
/**
|
||||
* 通知枚举
|
||||
* Class NoticeEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class NoticeEnum
|
||||
{
|
||||
/**
|
||||
* 通知类型
|
||||
*/
|
||||
const SYSTEM = 1;
|
||||
const SMS = 2;
|
||||
const OA = 3;
|
||||
const MNP = 4;
|
||||
|
||||
|
||||
/**
|
||||
* 短信验证码场景
|
||||
*/
|
||||
const LOGIN_CAPTCHA = 101;//登录验证码
|
||||
const BIND_MOBILE_CAPTCHA = 102;//绑定手机验证码
|
||||
const CHANGE_MOBILE_CAPTCHA = 103;//变更手机验证码
|
||||
const RESET_PASSWORD_CAPTCHA = 104;//重设登录密码验证码
|
||||
const REGISTER_CAPTCHA = 105;//注册验证码
|
||||
const REGISTER_CAPTCHA_STAFF = 106;//注册验证码-师傅
|
||||
const LOGIN_CAPTCHA_STAFF = 107;//登录验证码-师傅
|
||||
const RESET_PASSWORD_CAPTCHA_STAFF = 108;//重设登录密码验证码-师傅
|
||||
const CHANGE_MOBILE_CAPTCHA_STAFF = 109;//重设登录密码验证码-师傅
|
||||
|
||||
const REGISTER_CAPTCHA_SHOP = 110;//注册验证码
|
||||
const LOGIN_CAPTCHA_SHOP = 111;//登录验证码
|
||||
|
||||
const RESET_PASSWORD_CAPTCHA_SHOP = 112;//重设登录密码验证码
|
||||
|
||||
const CHANGE_MOBILE_CAPTCHA_SHOP = 113;//变更手机验证码
|
||||
|
||||
|
||||
/**
|
||||
* 短信业务通知
|
||||
*/
|
||||
const ORDER_PAY_NOTICE = 201;//订单付款通知
|
||||
const ACCEPT_ORDER_NOTICE = 202;//订单接单通知
|
||||
const START_SERVICE_NOTICE = 203;//开始服务通知
|
||||
const FINISH_SERVICE_NOTICE = 204;//完成服务通知
|
||||
const ORDER_CANCEL_NOTICE = 205;//取消订单通知
|
||||
const ORDER_REFUND_NOTICE = 206;//服务退款通知
|
||||
const ORDER_PAY_NOTICE_PLATFORM = 207;//订单付款通知-平台
|
||||
const STAFF_APPLY_NOTICE_PLATFORM = 208;//入住申请通知-平台
|
||||
const ORDER_ABNORMAL_NOTICE_PLATFORM = 209;//订单异常通知-平台
|
||||
const APPLY_SUCCESS_NOTICE_STAFF = 210;//入驻审核通过通知-师傅
|
||||
const APPLY_FAIL_NOTICE_STAFF = 211;//入驻审核未通过通知-师傅
|
||||
const ACCEPT_ORDER_NOTICE_STAFF = 212;//接单通知-师傅
|
||||
const START_SERVICE_NOTICE_STAFF = 213;//开始服务通知-师傅
|
||||
const END_SERVICE_NOTICE_STAFF = 214;//结束服务通知-师傅
|
||||
const ORDER_CANCEL_NOTICE_STAFF = 215;//取消订单通知-师傅
|
||||
|
||||
|
||||
/**
|
||||
* 验证码场景
|
||||
*/
|
||||
const SMS_SCENE = [
|
||||
self::LOGIN_CAPTCHA,
|
||||
self::BIND_MOBILE_CAPTCHA,
|
||||
self::CHANGE_MOBILE_CAPTCHA,
|
||||
self::RESET_PASSWORD_CAPTCHA,
|
||||
self::REGISTER_CAPTCHA,
|
||||
self::REGISTER_CAPTCHA_STAFF,
|
||||
self::LOGIN_CAPTCHA_STAFF,
|
||||
self::RESET_PASSWORD_CAPTCHA_STAFF,
|
||||
self::CHANGE_MOBILE_CAPTCHA_STAFF,
|
||||
self::REGISTER_CAPTCHA_SHOP,
|
||||
self::LOGIN_CAPTCHA_SHOP,
|
||||
self::RESET_PASSWORD_CAPTCHA_SHOP,
|
||||
self::CHANGE_MOBILE_CAPTCHA_SHOP,
|
||||
];
|
||||
|
||||
|
||||
//通知类型
|
||||
const BUSINESS_NOTIFICATION = 1;//业务通知
|
||||
const VERIFICATION_CODE = 2;//验证码
|
||||
|
||||
|
||||
/**
|
||||
* @notes 通知类型
|
||||
* @param bool $value
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/17 2:49 下午
|
||||
*/
|
||||
public static function getTypeDesc($value = true)
|
||||
{
|
||||
$data = [
|
||||
self::BUSINESS_NOTIFICATION => '业务通知',
|
||||
self::VERIFICATION_CODE => '验证码'
|
||||
];
|
||||
if ($value === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$value];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取场景描述
|
||||
* @param $sceneId
|
||||
* @param false $flag
|
||||
* @return string|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 11:33
|
||||
*/
|
||||
public static function getSceneDesc($sceneId, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::LOGIN_CAPTCHA => '登录验证码',
|
||||
self::BIND_MOBILE_CAPTCHA => '绑定手机验证码',
|
||||
self::CHANGE_MOBILE_CAPTCHA => '变更手机验证码',
|
||||
self::CHANGE_MOBILE_CAPTCHA_STAFF => '变更手机验证码',
|
||||
self::RESET_PASSWORD_CAPTCHA => '重设登录密码验证码',
|
||||
self::REGISTER_CAPTCHA => '注册验证码',
|
||||
self::REGISTER_CAPTCHA_STAFF => '注册验证码',
|
||||
self::LOGIN_CAPTCHA_STAFF => '登录验证码',
|
||||
self::RESET_PASSWORD_CAPTCHA_STAFF => '重设登录密码验证码',
|
||||
//商家
|
||||
self::REGISTER_CAPTCHA_SHOP => '注册验证码',
|
||||
self::LOGIN_CAPTCHA_SHOP => '登录验证码',
|
||||
self::RESET_PASSWORD_CAPTCHA_SHOP => '重设登录密码验证码',
|
||||
self::CHANGE_MOBILE_CAPTCHA_SHOP => '变更手机验证码',
|
||||
|
||||
self::ORDER_PAY_NOTICE => '订单付款通知',
|
||||
self::ACCEPT_ORDER_NOTICE => '订单接单通知',
|
||||
self::START_SERVICE_NOTICE => '开始服务通知',
|
||||
self::FINISH_SERVICE_NOTICE => '完成服务通知',
|
||||
self::ORDER_CANCEL_NOTICE => '取消订单通知',
|
||||
self::ORDER_REFUND_NOTICE => '服务退款通知',
|
||||
self::ORDER_PAY_NOTICE_PLATFORM => '订单付款通知',
|
||||
self::STAFF_APPLY_NOTICE_PLATFORM => '入住申请通知',
|
||||
self::ORDER_ABNORMAL_NOTICE_PLATFORM => '订单异常通知',
|
||||
self::APPLY_SUCCESS_NOTICE_STAFF => '入驻审核通过通知',
|
||||
self::APPLY_FAIL_NOTICE_STAFF => '入驻审核未通过通知',
|
||||
self::ACCEPT_ORDER_NOTICE_STAFF => '接单通知',
|
||||
self::START_SERVICE_NOTICE_STAFF => '开始服务通知',
|
||||
self::END_SERVICE_NOTICE_STAFF => '结束服务通知',
|
||||
self::ORDER_CANCEL_NOTICE_STAFF => '取消订单通知',
|
||||
];
|
||||
|
||||
if ($flag) {
|
||||
return $desc;
|
||||
}
|
||||
|
||||
return $desc[$sceneId] ?? '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 更具标记获取场景
|
||||
* @param $tag
|
||||
* @return int|string
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 15:08
|
||||
*/
|
||||
public static function getSceneByTag($tag)
|
||||
{
|
||||
$scene = [
|
||||
// 手机验证码登录
|
||||
'YZMDL' => self::LOGIN_CAPTCHA,
|
||||
// 绑定手机号验证码
|
||||
'BDSJHM' => self::BIND_MOBILE_CAPTCHA,
|
||||
// 变更手机号验证码
|
||||
'BGSJHM' => self::CHANGE_MOBILE_CAPTCHA,
|
||||
// 重设登录密码
|
||||
'CSDLMM' => self::RESET_PASSWORD_CAPTCHA,
|
||||
// 注册验证码
|
||||
'ZCYZM' => self::REGISTER_CAPTCHA,
|
||||
// 注册验证码-师傅
|
||||
'ZCYZMSF' => self::REGISTER_CAPTCHA_STAFF,
|
||||
// 手机验证码登录-师傅
|
||||
'YZMDLSF' => self::LOGIN_CAPTCHA_STAFF,
|
||||
// 重设登录密码-师傅
|
||||
'CSDLMMSF' => self::RESET_PASSWORD_CAPTCHA_STAFF,
|
||||
// 变更手机号码-师傅
|
||||
'BGSJHMSF' => self::CHANGE_MOBILE_CAPTCHA_STAFF,
|
||||
|
||||
// 登录验证码-商家
|
||||
'YZMDLSFSHOP' => self::LOGIN_CAPTCHA_SHOP,
|
||||
// 注册-商家
|
||||
'ZCYZMSHOP' => self::REGISTER_CAPTCHA_SHOP,
|
||||
// 变更手机号验证码-商家
|
||||
'BGSJHMSHOP' => self::CHANGE_MOBILE_CAPTCHA_SHOP,
|
||||
// 重设登录密码-商家
|
||||
'CSDLMMSHOP' => self::RESET_PASSWORD_CAPTCHA_SHOP,
|
||||
];
|
||||
return $scene[$tag] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取用户场景值
|
||||
* @param $tag
|
||||
* @return int|string
|
||||
* @author cjhao
|
||||
* @date 2024/11/14 14:59
|
||||
*/
|
||||
public static function getSceneByUserTag($tag){
|
||||
$scene = [
|
||||
// 手机验证码登录
|
||||
'YZMDL' => self::LOGIN_CAPTCHA,
|
||||
// 绑定手机号验证码
|
||||
'BDSJHM' => self::BIND_MOBILE_CAPTCHA,
|
||||
// 变更手机号验证码
|
||||
'BGSJHM' => self::CHANGE_MOBILE_CAPTCHA,
|
||||
// 重设登录密码
|
||||
'CSDLMM' => self::RESET_PASSWORD_CAPTCHA,
|
||||
// 注册验证码
|
||||
'ZCYZM' => self::REGISTER_CAPTCHA
|
||||
];
|
||||
return $scene[$tag] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取师傅景值
|
||||
* @param $tag
|
||||
* @return int|string
|
||||
* @author cjhao
|
||||
* @date 2024/11/14 14:59
|
||||
*/
|
||||
public static function getSceneByCoachTag($tag){
|
||||
$scene = [
|
||||
// 注册验证码-师傅
|
||||
'ZCYZMSF' => self::REGISTER_CAPTCHA_STAFF,
|
||||
// 手机验证码登录-师傅
|
||||
'YZMDLSF' => self::LOGIN_CAPTCHA_STAFF,
|
||||
// 重设登录密码-师傅
|
||||
'CSDLMMSF' => self::RESET_PASSWORD_CAPTCHA_STAFF,
|
||||
// 变更手机号码-师傅
|
||||
'BGSJHMSF' => self::CHANGE_MOBILE_CAPTCHA_STAFF,
|
||||
];
|
||||
return $scene[$tag] ?? '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取商家场景值
|
||||
* @param $tag
|
||||
* @return int|string
|
||||
* @author cjhao
|
||||
* @date 2024/11/14 15:00
|
||||
*/
|
||||
public static function getSceneByShopTag($tag){
|
||||
$scene = [
|
||||
// 登录验证码-商家
|
||||
'YZMDLSHOP' => self::LOGIN_CAPTCHA_SHOP,
|
||||
// 注册-商家
|
||||
'ZCYZMSHOP' => self::REGISTER_CAPTCHA_SHOP,
|
||||
// 变更手机号验证码-商家
|
||||
'BGSJHMSHOP' => self::CHANGE_MOBILE_CAPTCHA_SHOP,
|
||||
// 重设登录密码-商家
|
||||
'CSDLMMSHOP' => self::RESET_PASSWORD_CAPTCHA_SHOP,
|
||||
];
|
||||
return $scene[$tag] ?? '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取场景变量
|
||||
* @param $sceneId
|
||||
* @param false $flag
|
||||
* @return array|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 11:33
|
||||
*/
|
||||
public static function getVars($sceneId, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::LOGIN_CAPTCHA => '验证码:code',
|
||||
self::BIND_MOBILE_CAPTCHA => '验证码:code',
|
||||
self::CHANGE_MOBILE_CAPTCHA => '验证码:code',
|
||||
self::RESET_PASSWORD_CAPTCHA => '验证码:code',
|
||||
self::REGISTER_CAPTCHA => '验证码:code',
|
||||
self::REGISTER_CAPTCHA_STAFF => '验证码:code',
|
||||
self::LOGIN_CAPTCHA_STAFF => '验证码:code',
|
||||
self::RESET_PASSWORD_CAPTCHA_STAFF => '验证码:code',
|
||||
//商家
|
||||
self::REGISTER_CAPTCHA_SHOP => '验证码:code',
|
||||
self::LOGIN_CAPTCHA_SHOP => '验证码:code',
|
||||
self::RESET_PASSWORD_CAPTCHA_SHOP => '验证码:code',
|
||||
self::CHANGE_MOBILE_CAPTCHA_SHOP => '验证码:code',
|
||||
|
||||
|
||||
self::ORDER_PAY_NOTICE => '预约时间:appoint_time',
|
||||
self::ACCEPT_ORDER_NOTICE => '预约时间:appoint_time',
|
||||
self::START_SERVICE_NOTICE => '订单编号:order_sn',
|
||||
self::FINISH_SERVICE_NOTICE => '订单编号:order_sn',
|
||||
self::ORDER_CANCEL_NOTICE => '订单编号:order_sn',
|
||||
self::ORDER_REFUND_NOTICE => '订单编号:order_sn 退款金额:refund_amount',
|
||||
self::ORDER_PAY_NOTICE_PLATFORM => '订单编号:order_sn',
|
||||
self::STAFF_APPLY_NOTICE_PLATFORM => '师傅名称:staff_name',
|
||||
self::ORDER_ABNORMAL_NOTICE_PLATFORM => '订单编号:order_sn',
|
||||
self::APPLY_SUCCESS_NOTICE_STAFF => '师傅名称:staff_name',
|
||||
self::APPLY_FAIL_NOTICE_STAFF => '师傅名称:staff_name',
|
||||
self::ACCEPT_ORDER_NOTICE_STAFF => '师傅名称:staff_name',
|
||||
self::START_SERVICE_NOTICE_STAFF => '订单编号:order_sn',
|
||||
self::END_SERVICE_NOTICE_STAFF => '订单编号:order_sn',
|
||||
self::ORDER_CANCEL_NOTICE_STAFF => '师傅名称:staff_name 预约时间:appoint_time',
|
||||
];
|
||||
|
||||
if ($flag) {
|
||||
return $desc;
|
||||
}
|
||||
|
||||
return isset($desc[$sceneId]) ? ['可选变量 ' . $desc[$sceneId]] : [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取系统通知示例
|
||||
* @param $sceneId
|
||||
* @param false $flag
|
||||
* @return array|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 11:33
|
||||
*/
|
||||
public static function getSystemExample($sceneId, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::ORDER_PAY_NOTICE => '您预约${appoint_time}的订单已支付成功,师傅届时将会与您联系,请保持手机畅通。',
|
||||
self::ACCEPT_ORDER_NOTICE => '您预约${appoint_time}的订单已被接单,师傅届时将会与您联系,请保持手机畅通。',
|
||||
self::START_SERVICE_NOTICE => '您的订单${order_sn}已开始服务。',
|
||||
self::FINISH_SERVICE_NOTICE => '您的订单${order_sn}已完成服务。',
|
||||
self::ORDER_CANCEL_NOTICE => '您的订单${order_sn}已被取消。',
|
||||
self::ORDER_REFUND_NOTICE => '您的订单${order_sn}已被退款,退款金额${refund_amount}元。',
|
||||
self::ORDER_PAY_NOTICE_PLATFORM => '亲爱的商家,您有新的订单${order_sn},请及时处理。',
|
||||
self::STAFF_APPLY_NOTICE_PLATFORM => '亲爱的商家,用户${staff_name},提交了师傅入驻申请,请及时处理。',
|
||||
self::ORDER_ABNORMAL_NOTICE_PLATFORM => '亲爱的商家,${order_sn}的订单存在异常,请及时处理。',
|
||||
self::APPLY_SUCCESS_NOTICE_STAFF => '您好,${staff_name},您的入驻申请已通过,请登录师傅端进行查看。',
|
||||
self::APPLY_FAIL_NOTICE_STAFF => '您好,{staff_name},您的入驻申请未通过,请登录师傅端进行查看。',
|
||||
self::ACCEPT_ORDER_NOTICE_STAFF => '您好,${staff_name},您有新的预约订单,请登录师傅端确认接单。',
|
||||
self::START_SERVICE_NOTICE_STAFF => '订单${order_sn}已开始服务,请严格遵守法律法规提供服务。',
|
||||
self::END_SERVICE_NOTICE_STAFF => '订单${order_sn}已结束服务,服务人员请注意核实服务的各项细节是否已完成无误。',
|
||||
self::ORDER_CANCEL_NOTICE_STAFF => '您好,${staff_name},用户预约${appoint_time}的订单已被取消,您无需操作。',
|
||||
];
|
||||
|
||||
if ($flag) {
|
||||
return $desc;
|
||||
}
|
||||
|
||||
return isset($desc[$sceneId]) ? [$desc[$sceneId]] : [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取短信通知示例
|
||||
* @param $sceneId
|
||||
* @param false $flag
|
||||
* @return array|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 11:33
|
||||
*/
|
||||
public static function getSmsExample($sceneId, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::LOGIN_CAPTCHA => '您正在登录,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::BIND_MOBILE_CAPTCHA => '您正在绑定手机号,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::CHANGE_MOBILE_CAPTCHA => '您正在变更手机号,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::RESET_PASSWORD_CAPTCHA => '您正在重设登录密码,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::REGISTER_CAPTCHA => '您正在注册账号,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::REGISTER_CAPTCHA_STAFF => '您正在注册账号,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::LOGIN_CAPTCHA_STAFF => '您正在登录,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::RESET_PASSWORD_CAPTCHA_STAFF => '您正在重设登录密码,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
//商家
|
||||
self::REGISTER_CAPTCHA_SHOP => '您正在注册账号,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::LOGIN_CAPTCHA_SHOP => '您正在登录,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::RESET_PASSWORD_CAPTCHA_SHOP => '您正在重设登录密码,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
self::CHANGE_MOBILE_CAPTCHA_SHOP => '您正在变更手机号,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。',
|
||||
|
||||
self::ORDER_PAY_NOTICE => '您预约${appoint_time}的订单已支付成功,师傅届时将会与您联系,请保持手机畅通。',
|
||||
self::ACCEPT_ORDER_NOTICE => '您预约${appoint_time}的订单已被接单,师傅届时将会与您联系,请保持手机畅通。',
|
||||
self::START_SERVICE_NOTICE => '您的订单${order_sn}已开始服务。',
|
||||
self::FINISH_SERVICE_NOTICE => '您的订单${order_sn}已完成服务。',
|
||||
self::ORDER_CANCEL_NOTICE => '您的订单${order_sn}已被取消。',
|
||||
self::ORDER_REFUND_NOTICE => '您的订单${order_sn}已被退款,退款金额${refund_amount}元。',
|
||||
self::ORDER_PAY_NOTICE_PLATFORM => '亲爱的商家,您有新的订单${order_sn},请及时处理。',
|
||||
self::STAFF_APPLY_NOTICE_PLATFORM => '亲爱的商家,用户${staff_name},提交了师傅入驻申请,请及时处理。',
|
||||
self::ORDER_ABNORMAL_NOTICE_PLATFORM => '亲爱的商家,${order_sn}的订单存在异常,请及时处理。',
|
||||
self::APPLY_SUCCESS_NOTICE_STAFF => '您好,${staff_name},您的入驻申请已通过,请登录师傅端进行查看。',
|
||||
self::APPLY_FAIL_NOTICE_STAFF => '您好,{staff_name},您的入驻申请未通过,请登录师傅端进行查看。',
|
||||
self::ACCEPT_ORDER_NOTICE_STAFF => '您好,${staff_name},您有新的预约订单,请登录师傅端确认接单。',
|
||||
self::START_SERVICE_NOTICE_STAFF => '订单${order_sn}已开始服务,请严格遵守法律法规提供服务。',
|
||||
self::END_SERVICE_NOTICE_STAFF => '订单${order_sn}已结束服务,服务人员请注意核实服务的各项细节是否已完成无误。',
|
||||
self::ORDER_CANCEL_NOTICE_STAFF => '您好,${staff_name},用户预约${appoint_time}的订单已被取消,您无需操作。',
|
||||
];
|
||||
|
||||
if ($flag) {
|
||||
return $desc;
|
||||
}
|
||||
|
||||
return isset($desc[$sceneId]) ? ['示例:' . $desc[$sceneId]] : [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取公众号模板消息示例
|
||||
* @param $sceneId
|
||||
* @param false $flag
|
||||
* @return array|string[]|\string[][]
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 11:33
|
||||
*/
|
||||
public static function getOaExample($sceneId, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::ORDER_PAY_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::ACCEPT_ORDER_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::START_SERVICE_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::FINISH_SERVICE_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::ORDER_CANCEL_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::ORDER_REFUND_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::ORDER_PAY_NOTICE_PLATFORM => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::STAFF_APPLY_NOTICE_PLATFORM => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::ORDER_ABNORMAL_NOTICE_PLATFORM => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::APPLY_SUCCESS_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::APPLY_FAIL_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::ACCEPT_ORDER_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::START_SERVICE_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::END_SERVICE_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
self::ORDER_CANCEL_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用编号:OPENTM201285651的模板,添加,获得模板ID。',
|
||||
'头部内容:您的订单已支付成功。',
|
||||
'尾部内容:商家正在快马加鞭为您安排发货。',
|
||||
'字段名 字段值 字段内容',
|
||||
'商品名称 keyword1 {goods_name}',
|
||||
'订单编号 keyword2 {order_sn}',
|
||||
'支付金额 keyword3 {order_amount}',
|
||||
],
|
||||
];
|
||||
|
||||
if ($flag) {
|
||||
return $desc;
|
||||
}
|
||||
|
||||
return $desc[$sceneId] ?? [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取小程序订阅消息示例
|
||||
* @param $sceneId
|
||||
* @param false $flag
|
||||
* @return array|mixed
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 11:33
|
||||
*/
|
||||
public static function getMnpExample($sceneId, $flag = false)
|
||||
{
|
||||
$desc = [
|
||||
self::ORDER_PAY_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::ACCEPT_ORDER_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::START_SERVICE_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::FINISH_SERVICE_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::ORDER_CANCEL_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::ORDER_REFUND_NOTICE => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::ORDER_PAY_NOTICE_PLATFORM => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::STAFF_APPLY_NOTICE_PLATFORM => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::ORDER_ABNORMAL_NOTICE_PLATFORM => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::APPLY_SUCCESS_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::APPLY_FAIL_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
|
||||
self::ACCEPT_ORDER_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::START_SERVICE_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::END_SERVICE_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
self::ORDER_CANCEL_NOTICE_STAFF => [
|
||||
'模板库: 搜索 “订单支付成功通知”,选用类目:软件服务提供商的模板,选用并选择以下参数,提交获得模板ID。',
|
||||
'字段名 字段值 字段内容',
|
||||
'订单编号 character_string1 {order_sn}',
|
||||
'支付时间 time2 {pay_time}',
|
||||
'订单金额 amount3 {order_amount}',
|
||||
'商品名称 thing4 {goods_name}',
|
||||
],
|
||||
];
|
||||
|
||||
if ($flag) {
|
||||
return $desc;
|
||||
}
|
||||
|
||||
return $desc[$sceneId] ?? [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 提示
|
||||
* @param $type
|
||||
* @param $sceneId
|
||||
* @return array|string|string[]|\string[][]
|
||||
* @author 段誉
|
||||
* @date 2022/3/29 11:33
|
||||
*/
|
||||
public static function getOperationTips($type, $sceneId)
|
||||
{
|
||||
// 场景变量
|
||||
$vars = self::getVars($sceneId);
|
||||
// 其他提示
|
||||
$other = [];
|
||||
// 示例
|
||||
switch ($type) {
|
||||
case self::SYSTEM:
|
||||
$example = self::getSystemExample($sceneId);
|
||||
break;
|
||||
case self::SMS:
|
||||
$other[] = '生效条件:1、管理后台完成短信设置。 2、第三方短信平台申请模板 3、若是腾讯云模板变量名须换成变量名出现顺序对应的数字(例:您好{nickname},您的订单{order_sn}已发货! 须改为 您好{1},您的订单{2}已发货!)';
|
||||
$example = self::getSmsExample($sceneId);
|
||||
break;
|
||||
case self::OA:
|
||||
$other[] = '配置路径:公众号后台 > 广告与服务 > 模板消息';
|
||||
$other[] = '推荐行业:主营行业:IT科技/互联网|电子商务 副营行业:消费品/消费品';
|
||||
$example = self::getOaExample($sceneId);
|
||||
break;
|
||||
case self::MNP:
|
||||
$other[] = '配置路径:小程序后台 > 功能 > 订阅消息';
|
||||
$example = self::getMnpExample($sceneId);
|
||||
break;
|
||||
}
|
||||
$tips = array_merge($vars, $example, $other);
|
||||
|
||||
return $tips;
|
||||
}
|
||||
}
|
||||
53
server/app/common/enum/notice/SmsEnum.php
Executable file
53
server/app/common/enum/notice/SmsEnum.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\enum\notice;
|
||||
|
||||
/**
|
||||
* 短信枚举
|
||||
* Class SmsEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class SmsEnum
|
||||
{
|
||||
/**
|
||||
* 发送状态
|
||||
*/
|
||||
const SEND_ING = 0;
|
||||
const SEND_SUCCESS = 1;
|
||||
const SEND_FAIL = 2;
|
||||
|
||||
/**
|
||||
* 短信平台
|
||||
*/
|
||||
const ALI = 1;
|
||||
const TENCENT = 2;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取短信平台名称
|
||||
* @param $value
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2022/8/5 11:10
|
||||
*/
|
||||
public static function getNameDesc($value)
|
||||
{
|
||||
$desc = [
|
||||
'ALI' => '阿里云短信',
|
||||
'TENCENT' => '腾讯云短信',
|
||||
];
|
||||
return $desc[$value] ?? '';
|
||||
}
|
||||
|
||||
}
|
||||
69
server/app/common/enum/shop/ShopEnum.php
Executable file
69
server/app/common/enum/shop/ShopEnum.php
Executable file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace app\common\enum\shop;
|
||||
class ShopEnum
|
||||
{
|
||||
const WORKSTATUSOPEN = 1;
|
||||
const WORKSTATUSCOLSE = 0;
|
||||
|
||||
|
||||
const SERVERSTATUSOPEN = 1;
|
||||
const SERVERSTATUSCOLSE = 0;
|
||||
|
||||
const AUDIT_STATUS_WAIT = 0;
|
||||
|
||||
const AUDIT_STATUS_PASS = 1;
|
||||
const AUDIT_STATUS_REFUSE = 2;
|
||||
const AUDIT_STATUS_CANCEL = 3;
|
||||
|
||||
public static function getServerStatus($form = true)
|
||||
{
|
||||
$desc = [
|
||||
self::SERVERSTATUSOPEN => '正常',
|
||||
self::SERVERSTATUSCOLSE => '冻结',
|
||||
];
|
||||
if(true === $form){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$form] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 工作状态
|
||||
* @param $form
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/10/3 15:42
|
||||
*/
|
||||
public static function getWorkStatus($form = true)
|
||||
{
|
||||
$desc = [
|
||||
self::WORKSTATUSOPEN => '营业中',
|
||||
self::WORKSTATUSCOLSE => '休息中',
|
||||
];
|
||||
if(true === $form){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$form] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 审核状态列表
|
||||
* @param $from
|
||||
* @return string|string[]
|
||||
* @author cjhao
|
||||
* @date 2024/8/23 16:14
|
||||
*/
|
||||
public static function getAuditStatusDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::AUDIT_STATUS_WAIT => '待审核',
|
||||
self::AUDIT_STATUS_PASS => '审核通过',
|
||||
self::AUDIT_STATUS_REFUSE => '审核拒绝',
|
||||
self::AUDIT_STATUS_CANCEL => '取消申请'
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
55
server/app/common/enum/shop/ShopUserEnum.php
Executable file
55
server/app/common/enum/shop/ShopUserEnum.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\shop;
|
||||
|
||||
/**
|
||||
* 管理后台登录终端
|
||||
* Class terminalEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class ShopUserEnum
|
||||
{
|
||||
|
||||
/**
|
||||
* 性别
|
||||
* SEX_OTHER = 未知
|
||||
* SEX_MEN = 男
|
||||
* SEX_WOMAN = 女
|
||||
*/
|
||||
const SEX_OTHER = 0;
|
||||
const SEX_MEN = 1;
|
||||
const SEX_WOMAN = 2;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 性别描述
|
||||
* @param bool $from
|
||||
* @return string|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/9/7 15:05
|
||||
*/
|
||||
public static function getSexDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::SEX_OTHER => '未知',
|
||||
self::SEX_MEN => '男',
|
||||
self::SEX_WOMAN => '女',
|
||||
];
|
||||
if (true === $from) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
64
server/app/common/enum/shop/ShopUserTerminalEnum.php
Executable file
64
server/app/common/enum/shop/ShopUserTerminalEnum.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\shop;
|
||||
|
||||
/**
|
||||
* 管理后台登录终端
|
||||
* Class terminalEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class ShopUserTerminalEnum
|
||||
{
|
||||
//const OTHER = 0; //其他来源
|
||||
const WECHAT_MMP = 1; //微信小程序
|
||||
const WECHAT_OA = 2; //微信公众号
|
||||
const H5 = 3;//手机H5登录
|
||||
const PC = 4;//电脑PC
|
||||
const IOS = 5;//苹果app
|
||||
const ANDROID = 6;//安卓app
|
||||
|
||||
|
||||
const ALL_TERMINAL = [
|
||||
self::WECHAT_MMP,
|
||||
self::WECHAT_OA,
|
||||
self::H5,
|
||||
self::PC,
|
||||
self::IOS,
|
||||
self::ANDROID,
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 获取终端
|
||||
* @param bool $from
|
||||
* @return array|mixed|string
|
||||
* @author cjhao
|
||||
* @date 2021/7/30 18:09
|
||||
*/
|
||||
public static function getTermInalDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::WECHAT_MMP => '微信小程序',
|
||||
self::WECHAT_OA => '微信公众号',
|
||||
self::H5 => '手机H5',
|
||||
self::PC => '电脑PC',
|
||||
self::IOS => '苹果APP',
|
||||
self::ANDROID => '安卓APP',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
55
server/app/common/enum/user/UserEnum.php
Executable file
55
server/app/common/enum/user/UserEnum.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\user;
|
||||
|
||||
/**
|
||||
* 管理后台登录终端
|
||||
* Class terminalEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class UserEnum
|
||||
{
|
||||
|
||||
/**
|
||||
* 性别
|
||||
* SEX_OTHER = 未知
|
||||
* SEX_MEN = 男
|
||||
* SEX_WOMAN = 女
|
||||
*/
|
||||
const SEX_OTHER = 0;
|
||||
const SEX_MEN = 1;
|
||||
const SEX_WOMAN = 2;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 性别描述
|
||||
* @param bool $from
|
||||
* @return string|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/9/7 15:05
|
||||
*/
|
||||
public static function getSexDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::SEX_OTHER => '未知',
|
||||
self::SEX_MEN => '男',
|
||||
self::SEX_WOMAN => '女',
|
||||
];
|
||||
if (true === $from) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
64
server/app/common/enum/user/UserTerminalEnum.php
Executable file
64
server/app/common/enum/user/UserTerminalEnum.php
Executable file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\enum\user;
|
||||
|
||||
/**
|
||||
* 管理后台登录终端
|
||||
* Class terminalEnum
|
||||
* @package app\common\enum
|
||||
*/
|
||||
class UserTerminalEnum
|
||||
{
|
||||
//const OTHER = 0; //其他来源
|
||||
const WECHAT_MMP = 1; //微信小程序
|
||||
const WECHAT_OA = 2; //微信公众号
|
||||
const H5 = 3;//手机H5登录
|
||||
const PC = 4;//电脑PC
|
||||
const IOS = 5;//苹果app
|
||||
const ANDROID = 6;//安卓app
|
||||
|
||||
|
||||
const ALL_TERMINAL = [
|
||||
self::WECHAT_MMP,
|
||||
self::WECHAT_OA,
|
||||
self::H5,
|
||||
self::PC,
|
||||
self::IOS,
|
||||
self::ANDROID,
|
||||
];
|
||||
|
||||
/**
|
||||
* @notes 获取终端
|
||||
* @param bool $from
|
||||
* @return array|mixed|string
|
||||
* @author cjhao
|
||||
* @date 2021/7/30 18:09
|
||||
*/
|
||||
public static function getTermInalDesc($from = true)
|
||||
{
|
||||
$desc = [
|
||||
self::WECHAT_MMP => '微信小程序',
|
||||
self::WECHAT_OA => '微信公众号',
|
||||
self::H5 => '手机H5',
|
||||
self::PC => '电脑PC',
|
||||
self::IOS => '苹果APP',
|
||||
self::ANDROID => '安卓APP',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
}
|
||||
45
server/app/common/exception/ControllerExtendException.php
Executable file
45
server/app/common/exception/ControllerExtendException.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace app\common\exception;
|
||||
|
||||
use think\Exception;
|
||||
|
||||
/**
|
||||
* 控制器继承异常
|
||||
* Class ControllerExtendException
|
||||
* @package app\common\exception
|
||||
*/
|
||||
class ControllerExtendException extends Exception
|
||||
{
|
||||
/**
|
||||
* 构造方法
|
||||
* @access public
|
||||
* @param string $message
|
||||
* @param string $model
|
||||
* @param array $config
|
||||
*/
|
||||
public function __construct(string $message, string $model = '', array $config = [])
|
||||
{
|
||||
$this->message = '控制器需要继承模块的基础控制器:' . $message;
|
||||
$this->model = $model;
|
||||
}
|
||||
}
|
||||
35
server/app/common/http/middleware/BaseMiddleware.php
Executable file
35
server/app/common/http/middleware/BaseMiddleware.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace app\common\http\middleware;
|
||||
|
||||
/**
|
||||
* 基础中间件
|
||||
* Class LikeShopMiddleware
|
||||
* @package app\common\http\middleware
|
||||
*/
|
||||
class BaseMiddleware
|
||||
{
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
55
server/app/common/http/middleware/LikeAdminAllowMiddleware.php
Executable file
55
server/app/common/http/middleware/LikeAdminAllowMiddleware.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace app\common\http\middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* 自定义跨域中间件
|
||||
* Class LikeShopMiddleware
|
||||
* @package app\common\http\middleware
|
||||
*/
|
||||
class LikeAdminAllowMiddleware
|
||||
{
|
||||
/**
|
||||
* @notes 跨域处理
|
||||
* @param $request
|
||||
* @param \Closure $next
|
||||
* @param array|null $header
|
||||
* @return mixed|\think\Response
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/26 11:51
|
||||
*/
|
||||
public function handle($request, Closure $next, ?array $header = [])
|
||||
{
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Headers: Authorization, Sec-Fetch-Mode, DNT, X-Mx-ReqToken, Keep-Alive, User-Agent, If-Match, If-None-Match, If-Unmodified-Since, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Accept-Language, Origin, Accept-Encoding,Access-Token,token,version");
|
||||
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, post');
|
||||
header('Access-Control-Max-Age: 1728000');
|
||||
header('Access-Control-Allow-Credentials:true');
|
||||
if (strtoupper($request->method()) == "OPTIONS") {
|
||||
return response();
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
32
server/app/common/listener/NoticeListener.php
Executable file
32
server/app/common/listener/NoticeListener.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace app\common\listener;
|
||||
|
||||
use app\common\logic\NoticeLogic;
|
||||
use Exception;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 通知事件监听
|
||||
* Class NoticeListener
|
||||
* @package app\listener
|
||||
*/
|
||||
class NoticeListener
|
||||
{
|
||||
public function handle($params)
|
||||
{
|
||||
try {
|
||||
if (empty($params['scene_id'])) {
|
||||
throw new Exception('场景ID不能为空');
|
||||
}
|
||||
// 根据不同的场景发送通知
|
||||
$result = NoticeLogic::noticeByScene($params);
|
||||
if (false === $result) {
|
||||
throw new Exception(NoticeLogic::getError());
|
||||
}
|
||||
return true;
|
||||
} catch (Exception $e) {
|
||||
Log::write('通知发送失败:'.$e->getMessage());
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
167
server/app/common/lists/BaseDataLists.php
Executable file
167
server/app/common/lists/BaseDataLists.php
Executable file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\lists;
|
||||
|
||||
|
||||
use app\common\validate\ListsValidate;
|
||||
use app\Request;
|
||||
use think\facade\Config;
|
||||
|
||||
/**
|
||||
* 数据列表基类
|
||||
* Class BaseDataLists
|
||||
* @package app\common\lists
|
||||
*/
|
||||
abstract class BaseDataLists implements ListsInterface
|
||||
{
|
||||
|
||||
use ListsSearchTrait;
|
||||
use ListsSortTrait;
|
||||
|
||||
public Request $request; //请求对象
|
||||
|
||||
public int $pageNo; //页码
|
||||
public int $pageSize; //每页数量
|
||||
public int $limitOffset; //limit查询offset值
|
||||
public int $limitLength; //limit查询数量
|
||||
public int $pageSizeMax;
|
||||
public int $pageType = 0; //默认类型:0-一般分页;1-不分页,获取最大所有数据
|
||||
|
||||
|
||||
protected string $orderBy;
|
||||
protected string $field;
|
||||
|
||||
protected $startTime;
|
||||
protected $endTime;
|
||||
|
||||
protected $start;
|
||||
protected $end;
|
||||
|
||||
protected array $params;
|
||||
protected $sortOrder = [];
|
||||
|
||||
public string $export;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//参数验证
|
||||
(new ListsValidate())->get()->goCheck();
|
||||
|
||||
//请求参数设置
|
||||
$this->request = request();
|
||||
$this->params = $this->request->param();
|
||||
|
||||
//分页初始化
|
||||
$this->initPage();
|
||||
|
||||
//搜索初始化
|
||||
$this->initSearch();
|
||||
|
||||
//排序初始化
|
||||
$this->initSort();
|
||||
|
||||
// //导出初始化
|
||||
// $this->initExport();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 分页参数初始化
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/30 23:55
|
||||
*/
|
||||
private function initPage()
|
||||
{
|
||||
$this->pageSizeMax = Config::get('project.lists.page_size_max');
|
||||
$this->pageSize = Config::get('project.lists.page_size');
|
||||
$this->pageType = $this->request->get('page_type', 1);
|
||||
|
||||
if ($this->pageType == 1) {
|
||||
//分页
|
||||
$this->pageNo = $this->request->get('page_no', 1) ?: 1;
|
||||
$this->pageSize = $this->request->get('page_size', $this->pageSize) ?: $this->pageSize;
|
||||
} else {
|
||||
//不分页
|
||||
$this->pageNo = 1;//强制到第一页
|
||||
$this->pageSize = $this->pageSizeMax;// 直接取最大记录数
|
||||
}
|
||||
|
||||
//limit查询参数设置
|
||||
$this->limitOffset = ($this->pageNo - 1) * $this->pageSize;
|
||||
$this->limitLength = $this->pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 初始化搜索
|
||||
* @return array
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/31 00:00
|
||||
*/
|
||||
private function initSearch()
|
||||
{
|
||||
if (!($this instanceof ListsSearchInterface)) {
|
||||
return [];
|
||||
}
|
||||
$startTime = $this->request->get('start_time');
|
||||
$this->startTime = strtotime($startTime);
|
||||
$endTime = $this->request->get('end_time');
|
||||
$this->endTime = strtotime($endTime);
|
||||
|
||||
$this->start = $this->request->get('start');
|
||||
$this->end = $this->request->get('end');
|
||||
|
||||
return $this->searchWhere = $this->createWhere($this->setSearch());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 初始化排序
|
||||
* @return array|string[]
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/31 00:03
|
||||
*/
|
||||
private function initSort()
|
||||
{
|
||||
if (!($this instanceof ListsSortInterface)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->field = $this->request->get('field', '');
|
||||
$this->orderBy = $this->request->get('order_by', '');
|
||||
|
||||
return $this->sortOrder = $this->createOrder($this->setSortFields(), $this->setDefaultOrder());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 不需要分页,可以调用此方法,无需查询第二次
|
||||
* @return int
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/6 00:34
|
||||
*/
|
||||
public function defaultCount(): int
|
||||
{
|
||||
return count($this->lists());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
39
server/app/common/lists/ListsExcelInterface.php
Executable file
39
server/app/common/lists/ListsExcelInterface.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\lists;
|
||||
|
||||
|
||||
interface ListsExcelInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置导出字段
|
||||
* @return array
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/21 16:04
|
||||
*/
|
||||
public function setExcelFields(): array;
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置导出文件名
|
||||
* @return string
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/26 17:47
|
||||
*/
|
||||
public function setFileName():string;
|
||||
|
||||
}
|
||||
35
server/app/common/lists/ListsExtendInterface.php
Executable file
35
server/app/common/lists/ListsExtendInterface.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\lists;
|
||||
|
||||
|
||||
interface ListsExtendInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 扩展字段
|
||||
* @return mixed
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/21 17:45
|
||||
*/
|
||||
public function extend();
|
||||
|
||||
}
|
||||
42
server/app/common/lists/ListsInterface.php
Executable file
42
server/app/common/lists/ListsInterface.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\lists;
|
||||
|
||||
|
||||
interface ListsInterface
|
||||
{
|
||||
/**
|
||||
* @notes 实现数据列表
|
||||
* @return array
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/6 00:33
|
||||
*/
|
||||
public function lists(): array;
|
||||
|
||||
/**
|
||||
* @notes 实现数据列表记录数
|
||||
* @return int
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/6 00:34
|
||||
*/
|
||||
public function count(): int;
|
||||
|
||||
}
|
||||
34
server/app/common/lists/ListsSearchInterface.php
Executable file
34
server/app/common/lists/ListsSearchInterface.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\lists;
|
||||
|
||||
|
||||
interface ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return array
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/7 19:44
|
||||
*/
|
||||
public function setSearch(): array;
|
||||
}
|
||||
106
server/app/common/lists/ListsSearchTrait.php
Executable file
106
server/app/common/lists/ListsSearchTrait.php
Executable file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\lists;
|
||||
|
||||
|
||||
trait ListsSearchTrait
|
||||
{
|
||||
|
||||
protected array $params;
|
||||
protected $searchWhere = [];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 搜索条件生成
|
||||
* @param $search
|
||||
* @return array
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/7 19:36
|
||||
*/
|
||||
private function createWhere($search)
|
||||
{
|
||||
if (empty($search)) {
|
||||
return [];
|
||||
}
|
||||
$where = [];
|
||||
foreach ($search as $whereType => $whereFields) {
|
||||
switch ($whereType) {
|
||||
case '=':
|
||||
case '<>':
|
||||
case '>':
|
||||
case '>=':
|
||||
case '<':
|
||||
case '<=':
|
||||
case 'in':
|
||||
foreach ($whereFields as $whereField) {
|
||||
$paramsName = substr_symbol_behind($whereField);
|
||||
if (!isset($this->params[$paramsName]) || $this->params[$paramsName] == '') {
|
||||
continue;
|
||||
}
|
||||
$where[] = [$whereField, $whereType, $this->params[$paramsName]];
|
||||
}
|
||||
break;
|
||||
case '%like%':
|
||||
foreach ($whereFields as $whereField) {
|
||||
$paramsName = substr_symbol_behind($whereField);
|
||||
if (!isset($this->params[$paramsName]) || empty($this->params[$paramsName])) {
|
||||
continue;
|
||||
}
|
||||
$where[] = [$whereField, 'like', '%' . $this->params[$paramsName] . '%'];
|
||||
}
|
||||
break;
|
||||
case '%like':
|
||||
foreach ($whereFields as $whereField) {
|
||||
$paramsName = substr_symbol_behind($whereField);
|
||||
if (!isset($this->params[$paramsName]) || empty($this->params[$paramsName])) {
|
||||
continue;
|
||||
}
|
||||
$where[] = [$whereField, 'like', '%' . $this->params[$paramsName]];
|
||||
}
|
||||
break;
|
||||
case 'like%':
|
||||
foreach ($whereFields as $whereField) {
|
||||
$paramsName = substr_symbol_behind($whereField);
|
||||
if (!isset($this->params[$paramsName]) || empty($this->params[$paramsName])) {
|
||||
continue;
|
||||
}
|
||||
$where[] = [$whereField, 'like', $this->params[$paramsName]];
|
||||
}
|
||||
break;
|
||||
case 'between_time':
|
||||
if (!is_numeric($this->startTime) || !is_numeric($this->endTime)) {
|
||||
break;
|
||||
}
|
||||
$where[] = [$whereFields, 'between', [$this->startTime, $this->endTime]];
|
||||
break;
|
||||
case 'between':
|
||||
if (empty($this->start) || empty($this->end)) {
|
||||
break;
|
||||
}
|
||||
$where[] = [$whereFields, 'between', [$this->start, $this->end]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
43
server/app/common/lists/ListsSortInterface.php
Executable file
43
server/app/common/lists/ListsSortInterface.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\lists;
|
||||
|
||||
|
||||
interface ListsSortInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置支持排序字段
|
||||
* @return array
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/7 19:44
|
||||
*/
|
||||
public function setSortFields(): array;
|
||||
|
||||
/**
|
||||
* @notes 设置默认排序条件
|
||||
* @return array
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/16 00:01
|
||||
*/
|
||||
public function setDefaultOrder():array;
|
||||
|
||||
}
|
||||
58
server/app/common/lists/ListsSortTrait.php
Executable file
58
server/app/common/lists/ListsSortTrait.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\lists;
|
||||
|
||||
|
||||
trait ListsSortTrait
|
||||
{
|
||||
|
||||
protected string $orderBy;
|
||||
protected string $field;
|
||||
|
||||
/**
|
||||
* @notes 生成排序条件
|
||||
* @param $sortField
|
||||
* @param $defaultOrder
|
||||
* @return array|string[]
|
||||
* @author 令狐冲
|
||||
* @date 2021/7/16 00:06
|
||||
*/
|
||||
private function createOrder($sortField, $defaultOrder)
|
||||
{
|
||||
if (empty($sortField) || empty($this->orderBy) || empty($this->field) || !in_array($this->field, array_keys($sortField))) {
|
||||
return $defaultOrder;
|
||||
}
|
||||
|
||||
if (isset($sortField[$this->field])) {
|
||||
$field = $sortField[$this->field];
|
||||
} else {
|
||||
return $defaultOrder;
|
||||
}
|
||||
|
||||
if ($this->orderBy = 'desc') {
|
||||
return [$field => 'desc'];
|
||||
}
|
||||
if ($this->orderBy = 'asc') {
|
||||
return [$field => 'asc'];
|
||||
}
|
||||
return $defaultOrder;
|
||||
}
|
||||
}
|
||||
71
server/app/common/logic/AccountLogLogic.php
Executable file
71
server/app/common/logic/AccountLogLogic.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\model\accountLog\AccountLog;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class AccountLogLogic extends BaseLogic
|
||||
{
|
||||
/**
|
||||
* @notes 添加账户流水记录
|
||||
* @param $userId //会员ID
|
||||
* @param $changeObject //变动对象
|
||||
* @param $changeType //变动类型
|
||||
* @param $action //变动动作
|
||||
* @param $changeAmount //变动数量
|
||||
* @param string $associationSn //关联单号
|
||||
* @param string $remark //备注
|
||||
* @param array $feature //预留字段,方便存更多其它信息
|
||||
* @return bool
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:15 下午
|
||||
*/
|
||||
public static function add($userId, $changeObject, $changeType, $action, $changeAmount, $associationSn = '', $remark = '', $feature = [])
|
||||
{
|
||||
$user = User::findOrEmpty($userId);
|
||||
if($user->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$left_amount = 0;
|
||||
switch ($changeObject) {
|
||||
case AccountLogEnum::MONEY:
|
||||
$left_amount = $user->user_money;
|
||||
break;
|
||||
}
|
||||
|
||||
$accountLog = new AccountLog();
|
||||
$data = [
|
||||
'sn' => generate_sn($accountLog, 'sn', 20),
|
||||
'user_id' => $userId,
|
||||
'change_object' => $changeObject,
|
||||
'change_type' => $changeType,
|
||||
'action' => $action,
|
||||
'left_amount' => $left_amount,
|
||||
'change_amount' => $changeAmount,
|
||||
'association_sn' => $associationSn,
|
||||
'remark' => $remark,
|
||||
'feature' => $feature ? json_encode($feature, JSON_UNESCAPED_UNICODE) : '',
|
||||
];
|
||||
return $accountLog->save($data);
|
||||
}
|
||||
}
|
||||
119
server/app/common/logic/BaseLogic.php
Executable file
119
server/app/common/logic/BaseLogic.php
Executable file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
|
||||
/**
|
||||
* 逻辑基类
|
||||
* Class BaseLogic
|
||||
* @package app\common\logic
|
||||
*/
|
||||
class BaseLogic
|
||||
{
|
||||
/**
|
||||
* 错误信息
|
||||
* @var string
|
||||
*/
|
||||
protected static $error;
|
||||
|
||||
/**
|
||||
* 返回状态码
|
||||
* @var int
|
||||
*/
|
||||
protected static $returnCode = 0;
|
||||
|
||||
|
||||
protected static $returnData;
|
||||
|
||||
/**
|
||||
* @notes 获取错误信息
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2021/7/21 18:23
|
||||
*/
|
||||
public static function getError() : string
|
||||
{
|
||||
if (false === self::hasError()) {
|
||||
return '系统错误';
|
||||
}
|
||||
return self::$error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置错误信息
|
||||
* @param $error
|
||||
* @author 段誉
|
||||
* @date 2021/7/21 18:20
|
||||
*/
|
||||
public static function setError($error) : void
|
||||
{
|
||||
!empty($error) && self::$error = $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 是否存在错误
|
||||
* @return bool
|
||||
* @author 段誉
|
||||
* @date 2021/7/21 18:32
|
||||
*/
|
||||
public static function hasError() : bool
|
||||
{
|
||||
return !empty(self::$error);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置状态码
|
||||
* @param $code
|
||||
* @author 段誉
|
||||
* @date 2021/7/28 17:05
|
||||
*/
|
||||
public static function setReturnCode($code) : void
|
||||
{
|
||||
self::$returnCode = $code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 特殊场景返回指定状态码,默认为0
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2021/7/28 15:14
|
||||
*/
|
||||
public static function getReturnCode() : int
|
||||
{
|
||||
return self::$returnCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取内容
|
||||
* @return mixed
|
||||
* @author cjhao
|
||||
* @date 2021/9/11 17:29
|
||||
*/
|
||||
public static function getReturnData()
|
||||
{
|
||||
return self::$returnData;
|
||||
}
|
||||
|
||||
}
|
||||
40
server/app/common/logic/CityLogic.php
Executable file
40
server/app/common/logic/CityLogic.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace app\common\logic;
|
||||
use app\common\model\city\City;
|
||||
|
||||
/**
|
||||
* 城市逻辑类
|
||||
* Class CityLogic
|
||||
* @package app\common\logic
|
||||
*/
|
||||
class CityLogic extends BaseLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取经纬度附近的城市
|
||||
* @param $longitude
|
||||
* @param $latitude
|
||||
* @return array
|
||||
* @author cjhao
|
||||
* @date 2024/9/3 23:41
|
||||
*/
|
||||
public static function getNearbyCity($longitude,$latitude)
|
||||
{
|
||||
//用st_distance_sphere函数计算两点记录,单位米,这里换成千米
|
||||
$field = 'id,city_id,name,0 as distance,gcj02_lng as longitude,gcj02_lat as latitude';
|
||||
if($longitude && $latitude){
|
||||
//用st_distance_sphere函数计算两点记录,单位米,这里换成千米
|
||||
$field = 'id,city_id,name,round(st_distance_sphere(point('.$longitude.','.$latitude.'),
|
||||
point(gcj02_lng, gcj02_lat))/1000,2) as distance,'.$longitude.' as longitude,'.$latitude.' as latitude';
|
||||
}
|
||||
|
||||
$cityLists = City::field($field)
|
||||
->append(['distance_desc'])
|
||||
->order('distance asc')
|
||||
->hidden(['distance'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $cityLists;
|
||||
|
||||
}
|
||||
}
|
||||
77
server/app/common/logic/CoachAccountLogLogic.php
Executable file
77
server/app/common/logic/CoachAccountLogLogic.php
Executable file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\model\accountLog\AccountLog;
|
||||
use app\common\model\accountLog\CoachAccountLog;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class CoachAccountLogLogic extends BaseLogic
|
||||
{
|
||||
/**
|
||||
* @notes 添加账户流水记录
|
||||
* @param $userId //会员ID
|
||||
* @param $changeObject //变动对象
|
||||
* @param $changeType //变动类型
|
||||
* @param $action //变动动作
|
||||
* @param $changeAmount //变动数量
|
||||
* @param string $associationSn //关联单号
|
||||
* @param string $remark //备注
|
||||
* @param array $feature //预留字段,方便存更多其它信息
|
||||
* @return bool
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:15 下午
|
||||
*/
|
||||
public static function add($coachId, $changeObject, $changeType, $action, $changeAmount, $associationSn = '', $adminId = '',$remark = '', $feature = [])
|
||||
{
|
||||
// 取用户信息
|
||||
$coach = (new Coach())->findOrEmpty($coachId);
|
||||
if ($coach->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
// 取变动对象
|
||||
// $changeObject = CoachAccountLogEnum::getChangeTypeDesc($changeType);
|
||||
// if (!$changeObject) {
|
||||
// return false;
|
||||
// }
|
||||
$leftAmount = $coach->money;
|
||||
if(in_array($changeType,CoachAccountLogEnum::DEPOSIT_DESC)){
|
||||
$leftAmount = $coach->deposit;
|
||||
}
|
||||
$data = [
|
||||
'sn' => generate_sn((new CoachAccountLog()), 'sn', 20),
|
||||
'coach_id' => $coachId,
|
||||
'change_object' => $changeObject,
|
||||
'change_type' => $changeType,
|
||||
'action' => $action,
|
||||
'left_amount' => $leftAmount,
|
||||
'change_amount' => $changeAmount,
|
||||
'association_sn'=> $associationSn,
|
||||
'remark' => $remark,
|
||||
'feature' => $feature ? json_encode($feature, JSON_UNESCAPED_UNICODE) : '',
|
||||
'admin_id' => $adminId
|
||||
];
|
||||
CoachAccountLog::create($data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
341
server/app/common/logic/CoachLogic.php
Executable file
341
server/app/common/logic/CoachLogic.php
Executable file
@@ -0,0 +1,341 @@
|
||||
<?php
|
||||
namespace app\common\logic;
|
||||
use app\common\enum\coach\CoachEnum;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\coach\CoachServerTime;
|
||||
use app\common\model\deposit\DepositPackage;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\goods\GoodsComment;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\shop\Shop;
|
||||
use app\common\service\ConfigService;
|
||||
use DateTime;
|
||||
use think\Exception;
|
||||
|
||||
/**
|
||||
* 技师逻辑类
|
||||
* Class CoachLogic
|
||||
* @package app\common\logic
|
||||
*/
|
||||
class CoachLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取技师订单时间
|
||||
* @param int $coachId
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
* @author cjhao
|
||||
* @date 2024/9/8 17:36
|
||||
*/
|
||||
public static function getCoachOrderAppoint(int $coachId)
|
||||
{
|
||||
$appointOrderList = Order::where(['coach_id'=>$coachId])
|
||||
->where('order_status','not in',[OrderEnum::ORDER_STATUS_SERVER_FINISH,OrderEnum::ORDER_STATUS_CLOSE])
|
||||
->column('id,appoint_time,total_duration,server_finish_time');
|
||||
$appointLists = [];
|
||||
foreach ($appointOrderList as $appointOrder)
|
||||
{
|
||||
$appointTime = $appointOrder['appoint_time'];
|
||||
$totalDuration = $appointOrder['total_duration'];
|
||||
$dateTime = new DateTime(date('Y-m-d H:i:s',$appointTime));
|
||||
if(30 < $dateTime->format('i') && 0 != $dateTime->format('i')){
|
||||
$dateTime->modify('+30 minutes');
|
||||
}
|
||||
if($dateTime->format('i') > 30 ){
|
||||
$surplusMinute = 60 - $dateTime->format('i');
|
||||
$dateTime->modify('+'.$surplusMinute.' minutes');
|
||||
}
|
||||
$dateHi = $dateTime->format('H:i');
|
||||
$dateMd = $dateTime->format('m-d');
|
||||
|
||||
$appointLists[$dateMd][] = $dateHi;
|
||||
$nums = intval($totalDuration / 30);
|
||||
|
||||
for ($i = 0;$nums > $i;$i++){
|
||||
$dateHi = $dateTime->format('H:i');
|
||||
//特殊时段,跨天
|
||||
if( "23:00" == $dateHi){
|
||||
$dateTime->modify('+1 day');
|
||||
}
|
||||
$dateTime->modify('+30 minutes');
|
||||
$dateMd = $dateTime->format('m-d');
|
||||
$dateHi = $dateTime->format('H:i');
|
||||
$appointLists[$dateMd][] = $dateHi;
|
||||
|
||||
}
|
||||
}
|
||||
return $appointLists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取技师的服务时间
|
||||
* @param $coachId
|
||||
* @param $coachId
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author cjhao
|
||||
* @date 2024/9/9 14:38
|
||||
*/
|
||||
public static function getCoachServerTime($coachId,$goodsId = 0)
|
||||
{
|
||||
$advanceAppoint = ConfigService::get('server_setting', 'advance_appoint');
|
||||
$timestampLists[date('m-d',time())] = time()+60*60;
|
||||
for ($i = 1;$i < $advanceAppoint;$i++){
|
||||
$timestampLists[date('m-d',strtotime('+ '.$i.' days'))] = strtotime('+ '.$i.' days midnight');
|
||||
}
|
||||
|
||||
$intervalsLists = [];
|
||||
foreach ($timestampLists as $date => $timestamp){
|
||||
$intervalsLists[$date] = get_hour_to_midnight($timestamp);
|
||||
}
|
||||
//订单预约时间
|
||||
$orderAppointLists = CoachLogic::getCoachOrderAppoint($coachId);
|
||||
//师傅空闲时间
|
||||
$serverTimeLists = [];
|
||||
//师傅忙碌时间
|
||||
$serverTimeBusyLists = [];
|
||||
$coachServerTime = CoachServerTime::where(['coach_id'=>$coachId])
|
||||
->field('date,time,status')
|
||||
->select();
|
||||
foreach ($coachServerTime as $time)
|
||||
{
|
||||
if(1 == $time['status']){
|
||||
$serverTimeLists[$time['date']][] = $time['time'];
|
||||
}else{
|
||||
$serverTimeBusyLists[$time['date']][] = $time['time'];
|
||||
}
|
||||
}
|
||||
$nowMd = date('m-d');
|
||||
//往后一个小时可预约
|
||||
$nowHi = date('H:i',strtotime('+1 hour'));
|
||||
$goods = [];
|
||||
if($goodsId){
|
||||
$goods = Goods::where(['id'=>$goodsId])->field('appoint_start_time,appoint_end_time')->findOrEmpty()->toArray();
|
||||
$appointMd = date('m-d',convert_to_time($goods['appoint_end_time']));
|
||||
$goods['appoint_start_time'] = date('H:i',convert_to_time($goods['appoint_start_time']));
|
||||
$goods['appoint_end_time'] = date('H:i',convert_to_time($goods['appoint_end_time']));
|
||||
if( '00:00' == $goods['appoint_end_time'] && $nowMd != $appointMd){
|
||||
$goods['appoint_end_time'] = "24:00";
|
||||
}
|
||||
}
|
||||
foreach ($intervalsLists as $date => $intervals){
|
||||
|
||||
foreach ($intervals as $key => $interval){
|
||||
$orderAppoint = $orderAppointLists[$date] ?? [];
|
||||
$serverTime = $serverTimeLists[$date] ?? [];
|
||||
$serverTimeBusy = $serverTimeBusyLists[$date]?? [];
|
||||
// $intervalsLists[$date][$key]['status'] = 0;
|
||||
//(不在服务时间)
|
||||
|
||||
//空闲时间
|
||||
if(in_array($interval['time'],$serverTime) || empty($serverTime)){
|
||||
$intervals[$key]['status'] = 1;
|
||||
}
|
||||
//忙
|
||||
if(in_array($interval['time'],$serverTimeBusy)){
|
||||
$intervals[$key]['status'] = 2;
|
||||
}
|
||||
//已预约
|
||||
if(in_array($interval['time'],$orderAppoint)){
|
||||
$intervals[$key]['status'] = 3;
|
||||
}
|
||||
if($goods){
|
||||
if($goods['appoint_start_time'] > $interval['time'] || $goods['appoint_end_time'] < $interval['time']){
|
||||
// $intervalsLists[$date][$key]['status'] = 4;
|
||||
unset($intervals[$key]);
|
||||
}
|
||||
}
|
||||
//不可预约4(超过当前时间,或者不在服务时间)
|
||||
// if($date == $nowMd){
|
||||
// if($nowHi > $interval['time']){
|
||||
// $intervalsLists[$date][$key]['status'] = 4;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
// if(empty($intervals)){
|
||||
// unset($intervalsLists[$date]);
|
||||
// }else{
|
||||
$intervalsLists[$date] = array_values($intervals);
|
||||
// }
|
||||
}
|
||||
return $intervalsLists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取空闲技师
|
||||
* @param $coachId :技师
|
||||
* @param $startTime :空闲开始时间段
|
||||
* @param $endTime :空闲结束时间段
|
||||
* @return array
|
||||
* @author cjhao
|
||||
* @date 2024/10/9 16:37
|
||||
*/
|
||||
public static function getLeisureCoach(int $coachId = 0,int $startTime = 0,int $endTime = 0,$order = [],$keyword = '')
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['audit_status','=',CoachEnum::AUDIT_STATUS_PASS];
|
||||
$where[] = ['work_status','=',CoachEnum::WORK_STATUS_ONLINE];
|
||||
$where[] = ['server_status','=',CoachEnum::WORK_STATUS_NORMAL];
|
||||
if($coachId){
|
||||
$where[] = ['id','<>',$coachId];
|
||||
}
|
||||
if($keyword){
|
||||
$where[] = ['name','like','%'.$keyword.'%'];
|
||||
}
|
||||
$longitude = $order['address_snap']['longitude'];
|
||||
$latitude = $order['address_snap']['latitude'];
|
||||
|
||||
$coachLists = Coach::where($where)
|
||||
->field('id,order_num,work_photo,good_comment,location,name,longitude,latitude,longitude_location,latitude_location')
|
||||
->select()->toArray();
|
||||
$coachServerScope = ConfigService::get('server_setting', 'coach_server_scope');
|
||||
$startTimeDay = date('m-d',$startTime);
|
||||
$endTimeDay = date('m-d',$endTime);
|
||||
$startTimeHour = date('H:i',$startTime);
|
||||
$endTimeHour = date('H:i',$endTime);
|
||||
$leisureLists = [];
|
||||
foreach ($coachLists as $key => $coach){
|
||||
$filed = 'round(st_distance_sphere(point('.$longitude.','.$latitude.'),
|
||||
point(longitude_location, latitude_location))/1000,2) as distance';
|
||||
if(empty($coach['longitude_location'])){
|
||||
$filed = 'round(st_distance_sphere(point('.$longitude.','.$latitude.'),
|
||||
point(longitude, latitude))/1000,2) as distance';
|
||||
}
|
||||
$distance = Coach::where(['id'=>$coach['id']])
|
||||
->value($filed);
|
||||
if(empty($distance)){
|
||||
continue;
|
||||
}
|
||||
if($distance > $coachServerScope){
|
||||
continue;
|
||||
}
|
||||
$coachServerLists = self::getCoachServerTime($coach['id']);
|
||||
$startTimeLists = $coachServerLists[$startTimeDay] ?? [];
|
||||
$endTimeLists = $coachServerLists[$endTimeDay] ?? [];
|
||||
$startTimeLists = array_column($startTimeLists,null,'time');
|
||||
$endTimeLists = array_column($endTimeLists,null,'time');
|
||||
$startTimeData = $startTimeLists[$startTimeHour] ?? [];
|
||||
$endTimeData = $endTimeLists[$endTimeHour] ?? [];
|
||||
if(empty($startTimeData)){
|
||||
continue;
|
||||
}
|
||||
if(1 != $startTimeData['status'] && 1 != $endTimeData['status']){
|
||||
continue;
|
||||
}
|
||||
$coach['wait_serve_num'] = Order::where(['coach_id'=>$coach['id']])
|
||||
->where('order_status','>',OrderEnum::ORDER_STATUS_WAIT_RECEIVING)
|
||||
->where('order_status','<',OrderEnum::ORDER_STATUS_SERVER_FINISH)
|
||||
->count();
|
||||
$leisureLists[] = $coach;
|
||||
}
|
||||
return $leisureLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes
|
||||
* @param int $coachId
|
||||
* @return string
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author cjhao
|
||||
* @date 2024/11/22 17:43
|
||||
*/
|
||||
public static function getLatelyLeisureTime(int $coachId)
|
||||
{
|
||||
$serverTime = self::getCoachServerTime($coachId);
|
||||
$today = date('m-d');
|
||||
if(isset($serverTime[$today])){
|
||||
return $serverTime[$today][0]['time'] ?? '';
|
||||
}
|
||||
$tomorrow = date('m-d',strtotime("+1 day"));
|
||||
if(isset($serverTime[$tomorrow])){
|
||||
return '明天:'.$serverTime[$tomorrow][0]['time'] ?? '';
|
||||
}
|
||||
$dayafter = date('m-d',strtotime("+2 day"));
|
||||
if(isset($serverTime[$dayafter])){
|
||||
return '后天:'.$serverTime[$dayafter][0]['time'] ?? '';
|
||||
}
|
||||
$dayKey = array_key_first($serverTime);
|
||||
$time = $serverTime[$dayKey][0]['time'];
|
||||
return $dayKey.' '.$time;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 验证技师的接单数量
|
||||
* @param $coach
|
||||
* @return void
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author cjhao
|
||||
* @date 2024/11/26 23:44
|
||||
*/
|
||||
public static function ckechCoachTakeOrderNum($coach){
|
||||
$deposit = $coach['deposit'];
|
||||
$depositPackageLists = [];
|
||||
|
||||
$takeOrderNum = ConfigService::get('server_setting', 'shop_order_limit');
|
||||
if($coach['shop_id']){
|
||||
$deposit = Shop::where(['id'=>$coach['shop_id']])->value('deposit');
|
||||
$where[] = ['type','=',2];
|
||||
$orderNum = Order::where(['shop_id'=>$coach['shop_id'],'coach_id'=>$coach['id']])
|
||||
->where('order_status','in',[OrderEnum::ORDER_STATUS_WAIT_DEPART,OrderEnum::ORDER_STATUS_DEPART,OrderEnum::ORDER_STATUS_ARRIVE,OrderEnum::ORDER_STATUS_START_SERVER,OrderEnum::ORDER_STATUS_SERVER_FINISH])
|
||||
->whereDay('create_time')->count();
|
||||
}else{
|
||||
$where[] = ['type','=',1];
|
||||
$orderNum = Order::where(['coach_id'=>$coach['id']])
|
||||
->where('order_status','in',[OrderEnum::ORDER_STATUS_WAIT_DEPART,OrderEnum::ORDER_STATUS_DEPART,OrderEnum::ORDER_STATUS_ARRIVE,OrderEnum::ORDER_STATUS_START_SERVER,OrderEnum::ORDER_STATUS_SERVER_FINISH])
|
||||
->whereDay('create_time')->count();
|
||||
}
|
||||
$depositPackageLists = DepositPackage::where($where)->order('money desc')->select()->toArray();
|
||||
//套餐列表
|
||||
$depositPackageTakeOrderNum = 0;
|
||||
foreach ($depositPackageLists as $depositPackage){
|
||||
if($deposit >= $depositPackage['money']){
|
||||
$depositPackageTakeOrderNum = $depositPackage['order_limit'];
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
$takeOrderNum += $depositPackageTakeOrderNum;
|
||||
if($orderNum >= $takeOrderNum){
|
||||
throw new Exception('今日接单数量已达上限');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 更新技师评论分数
|
||||
* @param $coachId
|
||||
* @return true
|
||||
* @author cjhao
|
||||
* @date 2024/12/6 12:30
|
||||
*/
|
||||
public static function updateCoachComment($coachId)
|
||||
{
|
||||
//技师的好评
|
||||
$allComment = GoodsComment::where(['coach_id'=>$coachId])->count();
|
||||
$goodsComment = GoodsComment::where(['coach_id'=>$coachId])
|
||||
->where('service_comment','>=',3)
|
||||
->count();
|
||||
$coachGoodsComment = 0;
|
||||
if($goodsComment){
|
||||
$coachGoodsComment = round($goodsComment/$allComment,2) * 100;
|
||||
}
|
||||
//更新技师的好评率
|
||||
Coach::update(['good_comment'=>$coachGoodsComment],['id'=>$coachId]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
77
server/app/common/logic/CoachPayNotifyLogic.php
Executable file
77
server/app/common/logic/CoachPayNotifyLogic.php
Executable file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | LikeShop100%开源免费商用电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | Gitee下载:https://gitee.com/likeshop_gitee/likeshop
|
||||
// | 访问官网:https://www.likemarket.net
|
||||
// | 访问社区:https://home.likemarket.net
|
||||
// | 访问手册:http://doc.likemarket.net
|
||||
// | 微信公众号:好象科技
|
||||
// | 好象科技开发团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// | Author: LikeShopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\deposit\DepositOrder;
|
||||
use app\common\model\shop\Shop;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 支付成功后处理订单状态
|
||||
* Class PayNotifyLogic
|
||||
* @package app\api\logic
|
||||
*/
|
||||
class CoachPayNotifyLogic extends BaseLogic
|
||||
{
|
||||
public static function handle($action, $orderSn, $extra = [])
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
self::$action($orderSn, $extra);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write(implode('-', [
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
$e->getFile(),
|
||||
$e->getLine(),
|
||||
$e->getMessage()
|
||||
]));
|
||||
self::setError($e->getMessage());
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
private static function deposit($orderSn, $extra = []){
|
||||
$order = DepositOrder::where('sn', $orderSn)->findOrEmpty()->toArray();
|
||||
// 增加用户累计充值金额及用户余额
|
||||
Coach::update([
|
||||
'deposit' => ['inc',$order['order_amount']],
|
||||
],['id'=>$order['relation_id']]);
|
||||
|
||||
// 记录账户流水
|
||||
CoachAccountLogLogic::add($order['relation_id'], CoachAccountLogEnum::DEPOSIT,CoachAccountLogEnum::RECHARGE_INC_DEPOSIT,CoachAccountLogEnum::INC, $order['order_amount'], $order['sn']);
|
||||
|
||||
// 更新充值订单状态
|
||||
DepositOrder::update([
|
||||
'transaction_id' => $extra['transaction_id'] ?? '',
|
||||
'pay_status' => PayEnum::ISPAID,
|
||||
'pay_time' => time(),
|
||||
],['id'=>$order['id']]);
|
||||
}
|
||||
|
||||
}
|
||||
215
server/app/common/logic/NoticeLogic.php
Executable file
215
server/app/common/logic/NoticeLogic.php
Executable file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\notice\NoticeRecord;
|
||||
use app\common\model\notice\NoticeSetting;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\user\User;
|
||||
use app\common\service\sms\SmsMessageService;
|
||||
use app\common\service\WechatMessageService;
|
||||
|
||||
|
||||
/**
|
||||
* 通知逻辑层
|
||||
* Class NoticeLogic
|
||||
* @package app\common\logic
|
||||
*/
|
||||
class NoticeLogic extends BaseLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 根据场景发送短信
|
||||
* @param $params
|
||||
* @return bool
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 15:28
|
||||
*/
|
||||
public static function noticeByScene($params)
|
||||
{
|
||||
try {
|
||||
$noticeSetting = NoticeSetting::where('scene_id', $params['scene_id'])->findOrEmpty()->toArray();
|
||||
if (empty($noticeSetting)) {
|
||||
throw new \Exception('找不到对应场景的配置');
|
||||
}
|
||||
// 合并额外参数
|
||||
$params = self::mergeParams($params);
|
||||
$res = false;
|
||||
self::setError('发送通知失败');
|
||||
|
||||
// 短信通知
|
||||
if (isset($noticeSetting['sms_notice']['status']) && $noticeSetting['sms_notice']['status'] == YesNoEnum::YES) {
|
||||
$res = (new SmsMessageService())->send($params);
|
||||
}
|
||||
// 公众号消息
|
||||
if (isset($noticeSetting['oa_notice']['status']) && $noticeSetting['oa_notice']['status'] == YesNoEnum::YES) {
|
||||
$res = (new WechatMessageService($params['params']['user_id'], NoticeEnum::OA))->send($params);
|
||||
}
|
||||
// 微信小程序
|
||||
if (isset($noticeSetting['mnp_notice']['status']) && $noticeSetting['mnp_notice']['status'] == YesNoEnum::YES) {
|
||||
$res = (new WechatMessageService($params['params']['user_id'], NoticeEnum::MNP))->send($params);
|
||||
}
|
||||
|
||||
return $res;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 整理参数
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 15:28
|
||||
*/
|
||||
public static function mergeParams($params)
|
||||
{
|
||||
|
||||
// 订单相关
|
||||
if(!empty($params['params']['order_id'])) {
|
||||
$order = Order::where(['id'=>$params['params']['order_id']])->append(['appoint_time','appoint_date'])->findOrEmpty()->toArray();
|
||||
|
||||
$params['params']['order_sn'] = $order['sn'];
|
||||
$params['params']['create_time'] = $order['create_time'];
|
||||
$params['params']['pay_time'] = $order['pay_time'];
|
||||
$params['params']['order_amount'] = $order['order_amount'];
|
||||
$params['params']['mobile'] = $params['params']['mobile'] ?? $order['address_snap']['mobile'];
|
||||
|
||||
$params['params']['appoint_time'] = $order['appoint_date'].' '.$order['appoint_time'];
|
||||
}
|
||||
// 用户相关
|
||||
if (!empty($params['params']['user_id'])) {
|
||||
$user = User::findOrEmpty($params['params']['user_id'])->toArray();
|
||||
$params['params']['nickname'] = $user['nickname'];
|
||||
$params['params']['user_name'] = $user['nickname'];
|
||||
$params['params']['user_sn'] = $user['sn'];
|
||||
$params['params']['mobile'] = $params['params']['mobile'] ?? $user['mobile'];
|
||||
}
|
||||
// 师傅相关
|
||||
if (!empty($params['params']['coach_id'])) {
|
||||
$coach = Coach::findOrEmpty($params['params']['coach_id'])->toArray();
|
||||
$params['params']['staff_name'] = $coach['name'];
|
||||
// 入驻申请通知平台
|
||||
if ($params['scene_id'] != NoticeEnum::STAFF_APPLY_NOTICE_PLATFORM) {
|
||||
$params['params']['mobile'] = $coach['mobile'];
|
||||
}
|
||||
}
|
||||
// 跳转路径
|
||||
$jumpPath = self::getPathByScene($params['scene_id'], $params['params']['order_id'] ?? 0);
|
||||
$params['url'] = $jumpPath['url'];
|
||||
$params['page'] = $jumpPath['page'];
|
||||
return $params;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 根据场景获取跳转链接
|
||||
* @param $sceneId
|
||||
* @param $extraId
|
||||
* @return string[]
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 15:29
|
||||
*/
|
||||
public static function getPathByScene($sceneId, $extraId)
|
||||
{
|
||||
// 小程序主页路径
|
||||
$page = '/pages/index/index';
|
||||
// 公众号主页路径
|
||||
$url = '/mobile/pages/index/index';
|
||||
return [
|
||||
'url' => $url,
|
||||
'page' => $page,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 替换消息内容中的变量占位符
|
||||
* @param $content
|
||||
* @param $params
|
||||
* @return array|mixed|string|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 15:29
|
||||
*/
|
||||
public static function contentFormat($content, $params)
|
||||
{
|
||||
foreach ($params['params'] as $k => $v) {
|
||||
$search = '{' . $k . '}';
|
||||
$content = str_replace($search, $v, $content);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加通知记录
|
||||
* @param $params
|
||||
* @param $noticeSetting
|
||||
* @param $sendType
|
||||
* @param $content
|
||||
* @param string $extra
|
||||
* @return NoticeRecord|\think\Model
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 15:29
|
||||
*/
|
||||
public static function addNotice($params, $noticeSetting, $sendType, $content, $extra = '')
|
||||
{
|
||||
return NoticeRecord::create([
|
||||
'user_id' => $params['params']['user_id'] ?? 0,
|
||||
'title' => self::getTitleByScene($sendType, $noticeSetting),
|
||||
'content' => $content,
|
||||
'scene_id' => $noticeSetting['scene_id'],
|
||||
'read' => YesNoEnum::NO,
|
||||
'recipient' => $noticeSetting['recipient'],
|
||||
'send_type' => $sendType,
|
||||
'notice_type' => $noticeSetting['type'],
|
||||
'extra' => $extra,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 通知记录标题
|
||||
* @param $sendType
|
||||
* @param $noticeSetting
|
||||
* @return string
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 15:30
|
||||
*/
|
||||
public static function getTitleByScene($sendType, $noticeSetting)
|
||||
{
|
||||
switch ($sendType) {
|
||||
case NoticeEnum::SMS:
|
||||
$title = '';
|
||||
break;
|
||||
case NoticeEnum::OA:
|
||||
$title = $noticeSetting['oa_notice']['name'] ?? '';
|
||||
break;
|
||||
case NoticeEnum::MNP:
|
||||
$title = $noticeSetting['mnp_notice']['name'] ?? '';
|
||||
break;
|
||||
default:
|
||||
$title = '';
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
|
||||
}
|
||||
54
server/app/common/logic/OrderLogLogic.php
Executable file
54
server/app/common/logic/OrderLogLogic.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
|
||||
use app\common\enum\OrderLogEnum;
|
||||
use app\common\model\order\OrderLog;
|
||||
|
||||
class OrderLogLogic extends BaseLogic
|
||||
{
|
||||
/**
|
||||
* @notes 订单日志
|
||||
* @param int $type 类型:1-系统;2-后台;3-用户;
|
||||
* @param int $channel 渠道编号。变动方式
|
||||
* @param int $order_id 订单id
|
||||
* @param int $operator_id 操作人id
|
||||
* @param string $content 日志内容
|
||||
* @author ljj
|
||||
* @date 2022/2/11 3:37 下午
|
||||
*/
|
||||
public function record(int $type,int $channel,int $order_id,int $operator_id = 0,string $content = '',$location = [],$extra = [])
|
||||
{
|
||||
OrderLog::create([
|
||||
'type' => $type,
|
||||
'channel' => $channel,
|
||||
'order_id' => $order_id,
|
||||
'operator_id' => $operator_id,
|
||||
'content' => $content ?: OrderLogEnum::getRecordDesc($channel),
|
||||
'longitude' => $location['longitude'] ?? '',
|
||||
'latitude' => $location['latitude'] ?? '',
|
||||
'location' => $location,
|
||||
'extra' => $extra,
|
||||
'create_time' => time(),
|
||||
'update_time' => time(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
255
server/app/common/logic/PayNotifyLogic.php
Executable file
255
server/app/common/logic/PayNotifyLogic.php
Executable file
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | LikeShop100%开源免费商用电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | Gitee下载:https://gitee.com/likeshop_gitee/likeshop
|
||||
// | 访问官网:https://www.likemarket.net
|
||||
// | 访问社区:https://home.likemarket.net
|
||||
// | 访问手册:http://doc.likemarket.net
|
||||
// | 微信公众号:好象科技
|
||||
// | 好象科技开发团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// | Author: LikeShopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\enum\accountLog\ShopAccountLogEnum;
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\OrderLogEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\accountLog\CoachAccountLog;
|
||||
use app\common\model\accountLog\ShopAccountLog;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\deposit\DepositOrder;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\order\OrderAppend;
|
||||
use app\common\model\order\OrderGap;
|
||||
use app\common\model\RechargeOrder;
|
||||
use app\common\model\shop\Shop;
|
||||
use app\common\model\user\User;
|
||||
use app\common\service\ConfigService;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 支付成功后处理订单状态
|
||||
* Class PayNotifyLogic
|
||||
* @package app\api\logic
|
||||
*/
|
||||
class PayNotifyLogic extends BaseLogic
|
||||
{
|
||||
public static function handle($action, $orderSn, $extra = [])
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
self::$action($orderSn, $extra);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write(implode('-', [
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
$e->getFile(),
|
||||
$e->getLine(),
|
||||
$e->getMessage()
|
||||
]));
|
||||
self::setError($e->getMessage());
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 调用回调方法统一处理 更新订单支付状态
|
||||
* @param $orderSn
|
||||
* @param array $extra
|
||||
* @author ljj
|
||||
* @date 2022/3/1 11:35 上午
|
||||
*/
|
||||
public static function order($orderSn, $extra = [])
|
||||
{
|
||||
$order = Order::with(['order_goods'])->where(['sn' => $orderSn])->findOrEmpty();
|
||||
//更新订单状态
|
||||
Order::update([
|
||||
'pay_status' => PayEnum::ISPAID,
|
||||
'pay_time' => time(),
|
||||
'order_status' => OrderEnum::ORDER_STATUS_WAIT_RECEIVING,
|
||||
'transaction_id' => $extra['transaction_id'] ?? ''
|
||||
], ['id' => $order['id']]);
|
||||
|
||||
//添加订单日志
|
||||
(new OrderLogLogic())->record(OrderLogEnum::TYPE_USER,OrderLogEnum::USER_PAY_ORDER,$order['id'],$order['user_id']);
|
||||
//通知师傅接单
|
||||
event('Notice', [
|
||||
'scene_id' => NoticeEnum::ACCEPT_ORDER_NOTICE_STAFF,
|
||||
'params' => [
|
||||
'coach_id' => $order['coach_id'],
|
||||
'order_id' => $order['id']
|
||||
]
|
||||
]);
|
||||
// 订单付款通知 - 通知买家
|
||||
event('Notice', [
|
||||
'scene_id' => NoticeEnum::ORDER_PAY_NOTICE,
|
||||
'params' => [
|
||||
'user_id' => $order['user_id'],
|
||||
'order_id' => $order['id']
|
||||
]
|
||||
]);
|
||||
|
||||
//通知平台
|
||||
$mobile = ConfigService::get('platform', 'mobile','');
|
||||
if($mobile){
|
||||
event('Notice', [
|
||||
'scene_id' => NoticeEnum::ORDER_PAY_NOTICE_PLATFORM,
|
||||
'params' => [
|
||||
'mobile' => $mobile,
|
||||
'order_id' => $order['id']
|
||||
]
|
||||
]);
|
||||
}
|
||||
foreach ($order['order_goods'] as $order_goods){
|
||||
Goods::update(['order_num'=>['inc',$order_goods['goods_num']]],['id'=>$order_goods['goods_id']]);
|
||||
}
|
||||
|
||||
// 订单付款通知 - 通知卖家
|
||||
// $mobile = ConfigService::get('website', 'mobile');
|
||||
// if (!empty($mobile)) {
|
||||
// event('Notice', [
|
||||
// 'scene_id' => NoticeEnum::ORDER_PAY_NOTICE_PLATFORM,
|
||||
// 'params' => [
|
||||
// 'mobile' => $mobile,
|
||||
// 'order_id' => $order['id']
|
||||
// ]
|
||||
// ]);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 订单差价
|
||||
* @param $orderSn
|
||||
* @param $extra
|
||||
* @return void
|
||||
* @author cjhao
|
||||
* @date 2024/9/19 01:54
|
||||
*/
|
||||
private static function orderGap($orderSn, $extra = []){
|
||||
$orderGap = OrderGap::where(['sn' => $orderSn])->findOrEmpty();
|
||||
//更新订单状态
|
||||
OrderGap::update([
|
||||
'pay_status' => PayEnum::ISPAID,
|
||||
'pay_time' => time(),
|
||||
'transaction_id' => $extra['transaction_id'] ?? ''
|
||||
], ['id' => $orderGap['id']]);
|
||||
Order::where(['id'=>$orderGap['order_id']])->update([
|
||||
// 'total_amount' => Db::raw('total_amount+'.$orderGap['order_amount']),
|
||||
'total_order_amount' => Db::raw('total_order_amount+'.$orderGap['order_amount']),
|
||||
'total_gap_amount' => Db::raw('total_gap_amount+'.$orderGap['order_amount'])
|
||||
]);
|
||||
//添加订单日志
|
||||
(new OrderLogLogic())->record(OrderLogEnum::TYPE_USER,OrderLogEnum::USER_PAY_ORDER_GAP,$orderGap['order_id'],$orderGap['user_id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 订单差价
|
||||
* @param $orderSn
|
||||
* @param $extra
|
||||
* @return void
|
||||
* @author cjhao
|
||||
* @date 2024/9/19 01:54
|
||||
*/
|
||||
private static function orderAppend($orderSn, $extra = []){
|
||||
$orderAppend = OrderAppend::where(['sn' => $orderSn])->findOrEmpty();
|
||||
//更新订单状态
|
||||
OrderAppend::update([
|
||||
'pay_status' => PayEnum::ISPAID,
|
||||
'pay_time' => time(),
|
||||
'transaction_id' => $extra['transaction_id'] ?? ''
|
||||
], ['id' => $orderAppend['id']]);
|
||||
Order::where(['id'=>$orderAppend['order_id']])->update([
|
||||
// 'total_amount' => Db::raw('total_amount+'.$orderAppend['order_amount']),
|
||||
'total_order_amount' => Db::raw('total_order_amount+'.$orderAppend['order_amount']),
|
||||
'total_append_amount' => Db::raw('total_append_amount+'.$orderAppend['order_amount'])
|
||||
]);
|
||||
//添加订单日志
|
||||
(new OrderLogLogic())->record(OrderLogEnum::TYPE_USER,OrderLogEnum::USER_PAY_ORDER_APPEND,$orderAppend['order_id'],$orderAppend['user_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 充值回调
|
||||
* @param $orderSn
|
||||
* @param array $extra
|
||||
* @author ljj
|
||||
* @date 2022/12/26 5:00 下午
|
||||
*/
|
||||
public static function recharge($orderSn, $extra = [])
|
||||
{
|
||||
$order = RechargeOrder::where('sn', $orderSn)->findOrEmpty()->toArray();
|
||||
|
||||
// 增加用户累计充值金额及用户余额
|
||||
User::update([
|
||||
'user_money' => ['inc',$order['order_amount']],
|
||||
'total_recharge_amount' => ['inc',$order['order_amount']],
|
||||
],['id'=>$order['user_id']]);
|
||||
|
||||
// 记录账户流水
|
||||
AccountLogLogic::add($order['user_id'], AccountLogEnum::MONEY,AccountLogEnum::USER_RECHARGE_ADD_MONEY,AccountLogEnum::INC, $order['order_amount'], $order['sn']);
|
||||
|
||||
// 更新充值订单状态
|
||||
RechargeOrder::update([
|
||||
'transaction_id' => $extra['transaction_id'],
|
||||
'pay_status' => PayEnum::ISPAID,
|
||||
'pay_time' => time(),
|
||||
],['id'=>$order['id']]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes
|
||||
* @param $orderSn
|
||||
* @param $extra
|
||||
* @return void
|
||||
* @author cjhao
|
||||
* @date 2024/11/29 00:27
|
||||
*/
|
||||
private static function deposit($orderSn, $extra = []){
|
||||
$order = DepositOrder::where('sn', $orderSn)->findOrEmpty()->toArray();
|
||||
if(1 == $order['type']){
|
||||
Coach::update([
|
||||
'deposit' => ['inc',$order['order_amount']],
|
||||
],['id'=>$order['relation_id']]);
|
||||
|
||||
// 记录账户流水
|
||||
CoachAccountLog::add($order['relation_id'], CoachAccountLogEnum::DEPOSIT,CoachAccountLogEnum::RECHARGE_INC_DEPOSIT,CoachAccountLogEnum::INC, $order['order_amount'], $order['sn']);
|
||||
|
||||
}else{
|
||||
Shop::update([
|
||||
'deposit' => ['inc',$order['order_amount']],
|
||||
],['id'=>$order['relation_id']]);
|
||||
|
||||
// 记录账户流水
|
||||
ShopAccountLog::add($order['relation_id'], ShopAccountLogEnum::DEPOSIT,ShopAccountLogEnum::RECHARGE_INC_DEPOSIT,ShopAccountLogEnum::INC, $order['order_amount'], $order['sn']);
|
||||
|
||||
}
|
||||
// 增加用户累计充值金额及用户余额
|
||||
|
||||
// 更新充值订单状态
|
||||
DepositOrder::update([
|
||||
'transaction_id' => $extra['transaction_id'] ?? '',
|
||||
'pay_status' => PayEnum::ISPAID,
|
||||
'pay_time' => time(),
|
||||
],['id'=>$order['id']]);
|
||||
}
|
||||
|
||||
}
|
||||
235
server/app/common/logic/RefundLogic.php
Executable file
235
server/app/common/logic/RefundLogic.php
Executable file
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\OrderRefundEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\accountLog\AccountLog;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\order\OrderRefund;
|
||||
use app\common\model\order\OrderRefundLog;
|
||||
use app\common\model\user\User;
|
||||
use app\common\service\AliPayService;
|
||||
use app\common\service\WeChatConfigService;
|
||||
use app\common\service\WeChatPayService;
|
||||
|
||||
class RefundLogic extends BaseLogic
|
||||
{
|
||||
protected $refund;
|
||||
protected $refund_log;
|
||||
|
||||
/**
|
||||
* @notes 退款
|
||||
* @param $order
|
||||
* @param $refund_amount
|
||||
* @param $type
|
||||
* @param $operator_id
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
* @author ljj
|
||||
* @date 2022/2/15 5:05 下午
|
||||
*/
|
||||
public function refund($order, $refund_amount,$refund_car,$type,$orderType,$operator_id)
|
||||
{
|
||||
if ($refund_amount+$refund_car <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//生成退款记录
|
||||
$this->log($order,$refund_amount,$refund_car,$type,$orderType,$operator_id);
|
||||
$totalRefundAmount = round($refund_amount + $refund_car,2);
|
||||
//原路退款
|
||||
switch ($order['pay_way']) {
|
||||
//微信退款
|
||||
case PayEnum::WECHAT_PAY:
|
||||
$this->wechatRefund($order,$totalRefundAmount);
|
||||
break;
|
||||
//支付宝退款
|
||||
case PayEnum::ALI_PAY:
|
||||
$this->alipayRefund($order,$totalRefundAmount);
|
||||
break;
|
||||
case PayEnum::BALANCE_PAY:
|
||||
$this->balanceRefund($order,$totalRefundAmount,$orderType);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 退款记录
|
||||
* @param $order
|
||||
* @param $refund_amount
|
||||
* @param $type
|
||||
* @param $operator_id
|
||||
* @author ljj
|
||||
* @date 2022/2/15 3:49 下午
|
||||
*/
|
||||
public function log($order,$refund_amount,$refund_car,$type,$orderType,$operator_id)
|
||||
{
|
||||
if(1 == $orderType){
|
||||
|
||||
$orderId = $order['id'];
|
||||
$subOrderId = 0;
|
||||
}else{
|
||||
$orderId = $order['order_id'];
|
||||
$subOrderId = $order['id'] ;
|
||||
}
|
||||
|
||||
$refund = OrderRefund::create([
|
||||
'sn' => generate_sn(new OrderRefund(), 'sn'),
|
||||
'order_id' => $orderId,
|
||||
'sub_order_id' => $subOrderId,
|
||||
'user_id' => $order['user_id'],
|
||||
'order_amount' => $order['order_amount'],
|
||||
'refund_amount' => $refund_amount,
|
||||
'refund_car_amount' => $refund_car,
|
||||
'order_terminal' => $order['order_terminal'],
|
||||
'transaction_id' => $order['transaction_id'],
|
||||
'type' => $type,
|
||||
'order_type'=> $orderType
|
||||
]);
|
||||
|
||||
//退款日志
|
||||
$refund_log = OrderRefundLog::create([
|
||||
'sn' => generate_sn(new OrderRefundLog(), 'sn'),
|
||||
'refund_id' => $refund->id,
|
||||
'type' => $type,
|
||||
'operator_id' => $operator_id,
|
||||
]);
|
||||
|
||||
$this->refund = $refund;
|
||||
$this->refund_log = $refund_log;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 微信退款
|
||||
* @param $order
|
||||
* @param $refund_amount
|
||||
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
|
||||
* @author ljj
|
||||
* @date 2022/2/15 5:06 下午
|
||||
*/
|
||||
public function wechatRefund($order,$refund_amount)
|
||||
{
|
||||
//微信配置信息
|
||||
$wechatConfig = WeChatConfigService::getWechatConfigByTerminal($order['order_terminal']);
|
||||
if (!file_exists($wechatConfig['cert_path']) || !file_exists($wechatConfig['key_path'])) {
|
||||
throw new \Exception('微信证书不存在,请联系管理员!');
|
||||
}
|
||||
//发起退款
|
||||
$result = (new WeChatPayService($order['order_terminal']))->refund([
|
||||
'transaction_id' => $order['transaction_id'],
|
||||
'refund_sn' => $this->refund_log->sn,
|
||||
'total_fee' => $order['order_amount'] * 100,//订单金额,单位为分
|
||||
'refund_fee' => intval($refund_amount * 100),//退款金额
|
||||
]);
|
||||
|
||||
if ($result['return_code'] == 'FAIL' || $result['result_code'] == 'FAIL') {
|
||||
if ($result['err_code'] == 'SYSTEMERROR' || $result['err_code'] == 'BIZERR_NEED_RETRY') {
|
||||
return true;
|
||||
}
|
||||
|
||||
//更新退款日志记录
|
||||
OrderRefundLog::update([
|
||||
'wechat_refund_id' => $result['refund_id'] ?? 0,
|
||||
'refund_status' => OrderRefundEnum::STATUS_FAIL,
|
||||
'refund_msg' => json_encode($result, JSON_UNESCAPED_UNICODE),
|
||||
], ['id'=>$this->refund_log->id]);
|
||||
|
||||
//更新订单退款状态
|
||||
OrderRefund::update([
|
||||
'refund_status' => OrderRefundEnum::STATUS_FAIL,
|
||||
], ['id'=>$this->refund->id]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 支付宝退款
|
||||
* @param $order
|
||||
* @param $refund_amount
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
* @author ljj
|
||||
* @date 2024/3/21 4:55 下午
|
||||
*/
|
||||
public function alipayRefund($order,$refund_amount)
|
||||
{
|
||||
//原路退回到支付宝的情况
|
||||
$result = (new AliPayService())->refund($order['sn'], $refund_amount, $this->refund_log->sn);
|
||||
$result = (array)$result;
|
||||
|
||||
//更新退款日志记录
|
||||
OrderRefundLog::update([
|
||||
'refund_status' => ($result['code'] == '10000' && $result['msg'] == 'Success' && $result['fundChange'] == 'Y') ? 1 : 2,
|
||||
'refund_msg' => json_encode($result, JSON_UNESCAPED_UNICODE),
|
||||
], ['id'=>$this->refund_log->id]);
|
||||
|
||||
//更新订单退款状态
|
||||
OrderRefund::update([
|
||||
'refund_status' => ($result['code'] == '10000' && $result['msg'] == 'Success' && $result['fundChange'] == 'Y') ? 1 : 2,
|
||||
], ['id'=>$this->refund->id]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function balanceRefund($order,$refund_amount,$orderType)
|
||||
{
|
||||
$user = User::where(['id'=>$order['user_id']])->findOrEmpty();
|
||||
$user->user_money = round($user->user_money + $refund_amount,2);
|
||||
$user->save();
|
||||
$mainOrder = $order;
|
||||
if(1 != $orderType){
|
||||
$mainOrder = Order::where(['id'=>$order['order_id']])->findOrEmpty();
|
||||
}
|
||||
$changeType = AccountLogEnum::CANCEL_ORDER_ADD_MONEY;
|
||||
if(OrderEnum::ORDER_STATUS_SERVER_FINISH == $mainOrder['order_status'] && OrderEnum::ORDER_STATUS_SERVER_FINISH == $mainOrder['order_status']){
|
||||
$changeType = AccountLogEnum::REFUND_ORDER_ADD_MONEY;
|
||||
}
|
||||
|
||||
//
|
||||
AccountLogLogic::add(
|
||||
$user->id,
|
||||
AccountLogEnum::MONEY,
|
||||
$changeType,
|
||||
AccountLogEnum::INC,
|
||||
$refund_amount,
|
||||
$order['sn']);
|
||||
|
||||
//更新退款日志记录
|
||||
OrderRefundLog::update([
|
||||
'refund_status' => 1 ,
|
||||
'refund_msg' => '',
|
||||
], ['id'=>$this->refund_log->id]);
|
||||
|
||||
//更新订单退款状态
|
||||
OrderRefund::update([
|
||||
'refund_status' => 1,
|
||||
], ['id'=>$this->refund->id]);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
197
server/app/common/logic/RegionLogic.php
Executable file
197
server/app/common/logic/RegionLogic.php
Executable file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
|
||||
use app\common\model\city\City;
|
||||
use app\common\model\Region;
|
||||
|
||||
class RegionLogic extends BaseLogic
|
||||
{
|
||||
/**
|
||||
* @notes 地区
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/4/6 10:51 上午
|
||||
*/
|
||||
public function region($params)
|
||||
{
|
||||
$where = [];
|
||||
if(isset($params['keyword']) && $params['keyword']){
|
||||
$where[] = ['name','like','%'.$params['keyword'].'%'];
|
||||
}
|
||||
$lists = Region::where($where)->field('id,parent_id,level,name,short,city_code,zip_code,gcj02_lng,gcj02_lat,db09_lng,db09_lat,remark1,remark2')->select()->toArray();
|
||||
|
||||
$lists = linear_to_tree($lists,'sub','id','parent_id');
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 地级市列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/4/6 2:41 下午
|
||||
*/
|
||||
public function city($params)
|
||||
{
|
||||
$where = [];
|
||||
$where[] = ['level','=',2];
|
||||
if(isset($params['keyword']) && $params['keyword']){
|
||||
$where[] = ['name','like','%'.$params['keyword'].'%'];
|
||||
}
|
||||
$lists = City::where($where)
|
||||
->field('id,parent_id,level,name,gcj02_lng,gcj02_lat,db09_lng,db09_lat,city_id')
|
||||
->select()
|
||||
->toArray();
|
||||
$lists = self::groupByInitials($lists);
|
||||
unset($lists[null]);
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 二维数组根据首字母分组排序
|
||||
* @param array $data 二维数组
|
||||
* @param string $targetKey 首字母的键名
|
||||
* @return array 根据首字母关联的二维数组
|
||||
*/
|
||||
public function groupByInitials(array $data, $targetKey = 'name')
|
||||
{
|
||||
$data = array_map(function ($item) use ($targetKey) {
|
||||
return array_merge($item, [
|
||||
'initials' => $this->getInitials($item[$targetKey]),
|
||||
]);
|
||||
}, $data);
|
||||
$data = $this->sortInitials($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按字母排序
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function sortInitials(array $data)
|
||||
{
|
||||
$sortData = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$sortData[$value['initials']][] = $value;
|
||||
}
|
||||
ksort($sortData);
|
||||
return $sortData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首字母
|
||||
* @param string $str 汉字字符串
|
||||
* @return string 首字母
|
||||
*/
|
||||
public function getInitials($str)
|
||||
{
|
||||
if (empty($str)) {return '';}
|
||||
$fchar = ord($str[0]);
|
||||
if ($fchar >= ord('A') && $fchar <= ord('z')) {
|
||||
return strtoupper($str[0]);
|
||||
}
|
||||
|
||||
$s1 = iconv('UTF-8', 'GBK', $str);
|
||||
$s2 = iconv('GBK', 'UTF-8', $s1);
|
||||
$s = $s2 == $str ? $s1 : $str;
|
||||
$asc = ord($s[0]) * 256 + ord($s[1]) - 65536;
|
||||
if ($asc >= -20319 && $asc <= -20284) {
|
||||
return 'A';
|
||||
}
|
||||
if ($asc >= -20283 && $asc <= -19776) {
|
||||
return 'B';
|
||||
}
|
||||
if ($asc >= -19775 && $asc <= -19219) {
|
||||
return 'C';
|
||||
}
|
||||
if ($asc >= -19218 && $asc <= -18711) {
|
||||
return 'D';
|
||||
}
|
||||
if ($asc >= -18710 && $asc <= -18527) {
|
||||
return 'E';
|
||||
}
|
||||
if ($asc >= -18526 && $asc <= -18240) {
|
||||
return 'F';
|
||||
}
|
||||
if ($asc >= -18239 && $asc <= -17923) {
|
||||
return 'G';
|
||||
}
|
||||
if ($asc >= -17922 && $asc <= -17418) {
|
||||
return 'H';
|
||||
}
|
||||
if ($asc >= -17417 && $asc <= -16475) {
|
||||
return 'J';
|
||||
}
|
||||
if ($asc >= -16474 && $asc <= -16213) {
|
||||
return 'K';
|
||||
}
|
||||
if ($asc >= -16212 && $asc <= -15641) {
|
||||
return 'L';
|
||||
}
|
||||
if ($asc >= -15640 && $asc <= -15166) {
|
||||
return 'M';
|
||||
}
|
||||
if ($asc >= -15165 && $asc <= -14923) {
|
||||
return 'N';
|
||||
}
|
||||
if ($asc >= -14922 && $asc <= -14915) {
|
||||
return 'O';
|
||||
}
|
||||
if ($asc >= -14914 && $asc <= -14631) {
|
||||
return 'P';
|
||||
}
|
||||
if ($asc >= -14630 && $asc <= -14150) {
|
||||
return 'Q';
|
||||
}
|
||||
if ($asc >= -14149 && $asc <= -14091) {
|
||||
return 'R';
|
||||
}
|
||||
if ($asc >= -14090 && $asc <= -13319) {
|
||||
return 'S';
|
||||
}
|
||||
if ($asc >= -13318 && $asc <= -12839) {
|
||||
return 'T';
|
||||
}
|
||||
if ($asc >= -12838 && $asc <= -12557) {
|
||||
return 'W';
|
||||
}
|
||||
if ($asc >= -12556 && $asc <= -11848) {
|
||||
return 'X';
|
||||
}
|
||||
if ($asc >= -11847 && $asc <= -11056) {
|
||||
return 'Y';
|
||||
}
|
||||
if ($asc >= -11055 && $asc <= -10247) {
|
||||
return 'Z';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
69
server/app/common/logic/ShopAccountLogLogic.php
Executable file
69
server/app/common/logic/ShopAccountLogLogic.php
Executable file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\accountLog\ShopAccountLogEnum;
|
||||
use app\common\model\accountLog\CoachAccountLog;
|
||||
use app\common\model\accountLog\ShopAccountLog;
|
||||
use app\common\model\shop\Shop;
|
||||
|
||||
class ShopAccountLogLogic extends BaseLogic
|
||||
{
|
||||
/**
|
||||
* @param $shopId (店铺ID
|
||||
* @param $changeType (变动类型
|
||||
* @param $action (操作动作: [1=新增, 2=扣减])
|
||||
* @param $changeAmount (变动的值
|
||||
* @param string $sourceSn (来源编号)
|
||||
* @param string $remark (备注信息)
|
||||
* @param array $extra (扩展信息)
|
||||
* @param int $adminId (管理员ID)
|
||||
* @param array $flowUsage (token信息组)
|
||||
* @return CoachAccountLog|false|Model
|
||||
*/
|
||||
public static function add($shopId, $changeObject,$changeType, $action, $changeAmount, string $sourceSn = '', int $adminId = 0, string $remark = '', array $extra = []): bool|Model|ShopAccountLog
|
||||
{
|
||||
|
||||
// 取用户信息
|
||||
$shop = (new Shop())->findOrEmpty($shopId);
|
||||
if ($shop->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
$leftAmount = $shop->money;
|
||||
if(ShopAccountLogEnum::DEPOSIT == $changeObject){
|
||||
$leftAmount = $shop->deposit;
|
||||
}
|
||||
$data = [
|
||||
'sn' => generate_sn((new ShopAccountLog()), 'sn', 20),
|
||||
'shop_id' => $shopId,
|
||||
'change_object' => $changeObject,
|
||||
'change_type' => $changeType,
|
||||
'action' => $action,
|
||||
'left_amount' => $leftAmount,
|
||||
'change_amount' => $changeAmount,
|
||||
'association_sn'=> $sourceSn,
|
||||
'remark' => $remark,
|
||||
'extra' => $extra ? json_encode($extra, JSON_UNESCAPED_UNICODE) : '',
|
||||
'admin_id' => $adminId
|
||||
];
|
||||
|
||||
return ShopAccountLog::create($data);
|
||||
}
|
||||
}
|
||||
29
server/app/common/logic/ShopLogic.php
Executable file
29
server/app/common/logic/ShopLogic.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace app\common\logic;
|
||||
use app\common\model\goods\GoodsComment;
|
||||
use app\common\model\shop\Shop;
|
||||
|
||||
class ShopLogic extends BaseLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 更新商家评分
|
||||
* @param int $shopId
|
||||
* @return true
|
||||
* @author cjhao
|
||||
* @date 2024/12/6 12:32
|
||||
*/
|
||||
public static function updateShopComment(int $shopId)
|
||||
{
|
||||
|
||||
$shopAllComment = GoodsComment::where(['shop_id'=>$shopId])->sum('service_comment');
|
||||
$commentCount = GoodsComment::where(['shop_id'=>$shopId])->count();
|
||||
$shopGoodsComment = 0;
|
||||
if($commentCount){
|
||||
$shopGoodsComment = round($shopAllComment/$commentCount,2);
|
||||
}
|
||||
Shop::update(['good_comment'=>$shopGoodsComment],['id'=>$shopId]);
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
75
server/app/common/logic/ShopPayNotifyLogic.php
Executable file
75
server/app/common/logic/ShopPayNotifyLogic.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | LikeShop100%开源免费商用电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | Gitee下载:https://gitee.com/likeshop_gitee/likeshop
|
||||
// | 访问官网:https://www.likemarket.net
|
||||
// | 访问社区:https://home.likemarket.net
|
||||
// | 访问手册:http://doc.likemarket.net
|
||||
// | 微信公众号:好象科技
|
||||
// | 好象科技开发团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
// | Author: LikeShopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
use app\common\enum\accountLog\ShopAccountLogEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\accountLog\ShopAccountLog;
|
||||
use app\common\model\deposit\DepositOrder;
|
||||
use app\common\model\shop\Shop;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 支付成功后处理订单状态
|
||||
* Class PayNotifyLogic
|
||||
* @package app\api\logic
|
||||
*/
|
||||
class ShopPayNotifyLogic extends BaseLogic
|
||||
{
|
||||
public static function handle($action, $orderSn, $extra = [])
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
self::$action($orderSn, $extra);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::write(implode('-', [
|
||||
__CLASS__,
|
||||
__FUNCTION__,
|
||||
$e->getFile(),
|
||||
$e->getLine(),
|
||||
$e->getMessage()
|
||||
]));
|
||||
self::setError($e->getMessage());
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
private static function deposit($orderSn, $extra = []){
|
||||
$order = DepositOrder::where('sn', $orderSn)->findOrEmpty()->toArray();
|
||||
// 增加用户累计充值金额及用户余额
|
||||
Shop::update([
|
||||
'deposit' => ['inc',$order['order_amount']],
|
||||
],['id'=>$order['relation_id']]);
|
||||
|
||||
// 记录账户流水
|
||||
ShopAccountLogLogic::add($order['relation_id'], ShopAccountLogEnum::DEPOSIT,ShopAccountLogEnum::RECHARGE_INC_DEPOSIT,ShopAccountLogEnum::INC, $order['order_amount'], $order['sn']);
|
||||
|
||||
// 更新充值订单状态
|
||||
DepositOrder::update([
|
||||
'transaction_id' => $extra['transaction_id'] ?? '',
|
||||
'pay_status' => PayEnum::ISPAID,
|
||||
'pay_time' => time(),
|
||||
],['id'=>$order['id']]);
|
||||
}
|
||||
|
||||
}
|
||||
59
server/app/common/logic/SmsLogic.php
Executable file
59
server/app/common/logic/SmsLogic.php
Executable file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
|
||||
|
||||
/**
|
||||
* 短信逻辑
|
||||
* Class SmsLogic
|
||||
* @package app\api\logic
|
||||
*/
|
||||
class SmsLogic extends BaseLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 发送验证码
|
||||
* @param $params
|
||||
* @return false|mixed
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 16:17
|
||||
*/
|
||||
public static function sendCode($params)
|
||||
{
|
||||
try {
|
||||
$scene = NoticeEnum::getSceneByTag($params['scene']);
|
||||
if (empty($scene)) {
|
||||
throw new \Exception('场景值异常');
|
||||
}
|
||||
|
||||
$result = event('Notice', [
|
||||
'scene_id' => $scene,
|
||||
'params' => [
|
||||
'mobile' => $params['mobile'],
|
||||
'code' => mt_rand(1000, 9999),
|
||||
]
|
||||
]);
|
||||
|
||||
return $result[0];
|
||||
|
||||
} catch (\Exception $e) {
|
||||
self::$error = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
55
server/app/common/model/BaseModel.php
Executable file
55
server/app/common/model/BaseModel.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use app\common\service\FileService;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 基础模型
|
||||
* Class BaseModel
|
||||
* @package app\common\model
|
||||
*/
|
||||
class BaseModel extends Model
|
||||
{
|
||||
/**
|
||||
* @notes 公共处理图片,补全路径
|
||||
* @param $value
|
||||
* @return string
|
||||
* @author 张无忌
|
||||
* @date 2021/9/10 11:02
|
||||
*/
|
||||
public function getImageAttr($value)
|
||||
{
|
||||
return trim($value) ? FileService::getFileUrl($value) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 公共图片处理,去除图片域名
|
||||
* @param $value
|
||||
* @return mixed|string
|
||||
* @author 张无忌
|
||||
* @date 2021/9/10 11:04
|
||||
*/
|
||||
public function setImageAttr($value)
|
||||
{
|
||||
return trim($value) ? FileService::setFileUrl($value) : '';
|
||||
}
|
||||
}
|
||||
25
server/app/common/model/Config.php
Executable file
25
server/app/common/model/Config.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
class Config extends BaseModel
|
||||
{
|
||||
|
||||
}
|
||||
79
server/app/common/model/Crontab.php
Executable file
79
server/app/common/model/Crontab.php
Executable file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Crontab extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
protected $name = 'dev_crontab';
|
||||
|
||||
/**
|
||||
* @notes 类型获取器
|
||||
* @param $value
|
||||
* @return string
|
||||
* @author Tab
|
||||
* @date 2021/8/17 11:03
|
||||
*/
|
||||
public function getTypeDescAttr($value)
|
||||
{
|
||||
$desc = [
|
||||
1 => '定时任务',
|
||||
2 => '守护进程',
|
||||
];
|
||||
|
||||
return $desc[$value] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 状态获取器
|
||||
* @param $value
|
||||
* @return string
|
||||
* @author Tab
|
||||
* @date 2021/8/17 11:04
|
||||
*/
|
||||
public function getStatusDescAttr($value)
|
||||
{
|
||||
$desc = [
|
||||
1 => '运行',
|
||||
2 => '停止',
|
||||
3 => '错误',
|
||||
];
|
||||
|
||||
return $desc[$value] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 最后执行时间获取器
|
||||
* @param $value
|
||||
* @return string
|
||||
* @author Tab
|
||||
* @date 2021/8/17 14:35
|
||||
*/
|
||||
public function getLastTimeAttr($value)
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
}
|
||||
20
server/app/common/model/HotSearch.php
Executable file
20
server/app/common/model/HotSearch.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
class HotSearch extends BaseModel
|
||||
{
|
||||
|
||||
}
|
||||
35
server/app/common/model/IndexVisit.php
Executable file
35
server/app/common/model/IndexVisit.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 首页访问浏览记录
|
||||
* Class Visitor
|
||||
* @package app\common\model
|
||||
*/
|
||||
class IndexVisit extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
}
|
||||
43
server/app/common/model/MapKey.php
Executable file
43
server/app/common/model/MapKey.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use app\common\enum\MapKeyEnum;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class MapKey extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
/**
|
||||
* @notes 类型
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2024/11/5 下午2:33
|
||||
*/
|
||||
public function getTypeDescAttr($value,$data)
|
||||
{
|
||||
return MapKeyEnum::getTypeDesc($data['type']);
|
||||
}
|
||||
}
|
||||
35
server/app/common/model/Notice.php
Executable file
35
server/app/common/model/Notice.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 通知记录模型
|
||||
* Class Notice
|
||||
* @package app\common\model
|
||||
*/
|
||||
class Notice extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
}
|
||||
10
server/app/common/model/OperationLog.php
Executable file
10
server/app/common/model/OperationLog.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
class OperationLog extends BaseModel
|
||||
{
|
||||
|
||||
}
|
||||
71
server/app/common/model/RechargeOrder.php
Executable file
71
server/app/common/model/RechargeOrder.php
Executable file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use app\common\enum\PayEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
class RechargeOrder extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
/**
|
||||
* @notes 支付方式
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/12/2 6:25 下午
|
||||
*/
|
||||
public function getPayWayDescAttr($value,$data)
|
||||
{
|
||||
return PayEnum::getPayTypeDesc($data['pay_way']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 支付状态
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/12/2 6:26 下午
|
||||
*/
|
||||
public function getPayStatusDescAttr($value,$data)
|
||||
{
|
||||
return PayEnum::getPayStatusDesc($data['pay_status']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 支付时间
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return false|string
|
||||
* @author ljj
|
||||
* @date 2022/12/2 6:47 下午
|
||||
*/
|
||||
public function getPayTimeAttr($value,$data)
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d H:i:s',$value);
|
||||
}
|
||||
}
|
||||
26
server/app/common/model/Region.php
Executable file
26
server/app/common/model/Region.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
class Region extends BaseModel
|
||||
{
|
||||
protected $name = 'dev_region';
|
||||
}
|
||||
26
server/app/common/model/SmsLog.php
Executable file
26
server/app/common/model/SmsLog.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
class SmsLog extends BaseModel
|
||||
{
|
||||
|
||||
}
|
||||
29
server/app/common/model/TextList.php
Executable file
29
server/app/common/model/TextList.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
/**
|
||||
* 文本列表模型类
|
||||
* Class TextList
|
||||
* @package app\common\model
|
||||
*/
|
||||
class TextList extends BaseModel
|
||||
{
|
||||
|
||||
}
|
||||
62
server/app/common/model/accountLog/AccountLog.php
Executable file
62
server/app/common/model/accountLog/AccountLog.php
Executable file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\accountLog;
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\user\User;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
class AccountLog extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
/**
|
||||
* @notes 关联用户模型
|
||||
* @return \think\model\relation\HasOne
|
||||
* @author ljj
|
||||
* @date 2022/9/29 6:41 下午
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(User::class,'id','user_id')
|
||||
->field('id,sn,nickname,avatar,mobile');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 变动类型
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/5/31 4:45 下午
|
||||
*/
|
||||
public function getChangeTypeDescAttr($value,$data)
|
||||
{
|
||||
return AccountLogEnum::getChangeTypeDesc($data['change_type']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
92
server/app/common/model/accountLog/CoachAccountLog.php
Executable file
92
server/app/common/model/accountLog/CoachAccountLog.php
Executable file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\accountLog;
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\user\User;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
class CoachAccountLog extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 变动类型
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/5/31 4:45 下午
|
||||
*/
|
||||
public function getChangeTypeDescAttr($value,$data)
|
||||
{
|
||||
return CoachAccountLogEnum::getChangeTypeDesc($data['change_type']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $coachId (技师ID
|
||||
* @param $changeType (变动类型
|
||||
* @param $action (操作动作: [1=新增, 2=扣减])
|
||||
* @param $changeAmount (变动的值
|
||||
* @param string $sourceSn (来源编号)
|
||||
* @param string $remark (备注信息)
|
||||
* @param array $extra (扩展信息)
|
||||
* @param int $adminId (管理员ID)
|
||||
* @param array $flowUsage (token信息组)
|
||||
* @return CoachAccountLog|false|Model
|
||||
*/
|
||||
public static function add($caochId, $changeObject,$changeType, $action, $changeAmount, string $sourceSn = '', int $adminId = 0, string $remark = '', array $extra = []): bool|Model|CoachAccountLog
|
||||
{
|
||||
|
||||
// 取用户信息
|
||||
$coach = (new Coach())->findOrEmpty($caochId);
|
||||
if ($coach->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
$leftAmount = $coach->money;
|
||||
if(CoachAccountLogEnum::DEPOSIT == $changeObject){
|
||||
$leftAmount = $coach->deposit;
|
||||
}
|
||||
$data = [
|
||||
'sn' => generate_sn((new CoachAccountLog()), 'sn', 20),
|
||||
'coach_id' => $caochId,
|
||||
'change_object' => $changeObject,
|
||||
'change_type' => $changeType,
|
||||
'action' => $action,
|
||||
'left_amount' => $leftAmount,
|
||||
'change_amount' => $changeAmount,
|
||||
'source_sn' => $sourceSn,
|
||||
'remark' => $remark,
|
||||
'extra' => $extra ? json_encode($extra, JSON_UNESCAPED_UNICODE) : '',
|
||||
'admin_id' => $adminId
|
||||
];
|
||||
|
||||
return CoachAccountLog::create($data);
|
||||
}
|
||||
}
|
||||
94
server/app/common/model/accountLog/ShopAccountLog.php
Executable file
94
server/app/common/model/accountLog/ShopAccountLog.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\accountLog;
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\enum\accountLog\ShopAccountLogEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\shop\Shop;
|
||||
use app\common\model\user\User;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
class ShopAccountLog extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 变动类型
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/5/31 4:45 下午
|
||||
*/
|
||||
public function getChangeTypeDescAttr($value,$data)
|
||||
{
|
||||
return ShopAccountLogEnum::getChangeTypeDesc($data['change_type']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $shopId (店铺ID
|
||||
* @param $changeType (变动类型
|
||||
* @param $action (操作动作: [1=新增, 2=扣减])
|
||||
* @param $changeAmount (变动的值
|
||||
* @param string $sourceSn (来源编号)
|
||||
* @param string $remark (备注信息)
|
||||
* @param array $extra (扩展信息)
|
||||
* @param int $adminId (管理员ID)
|
||||
* @param array $flowUsage (token信息组)
|
||||
* @return CoachAccountLog|false|Model
|
||||
*/
|
||||
public static function add($shopId, $changeObject,$changeType, $action, $changeAmount, string $sourceSn = '', int $adminId = 0, string $remark = '', array $extra = []): bool|Model|ShopAccountLog
|
||||
{
|
||||
|
||||
// 取用户信息
|
||||
$shop = (new Shop())->findOrEmpty($shopId);
|
||||
if ($shop->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
$leftAmount = $shop->money;
|
||||
if(ShopAccountLogEnum::DEPOSIT == $changeObject){
|
||||
$leftAmount = $shop->deposit;
|
||||
}
|
||||
$data = [
|
||||
'sn' => generate_sn((new ShopAccountLog()), 'sn', 20),
|
||||
'shop_id' => $shopId,
|
||||
'change_object' => $changeObject,
|
||||
'change_type' => $changeType,
|
||||
'action' => $action,
|
||||
'left_amount' => $leftAmount,
|
||||
'change_amount' => $changeAmount,
|
||||
'source_sn' => $sourceSn,
|
||||
'remark' => $remark,
|
||||
'extra' => $extra ? json_encode($extra, JSON_UNESCAPED_UNICODE) : '',
|
||||
'admin_id' => $adminId
|
||||
];
|
||||
|
||||
return ShopAccountLog::create($data);
|
||||
}
|
||||
}
|
||||
70
server/app/common/model/ad/Ad.php
Executable file
70
server/app/common/model/ad/Ad.php
Executable file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\ad;
|
||||
|
||||
|
||||
use app\common\enum\AdEnum;
|
||||
use app\common\enum\MenuEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\goods\GoodsCategory;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Ad extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
/**
|
||||
* @notes 链接地址
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 6:25 下午
|
||||
*/
|
||||
public function getLinkAddressDescAttr($value,$data)
|
||||
{
|
||||
$address = AdEnum::getLinkDesc($data['link_type']);
|
||||
if ($data['link_type'] == AdEnum::LINK_CUSTOM) {
|
||||
$address = $address.':'.$data['link_address'];
|
||||
}elseif ($data['link_type'] == AdEnum::LINK_SHOP) {
|
||||
$shop_page = array_column(MenuEnum::SHOP_PAGE,NULL,'index');
|
||||
$address = $address.':'.$shop_page[$data['link_address']]['name'];
|
||||
}elseif ($data['link_type'] == AdEnum::LINK_GOODS) {
|
||||
$goods_name = GoodsCategory::where('id',$data['link_address'])->value('name');
|
||||
$address = $address.':'.$goods_name;
|
||||
}
|
||||
return $address;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 广告位名称
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* @author ljj
|
||||
* @date 2022/2/14 6:37 下午
|
||||
*/
|
||||
public function getApNameAttr($value,$data)
|
||||
{
|
||||
return AdPosition::where('id',$data['pid'])->value('name');
|
||||
}
|
||||
}
|
||||
58
server/app/common/model/ad/AdPosition.php
Executable file
58
server/app/common/model/ad/AdPosition.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\ad;
|
||||
|
||||
|
||||
use app\common\enum\DefaultEnum;
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class AdPosition extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
/**
|
||||
* @notes 状态
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 4:38 下午
|
||||
*/
|
||||
public function getStatusDescAttr($value,$data)
|
||||
{
|
||||
return DefaultEnum::getEnableDesc($data['status']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 属性
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2022/2/14 4:42 下午
|
||||
*/
|
||||
public function getAttrDescAttr($value,$data)
|
||||
{
|
||||
return DefaultEnum::getAttrDesc($data['attr']);
|
||||
}
|
||||
}
|
||||
85
server/app/common/model/article/Article.php
Executable file
85
server/app/common/model/article/Article.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\article;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 资讯管理模型
|
||||
* Class Article
|
||||
* @package app\common\model\article;
|
||||
*/
|
||||
class Article extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
/**
|
||||
* @notes 获取分类名称
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string
|
||||
* @author heshihu
|
||||
* @date 2022/2/22 9:53
|
||||
*/
|
||||
public function getCateNameAttr($value, $data)
|
||||
{
|
||||
return ArticleCate::where('id', $data['cid'])->value('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 浏览量
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return mixed
|
||||
* @author 段誉
|
||||
* @date 2022/9/15 11:33
|
||||
*/
|
||||
public function getClickAttr($value, $data)
|
||||
{
|
||||
return $data['click_actual'] + $data['click_virtual'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置图片域名
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return array|string|string[]|null
|
||||
* @author 段誉
|
||||
* @date 2022/9/28 10:17
|
||||
*/
|
||||
public function getContentAttr($value, $data)
|
||||
{
|
||||
return get_file_domain($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 清除图片域名
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return array|string|string[]
|
||||
* @author 段誉
|
||||
* @date 2022/9/28 10:17
|
||||
*/
|
||||
public function setContentAttr($value, $data)
|
||||
{
|
||||
return clear_file_domain($value);
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user