@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
use think\Session;
|
||||
|
||||
class Admin extends Model
|
||||
{
|
||||
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'salt'
|
||||
];
|
||||
|
||||
public static function init()
|
||||
{
|
||||
self::beforeWrite(function ($row) {
|
||||
$changed = $row->getChangedData();
|
||||
//如果修改了用户或或密码则需要重新登录
|
||||
if (isset($changed['username']) || isset($changed['password']) || isset($changed['salt'])) {
|
||||
$row->token = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
114
application/admin/model/AdminLog.php
普通文件
114
application/admin/model/AdminLog.php
普通文件
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\admin\library\Auth;
|
||||
use think\Model;
|
||||
use think\Loader;
|
||||
|
||||
class AdminLog extends Model
|
||||
{
|
||||
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = '';
|
||||
//自定义日志标题
|
||||
protected static $title = '';
|
||||
//自定义日志内容
|
||||
protected static $content = '';
|
||||
//忽略的链接正则列表
|
||||
protected static $ignoreRegex = [
|
||||
'/^(.*)\/(selectpage|index)$/i',
|
||||
];
|
||||
|
||||
public static function setTitle($title)
|
||||
{
|
||||
self::$title = $title;
|
||||
}
|
||||
|
||||
public static function setContent($content)
|
||||
{
|
||||
self::$content = $content;
|
||||
}
|
||||
|
||||
public static function setIgnoreRegex($regex = [])
|
||||
{
|
||||
$regex = is_array($regex) ? $regex : [$regex];
|
||||
self::$ignoreRegex = array_merge(self::$ignoreRegex, $regex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录日志
|
||||
* @param string $title
|
||||
* @param string $content
|
||||
*/
|
||||
public static function record($title = '', $content = '')
|
||||
{
|
||||
$auth = Auth::instance();
|
||||
$admin_id = $auth->isLogin() ? $auth->id : 0;
|
||||
$username = $auth->isLogin() ? $auth->username : __('Unknown');
|
||||
|
||||
$controllername = Loader::parseName(request()->controller());
|
||||
$actionname = strtolower(request()->action());
|
||||
$path = str_replace('.', '/', $controllername) . '/' . $actionname;
|
||||
if (self::$ignoreRegex) {
|
||||
foreach (self::$ignoreRegex as $index => $item) {
|
||||
if (preg_match($item, $path)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
$content = $content ? $content : self::$content;
|
||||
if (!$content) {
|
||||
$content = request()->param('', null, 'trim,strip_tags,htmlspecialchars');
|
||||
$content = self::getPureContent($content);
|
||||
}
|
||||
$title = $title ? $title : self::$title;
|
||||
if (!$title) {
|
||||
$title = [];
|
||||
$breadcrumb = Auth::instance()->getBreadcrumb($path);
|
||||
foreach ($breadcrumb as $k => $v) {
|
||||
$title[] = $v['title'];
|
||||
}
|
||||
$title = implode(' / ', $title);
|
||||
}
|
||||
self::create([
|
||||
'title' => $title,
|
||||
'content' => !is_scalar($content) ? json_encode($content, JSON_UNESCAPED_UNICODE) : $content,
|
||||
'url' => substr(request()->url(), 0, 1500),
|
||||
'admin_id' => $admin_id,
|
||||
'username' => $username,
|
||||
'useragent' => substr(request()->server('HTTP_USER_AGENT'), 0, 255),
|
||||
'ip' => request()->ip()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已屏蔽关键信息的数据
|
||||
* @param $content
|
||||
* @return false|string
|
||||
*/
|
||||
protected static function getPureContent($content)
|
||||
{
|
||||
if (!is_array($content)) {
|
||||
return $content;
|
||||
}
|
||||
foreach ($content as $index => &$item) {
|
||||
if (preg_match("/(password|salt|token)/i", $index)) {
|
||||
$item = "***";
|
||||
} else {
|
||||
if (is_array($item)) {
|
||||
$item = self::getPureContent($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->belongsTo('Admin', 'admin_id')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AuthGroup extends Model
|
||||
{
|
||||
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
public function getNameAttr($value, $data)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AuthGroupAccess extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Cache;
|
||||
use think\Model;
|
||||
|
||||
class AuthRule extends Model
|
||||
{
|
||||
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 数据自动完成字段
|
||||
protected $insert = ['py', 'pinyin'];
|
||||
protected $update = ['py', 'pinyin'];
|
||||
// 拼音对象
|
||||
protected static $pinyin = null;
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::$pinyin = new \Overtrue\Pinyin\Pinyin('Overtrue\Pinyin\MemoryFileDictLoader');
|
||||
|
||||
self::beforeWrite(function ($row) {
|
||||
if (isset($_POST['row']) && is_array($_POST['row']) && isset($_POST['row']['condition'])) {
|
||||
$originRow = $_POST['row'];
|
||||
$row['condition'] = $originRow['condition'] ?? '';
|
||||
}
|
||||
});
|
||||
self::afterWrite(function ($row) {
|
||||
Cache::rm('__menu__');
|
||||
});
|
||||
}
|
||||
|
||||
public function getTitleAttr($value, $data)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
|
||||
public function getMenutypeList()
|
||||
{
|
||||
return ['addtabs' => __('Addtabs'), 'dialog' => __('Dialog'), 'ajax' => __('Ajax'), 'blank' => __('Blank')];
|
||||
}
|
||||
|
||||
public function setPyAttr($value, $data)
|
||||
{
|
||||
if (isset($data['title']) && $data['title']) {
|
||||
return self::$pinyin->abbr(__($data['title']));
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function setPinyinAttr($value, $data)
|
||||
{
|
||||
if (isset($data['title']) && $data['title']) {
|
||||
return self::$pinyin->permalink(__($data['title']), '');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
114
application/admin/model/User.php
普通文件
114
application/admin/model/User.php
普通文件
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\common\model\MoneyLog;
|
||||
use app\common\model\ScoreLog;
|
||||
use think\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'user';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'prevtime_text',
|
||||
'logintime_text',
|
||||
'jointime_text'
|
||||
];
|
||||
|
||||
public function getOriginData()
|
||||
{
|
||||
return $this->origin;
|
||||
}
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::beforeUpdate(function ($row) {
|
||||
$changed = $row->getChangedData();
|
||||
//如果有修改密码
|
||||
if (isset($changed['password'])) {
|
||||
if ($changed['password']) {
|
||||
$salt = \fast\Random::alnum();
|
||||
$row->password = \app\common\library\Auth::instance()->getEncryptPassword($changed['password'], $salt);
|
||||
$row->salt = $salt;
|
||||
} else {
|
||||
unset($row->password);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
self::beforeUpdate(function ($row) {
|
||||
$changedata = $row->getChangedData();
|
||||
$origin = $row->getOriginData();
|
||||
if (isset($changedata['money']) && (function_exists('bccomp') ? bccomp($changedata['money'], $origin['money'], 2) !== 0 : (double)$changedata['money'] !== (double)$origin['money'])) {
|
||||
MoneyLog::create(['user_id' => $row['id'], 'money' => $changedata['money'] - $origin['money'], 'before' => $origin['money'], 'after' => $changedata['money'], 'memo' => '管理员变更金额']);
|
||||
}
|
||||
if (isset($changedata['score']) && (int)$changedata['score'] !== (int)$origin['score']) {
|
||||
ScoreLog::create(['user_id' => $row['id'], 'score' => $changedata['score'] - $origin['score'], 'before' => $origin['score'], 'after' => $changedata['score'], 'memo' => '管理员变更积分']);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getGenderList()
|
||||
{
|
||||
return ['1' => __('Male'), '0' => __('Female')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
|
||||
}
|
||||
|
||||
|
||||
public function getPrevtimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : ($data['prevtime'] ?? "");
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
public function getLogintimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : ($data['logintime'] ?? "");
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
public function getJointimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : ($data['jointime'] ?? "");
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setPrevtimeAttr($value)
|
||||
{
|
||||
return $value && !is_numeric($value) ? strtotime($value) : $value;
|
||||
}
|
||||
|
||||
protected function setLogintimeAttr($value)
|
||||
{
|
||||
return $value && !is_numeric($value) ? strtotime($value) : $value;
|
||||
}
|
||||
|
||||
protected function setJointimeAttr($value)
|
||||
{
|
||||
return $value && !is_numeric($value) ? strtotime($value) : $value;
|
||||
}
|
||||
|
||||
protected function setBirthdayAttr($value)
|
||||
{
|
||||
return $value ? $value : null;
|
||||
}
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo('UserGroup', 'group_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class UserGroup extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'user_group';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : $data['status'];
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use fast\Tree;
|
||||
use think\Model;
|
||||
|
||||
class UserRule extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'user_rule';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterInsert(function ($row) {
|
||||
$pk = $row->getPk();
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
|
||||
});
|
||||
}
|
||||
|
||||
public function getTitleAttr($value, $data)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : $data['status'];
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public static function getTreeList($selected = [])
|
||||
{
|
||||
$ruleList = collection(self::where('status', 'normal')->order('weigh desc,id desc')->select())->toArray();
|
||||
$nodeList = [];
|
||||
Tree::instance()->init($ruleList);
|
||||
$ruleList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
|
||||
$hasChildrens = [];
|
||||
foreach ($ruleList as $k => $v)
|
||||
{
|
||||
if ($v['haschild'])
|
||||
$hasChildrens[] = $v['id'];
|
||||
}
|
||||
foreach ($ruleList as $k => $v) {
|
||||
$state = array('selected' => in_array($v['id'], $selected) && !in_array($v['id'], $hasChildrens));
|
||||
$nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state);
|
||||
}
|
||||
return $nodeList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Area extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_area';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'value',
|
||||
'label'
|
||||
];
|
||||
|
||||
|
||||
public function getValueAttr($value, $data) {
|
||||
return $data['id'];
|
||||
}
|
||||
|
||||
public function getLabelAttr($value, $data)
|
||||
{
|
||||
return $data['name'];
|
||||
}
|
||||
|
||||
public function children ()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\Area::class, 'pid', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 分类模型
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
|
||||
// 表名,不含前缀
|
||||
protected $name = 'shopro_category';
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\Category::class, 'pid', 'id')->order('weigh desc, id asc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 配置模型
|
||||
*/
|
||||
class Config extends Model
|
||||
{
|
||||
|
||||
// 表名,不含前缀
|
||||
protected $name = 'shopro_config';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
/**
|
||||
* 读取配置类型
|
||||
* @return array
|
||||
*/
|
||||
public static function getTypeList()
|
||||
{
|
||||
$typeList = [
|
||||
'string' => __('String'),
|
||||
'text' => __('Text'),
|
||||
'editor' => __('Editor'),
|
||||
'number' => __('Number'),
|
||||
'date' => __('Date'),
|
||||
'time' => __('Time'),
|
||||
'datetime' => __('Datetime'),
|
||||
'select' => __('Select'),
|
||||
'selects' => __('Selects'),
|
||||
'image' => __('Image'),
|
||||
'images' => __('Images'),
|
||||
'file' => __('File'),
|
||||
'files' => __('Files'),
|
||||
'switch' => __('Switch'),
|
||||
'checkbox' => __('Checkbox'),
|
||||
'radio' => __('Radio'),
|
||||
'array' => __('Array'),
|
||||
'custom' => __('Custom'),
|
||||
];
|
||||
return $typeList;
|
||||
}
|
||||
|
||||
public static function getRegexList()
|
||||
{
|
||||
$regexList = [
|
||||
'required' => '必选',
|
||||
'digits' => '数字',
|
||||
'letters' => '字母',
|
||||
'date' => '日期',
|
||||
'time' => '时间',
|
||||
'email' => '邮箱',
|
||||
'url' => '网址',
|
||||
'qq' => 'QQ号',
|
||||
'IDcard' => '身份证',
|
||||
'tel' => '座机电话',
|
||||
'mobile' => '手机号',
|
||||
'zipcode' => '邮编',
|
||||
'chinese' => '中文',
|
||||
'username' => '用户名',
|
||||
'password' => '密码'
|
||||
];
|
||||
return $regexList;
|
||||
}
|
||||
|
||||
public function getExtendAttr($value, $data)
|
||||
{
|
||||
$result = preg_replace_callback("/\{([a-zA-Z]+)\}/", function ($matches) use ($data) {
|
||||
if (isset($data[$matches[1]])) {
|
||||
return $data[$matches[1]];
|
||||
}
|
||||
}, $data['extend']);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function load($name)
|
||||
{
|
||||
$value = self::where(['name' => $name])->value('value');
|
||||
return json_decode($value, true);
|
||||
}
|
||||
/**
|
||||
* 读取分类分组列表
|
||||
* @return array
|
||||
*/
|
||||
public static function getGroupList()
|
||||
{
|
||||
$group = self::group('group')->column('group');
|
||||
$groupList = [];
|
||||
foreach ($group as $v) {
|
||||
$groupList[$v] = __($v);
|
||||
}
|
||||
|
||||
return $groupList;
|
||||
}
|
||||
|
||||
public static function getArrayData($data)
|
||||
{
|
||||
if (!isset($data['value'])) {
|
||||
$result = [];
|
||||
foreach ($data as $index => $datum) {
|
||||
$result['field'][$index] = $datum['key'];
|
||||
$result['value'][$index] = $datum['value'];
|
||||
}
|
||||
$data = $result;
|
||||
}
|
||||
$fieldarr = $valuearr = [];
|
||||
$field = isset($data['field']) ? $data['field'] : (isset($data['key']) ? $data['key'] : []);
|
||||
$value = isset($data['value']) ? $data['value'] : [];
|
||||
foreach ($field as $m => $n) {
|
||||
if ($n != '') {
|
||||
$fieldarr[] = $field[$m];
|
||||
$valuearr[] = $value[$m];
|
||||
}
|
||||
}
|
||||
return $fieldarr ? array_combine($fieldarr, $valuearr) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串解析成键值数组
|
||||
* @param string $text
|
||||
* @return array
|
||||
*/
|
||||
public static function decode($text, $split = "\r\n")
|
||||
{
|
||||
$content = explode($split, $text);
|
||||
$arr = [];
|
||||
foreach ($content as $k => $v) {
|
||||
if (stripos($v, "|") !== false) {
|
||||
$item = explode('|', $v);
|
||||
$arr[$item[0]] = $item[1];
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将键值数组转换为字符串
|
||||
* @param array $array
|
||||
* @return string
|
||||
*/
|
||||
public static function encode($array, $split = "\r\n")
|
||||
{
|
||||
$content = '';
|
||||
if ($array && is_array($array)) {
|
||||
$arr = [];
|
||||
foreach ($array as $k => $v) {
|
||||
$arr[] = "{$k}|{$v}";
|
||||
}
|
||||
$content = implode($split, $arr);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地上传配置信息
|
||||
* @return array
|
||||
*/
|
||||
public static function upload()
|
||||
{
|
||||
$uploadcfg = config('upload');
|
||||
|
||||
$upload = [
|
||||
'cdnurl' => $uploadcfg['cdnurl'],
|
||||
'uploadurl' => $uploadcfg['uploadurl'],
|
||||
'bucket' => 'local',
|
||||
'maxsize' => $uploadcfg['maxsize'],
|
||||
'mimetype' => $uploadcfg['mimetype'],
|
||||
'multipart' => [],
|
||||
'multiple' => $uploadcfg['multiple'],
|
||||
];
|
||||
return $upload;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Coupons extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
protected $auto = ['usetimestart', 'usetimeend', 'gettimestart', 'gettimeend'];
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_coupons';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
protected $append = [
|
||||
'type_text'
|
||||
];
|
||||
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['cash' => __('Type cash'), 'discount' => __('Type discount')];
|
||||
}
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
protected function setUsetimestartAttr($value, $data)
|
||||
{
|
||||
$usetimeArray = explode(' - ', $data['usetime']);
|
||||
return strtotime($usetimeArray[0]);
|
||||
}
|
||||
protected function setUsetimeendAttr($value, $data)
|
||||
{
|
||||
$usetimeArray = explode(' - ', $data['usetime']);
|
||||
return strtotime($usetimeArray[1]);
|
||||
}
|
||||
protected function setGettimestartAttr($value, $data)
|
||||
{
|
||||
$gettimeArray = explode(' - ', $data['gettime']);
|
||||
return strtotime($gettimeArray[0]);
|
||||
}
|
||||
protected function setGettimeendAttr($value, $data)
|
||||
{
|
||||
$gettimeArray = explode(' - ', $data['gettime']);
|
||||
return strtotime($gettimeArray[1]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Decorate extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_decorate';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'platform_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
|
||||
}
|
||||
|
||||
public function getPlatformList()
|
||||
{
|
||||
return ['H5' => __('Platform h5'), 'wxOfficialAccount' => __('Platform wxofficialaccount'), 'wxMiniProgram' => __('Platform wxminiprogram'), 'App' => __('Platform app')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
// 模板列表截图是本地图
|
||||
// public function getImageAttr($value, $data)
|
||||
// {
|
||||
// if (!empty($value)) return cdnurl($value, true);
|
||||
// }
|
||||
|
||||
public function getPlatformTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['platform']) ? $data['platform'] : '');
|
||||
$valueArr = explode(',', $value);
|
||||
$list = $this->getPlatformList();
|
||||
return implode(',', array_intersect_key($list, array_flip($valueArr)));
|
||||
}
|
||||
|
||||
protected function setPlatformAttr($value)
|
||||
{
|
||||
return is_array($value) ? implode(',', $value) : $value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class DecorateContent extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_decorate_content';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class DecoratePage extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_decorate_page';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Express extends Model
|
||||
{
|
||||
|
||||
// 快递公司表
|
||||
protected $name = 'shopro_express';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Faq extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_faq';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Feedback extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_feedback';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text', 'type_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['0' => __('Status 0'), '1' => __('Status 1')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
return isset(\addons\shopro\model\Feedback::$typeAll[$data['type']]) ? \addons\shopro\model\Feedback::$typeAll[$data['type']]['name'] : '';
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\user\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Link extends Model
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_link';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
public function children ()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\Link::class, 'group', 'group')->order('id asc');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Notification extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_notification';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'readtime_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getReadtimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['readtime']) ? $data['readtime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setReadtimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Richtext extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_richtext';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 分享模型
|
||||
*/
|
||||
class Share extends Model
|
||||
{
|
||||
|
||||
// 表名,不含前缀
|
||||
protected $name = 'shopro_share';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
];
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['index' => __('Type index'), 'goods' => __('Type goods'), 'groupon' => __('Type groupon')];
|
||||
}
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\user\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Upload extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_link';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class UserFake extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_user_fake';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class UserWalletApply extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_user_wallet_apply';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'apply_type_text',
|
||||
'status_text',
|
||||
'apply_info_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getApplyTypeList()
|
||||
{
|
||||
return ['bank' => __('Apply_type bank'), 'wechat' => __('Apply_type wechat'), 'alipay' => __('Apply_type alipay')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2'), '-1' => __('Status -1')];
|
||||
}
|
||||
|
||||
|
||||
public function getApplyTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['apply_type']) ? $data['apply_type'] : '');
|
||||
$list = $this->getApplyTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getApplyInfoTextAttr($value, $data)
|
||||
{
|
||||
$value = $data['apply_info'] ?? '';
|
||||
$value = $value ? json_decode($value, true) : '-';
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现信息
|
||||
*/
|
||||
public function getApplyInfoAttr($value, $data)
|
||||
{
|
||||
$value = isset($data['apply_info']) ? $data['apply_info'] : $value;
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取日志字段数组
|
||||
* @param string $value
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function getLogAttr($value, $data)
|
||||
{
|
||||
$value = array_filter((array)json_decode($value, true));
|
||||
return (array)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置日志字段
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
public function setLogAttr($value)
|
||||
{
|
||||
$value = is_object($value) || is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'user_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\activity;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Activity extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_activity';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'starttime_text',
|
||||
'endtime_text',
|
||||
'type_text',
|
||||
'status_text',
|
||||
'status',
|
||||
'rule_arr'
|
||||
];
|
||||
|
||||
public static function getTypeList()
|
||||
{
|
||||
return [
|
||||
'seckill' => '秒杀',
|
||||
'timer' => '限时秒杀',
|
||||
'robbuy' => '预约抢购',
|
||||
'groupon' => '拼团',
|
||||
'full_reduce' => '满额立减',
|
||||
'full_discount' => '满额折扣',
|
||||
'free_shipping' => '满额包邮',
|
||||
'promote' => '限时促销',
|
||||
];
|
||||
}
|
||||
|
||||
public static function getStatusList()
|
||||
{
|
||||
return ['nostart' => '未开始', 'ing' => '进行中', 'ended' => '已结束'];
|
||||
}
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getStarttimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['starttime']) ? $data['starttime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
public function getEndtimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['endtime']) ? $data['endtime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setStarttimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
protected function setEndtimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
protected function getRuleArrAttr($value, $data)
|
||||
{
|
||||
$value = json_decode($data['rules'], true);
|
||||
if (!isset($value['user_type'])) {
|
||||
$value['user_type'] = 'all';
|
||||
}
|
||||
if (!isset($value['new_user_order_count'])) {
|
||||
$value['new_user_order_count'] = 0;
|
||||
}
|
||||
if (!isset($value['new_user_register_days'])) {
|
||||
$value['new_user_register_days'] = 0;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
protected function getStatusAttr($value, $data)
|
||||
{
|
||||
return $this->getStatus($value, $data, 'status');
|
||||
}
|
||||
|
||||
|
||||
protected function getStatusTextAttr($value, $data)
|
||||
{
|
||||
return $this->getStatus($value, $data, 'text');
|
||||
}
|
||||
|
||||
private function getStatus($value, $data, $type = 'status')
|
||||
{
|
||||
$status_text = '';
|
||||
$status = '';
|
||||
$time = time();
|
||||
|
||||
if ($data['starttime'] < $time && $data['endtime'] > $time) {
|
||||
$status_text = '进行中';
|
||||
$status = 'ing';
|
||||
} else if ($data['starttime'] > $time) {
|
||||
$status_text = '未开始';
|
||||
$status = 'nostart';
|
||||
} else if ($data['endtime'] < $time) {
|
||||
$status_text = '已结束';
|
||||
$status = 'ended';
|
||||
}
|
||||
|
||||
return $type == 'status' ? $status : $status_text;
|
||||
}
|
||||
|
||||
|
||||
public function activityGoodsSkuPrice()
|
||||
{
|
||||
return $this->hasMany(\addons\shopro\model\ActivityGoodsSkuPrice::class, 'activity_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\activity;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class ActivitySkuPrice extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_activity_goods_sku_price';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\activity;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Groupon extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_activity_groupon';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['invalid' => __('Status invalid'), 'ing' => __('Status ing'), 'finish' => __('Status finish'), 'finish-fictitious' => __('Status finish-fictitious')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function grouponLog()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\activity\GrouponLog::class, 'groupon_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\goods\Goods::class, 'goods_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\activity;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class GrouponLog extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_activity_groupon_log';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['invalid' => __('Status invalid'), 'ing' => __('Status ing'), 'finish' => __('Status finish'), 'finish-fictitious' => __('Status finish-fictitious')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function grouponLog()
|
||||
{
|
||||
return $this->hasMany(\addons\shopro\model\ActivityGroupon::class, 'groupon_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\goods\Goods::class, 'goods_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\app;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
use addons\shopro\library\traits\model\app\SyncLive;
|
||||
|
||||
class Live extends Model
|
||||
{
|
||||
|
||||
use SoftDelete, SyncLive;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_live';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'live_status_text',
|
||||
'starttime_text',
|
||||
'endtime_text'
|
||||
];
|
||||
|
||||
|
||||
const STATUS_LIVING = 101; // 直播中:表示主播正常开播,直播正常的状态
|
||||
const STATUS_NOTICE = 102; // 未开始:表示主播还未开播
|
||||
const STATUS_LIVED = 103; // 已结束:表示在直播端点击【结束】按钮正常关闭的直播,或直播异常 15 分钟后系统强制结束的直播
|
||||
const STATUS_DISABLED = 104; // 禁播:表示因违规受到运营处罚被禁播
|
||||
const STATUS_PAUSE = 105; // 暂停中:表示在 MP 小程序后台-控制台内操作暂停了直播
|
||||
const STATUS_CATCH = 106; // 异常:表示主播离开、切后台、断网等情况,该直播被判定为异常状态,15 分钟内恢复即可回到正常直播中的状态;如果 15 分钟后还未恢复,直播间会被系统强制结束直播
|
||||
const STATUS_EXPIRED = 107; // 已过期:表示直播间一直未开播,且已
|
||||
|
||||
|
||||
public function getLiveStatusList()
|
||||
{
|
||||
return ['101' => __('Live_status 101'), '102' => __('Live_status 102'), '103' => __('Live_status 103'), '104' => __('Live_status 104'), '105' => __('Live_status 105'), '106' => __('Live_status 106'), '107' => __('Live_status 107')];
|
||||
}
|
||||
|
||||
|
||||
public function getLiveStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['live_status']) ? $data['live_status'] : '');
|
||||
$list = $this->getLiveStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getStarttimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['starttime']) ? $data['starttime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
|
||||
public function getEndtimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['endtime']) ? $data['endtime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setStarttimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
protected function setEndtimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->hasMany(\addons\shopro\model\LiveGoods::class, 'live_id', 'id');
|
||||
}
|
||||
|
||||
public function links()
|
||||
{
|
||||
return $this->hasMany(\addons\shopro\model\LiveLink::class, 'live_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\app;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class ScoreSkuPrice extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_score_goods_sku_price';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
public static function getCurrentGoodsIds()
|
||||
{
|
||||
$scoreGoodsIds = self::group('goods_id')->field('goods_id')->column('goods_id');
|
||||
return $scoreGoodsIds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\chat;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class CustomerService extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_chat';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'lasttime_text',
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['offline' => __('Status offline'), 'online' => __('Status online'), 'busy' => __('Status busy')];
|
||||
}
|
||||
|
||||
|
||||
public function getLasttimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['lasttime']) ? $data['lasttime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
protected function setLasttimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
public function admin () {
|
||||
return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id')->field('id,username,nickname,avatar');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\chat;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class FastReply extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_chat_fast_reply';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterInsert(function ($row) {
|
||||
$pk = $row->getPk();
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function scopeShow($query)
|
||||
{
|
||||
return $query->where('status', 'normal');
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Status normal'), 'hidden' => __('Status hidden')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\chat;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Question extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_chat_question';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterInsert(function ($row) {
|
||||
$pk = $row->getPk();
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeShow($query)
|
||||
{
|
||||
return $query->where('status', 'normal');
|
||||
}
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Status normal'), 'hidden' => __('Status hidden')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\commission;
|
||||
|
||||
|
||||
use app\admin\model\shopro\user\MoneyLog;
|
||||
use app\admin\model\shopro\user\ScoreLog;
|
||||
use addons\shopro\library\commission\Agent as AgentLibrary;
|
||||
use think\Model;
|
||||
use think\Db;
|
||||
|
||||
class Agent extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_commission_agent';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'delay_money',
|
||||
'level_status_text'
|
||||
];
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$status_text = '';
|
||||
|
||||
switch ($data['status']) {
|
||||
case AgentLibrary::AGENT_STATUS_NORMAL:
|
||||
$status_text = '正常';
|
||||
break;
|
||||
case AgentLibrary::AGENT_STATUS_PENDING:
|
||||
$status_text = '审核中';
|
||||
break;
|
||||
case AgentLibrary::AGENT_STATUS_FREEZE:
|
||||
$status_text = '冻结';
|
||||
break;
|
||||
case AgentLibrary::AGENT_STATUS_FORBIDDEN:
|
||||
$status_text = '禁用';
|
||||
break;
|
||||
case AgentLibrary::AGENT_STATUS_NEEDINFO:
|
||||
$status_text = '完善资料';
|
||||
break;
|
||||
case AgentLibrary::AGENT_STATUS_REJECT:
|
||||
$status_text = '审核驳回';
|
||||
break;
|
||||
}
|
||||
|
||||
return $status_text;
|
||||
}
|
||||
|
||||
// 获取分销商待入账佣金
|
||||
public function getDelayMoneyAttr($value, $data)
|
||||
{
|
||||
return number_format(Reward::waiting()->where('agent_id', $data['user_id'])->sum('commission'), 2, '.', '');
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\user\User', 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function agentLevel()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\commission\Level', 'level', 'level');
|
||||
}
|
||||
|
||||
public function parentAgent()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\user\User', 'parent_agent_id', 'id');
|
||||
}
|
||||
|
||||
public function getChildAgentLevelAttr($value, $data){
|
||||
if(!empty($value)) {
|
||||
return json_decode($value, true);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public function setChildAgentLevelAttr($value, $data){
|
||||
return json_encode($value);
|
||||
}
|
||||
|
||||
public function getChildAgentLevel_1Attr($value, $data){
|
||||
if(!empty($value)) {
|
||||
return json_decode($value, true);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public function setChildAgentLevel_1Attr($value, $data){
|
||||
return json_encode($value);
|
||||
}
|
||||
|
||||
public function getLevelStatusTextAttr($value ,$data) {
|
||||
if($data['level_status'] != 0) {
|
||||
$text = Level::get($data['level_status']);
|
||||
if($text) {
|
||||
return $text->name;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\commission;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Config extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_commission_config';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\commission;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Goods extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_commission_goods';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
public function getCommissionRulesAttr($value, $data)
|
||||
{
|
||||
//默认规则
|
||||
if($data['self_rules'] == 0) {
|
||||
return '';
|
||||
}
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
public function getCommissionConfigAttr($value, $data)
|
||||
{
|
||||
//默认规则
|
||||
if($data['self_rules'] == 0) {
|
||||
return '';
|
||||
}
|
||||
if(!$data['commission_config']) {
|
||||
return '';
|
||||
}
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\shopro\goods\Goods', 'goods_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\commission;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Level extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_commission_agent_level';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
public function getCommissionRulesAttr($value, $data)
|
||||
{
|
||||
return json_decode($value, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\commission;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Log extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_commission_log';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'event_text',
|
||||
'oper_type_text'
|
||||
];
|
||||
|
||||
|
||||
public function getEventList()
|
||||
{
|
||||
return [
|
||||
'agent' => '分销商',
|
||||
'level' => '等级变动',
|
||||
'order' => '分销业绩',
|
||||
'team' => '团队',
|
||||
'reward' => '佣金',
|
||||
'share' => '绑定关系',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getOperTypeList()
|
||||
{
|
||||
return [
|
||||
'user' => '用户',
|
||||
'admin' => '管理员',
|
||||
'system' => '系统',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getEventTextAttr($value, $data) {
|
||||
$value = $value ? $value : (isset($data['event']) ? $data['event'] : '');
|
||||
$list = $this->getEventList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getOperTypeTextAttr($value, $data) {
|
||||
$value = $value ? $value : (isset($data['oper_type']) ? $data['oper_type'] : '');
|
||||
$list = $this->getOperTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function oper()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'oper_id')->field('id,nickname,avatar,prevtime,logintime,jointime');
|
||||
}
|
||||
|
||||
|
||||
public function agent()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'agent_id')->field('id,nickname,avatar,prevtime,logintime,jointime');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\commission;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_commission_order';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'commission_reward_status_text',
|
||||
'commission_order_status_text',
|
||||
'commission_event_text'
|
||||
];
|
||||
|
||||
// 分销订单业绩状态 table: commission_order, field: commission_order_status
|
||||
const COMMISSION_ORDER_STATUS_NO = 0; // 不计入
|
||||
const COMMISSION_ORDER_STATUS_YES = 1; // 已计入
|
||||
const COMMISSION_ORDER_STATUS_BACK = -1; // 已退回
|
||||
const COMMISSION_ORDER_STATUS_CANCEL = -2; // 已取消
|
||||
|
||||
// 分销订单佣金处理状态 table: commission_order, field: commission_reward_status
|
||||
const COMMISSION_REWARD_STATUS_WAITING = 0; // 未结算、待入账
|
||||
const COMMISSION_REWARD_STATUS_ACCOUNTED = 1; // 已结算、已入账
|
||||
const COMMISSION_REWARD_STATUS_BACK = -1; // 已退回
|
||||
const COMMISSION_REWARD_STATUS_CANCEL = -2; // 已取消
|
||||
|
||||
// 商品结算方式
|
||||
const COMMISSION_TYPE_PAY_PRICE = 'pay_price'; // 实际支付价
|
||||
const COMMISSION_TYPE_GOODS_PRICE = 'goods_price'; // 商品价
|
||||
|
||||
// 佣金结算方式
|
||||
const COMMISSION_EVENT_PAYED = 'payed'; // 支付后结算
|
||||
const COMMISSION_EVENT_CONFIRM = 'confirm'; // 确认收货后结算
|
||||
const COMMISSION_EVENT_FINISH = 'finish'; // 订单完成结算
|
||||
const COMMISSION_EVENT_ADMIN = 'admin'; // 手动打款
|
||||
|
||||
|
||||
public function getCommissionOrderStatusTextAttr($value, $data)
|
||||
{
|
||||
$status_name = '-';
|
||||
|
||||
switch ($data['commission_order_status']) {
|
||||
case self::COMMISSION_ORDER_STATUS_NO:
|
||||
$status_name = '不计入';
|
||||
break;
|
||||
case self::COMMISSION_ORDER_STATUS_YES:
|
||||
$status_name = '已计入';
|
||||
break;
|
||||
case self::COMMISSION_ORDER_STATUS_BACK:
|
||||
$status_name = '已扣除';
|
||||
break;
|
||||
case self::COMMISSION_ORDER_STATUS_CANCEL:
|
||||
$status_name = '已取消';
|
||||
break;
|
||||
}
|
||||
|
||||
return $status_name;
|
||||
}
|
||||
|
||||
public function getCommissionRewardStatusTextAttr($value, $data)
|
||||
{
|
||||
$status_name = '-';
|
||||
|
||||
switch ($data['commission_reward_status']) {
|
||||
case self::COMMISSION_REWARD_STATUS_WAITING:
|
||||
$status_name = '未结算';
|
||||
break;
|
||||
case self::COMMISSION_REWARD_STATUS_ACCOUNTED:
|
||||
$status_name = '已结算';
|
||||
break;
|
||||
case self::COMMISSION_REWARD_STATUS_BACK:
|
||||
$status_name = '已退回';
|
||||
break;
|
||||
case self::COMMISSION_ORDER_STATUS_CANCEL:
|
||||
$status_name = '已取消';
|
||||
break;
|
||||
}
|
||||
|
||||
return $status_name;
|
||||
}
|
||||
|
||||
public function getCommissionEventTextAttr($value, $data)
|
||||
{
|
||||
$event_name = '-';
|
||||
|
||||
switch ($data['commission_event']) {
|
||||
case self::COMMISSION_EVENT_PAYED:
|
||||
$event_name = '支付后结算';
|
||||
break;
|
||||
case self::COMMISSION_EVENT_CONFIRM:
|
||||
$event_name = '确认收货结算';
|
||||
break;
|
||||
case self::COMMISSION_EVENT_FINISH:
|
||||
$event_name = '订单完成结算';
|
||||
break;
|
||||
case self::COMMISSION_EVENT_ADMIN:
|
||||
$event_name = '手动打款';
|
||||
break;
|
||||
}
|
||||
|
||||
return $event_name;
|
||||
}
|
||||
|
||||
|
||||
public function agent()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'agent_id')->field('id,nickname,avatar,mobile,prevtime,logintime,jointime');
|
||||
}
|
||||
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\order\Order::class, 'order_id');
|
||||
}
|
||||
|
||||
|
||||
public function item()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\order\OrderItem::class, 'order_item_id');
|
||||
}
|
||||
|
||||
public function reward()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\commission\Reward::class, 'commission_order_id');
|
||||
}
|
||||
|
||||
public function buyer()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'buyer_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\commission;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Reward extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_commission_reward';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'type_text'
|
||||
];
|
||||
|
||||
// 分销佣金状态 table: commission_reward, field: status
|
||||
const COMMISSION_REWARD_STATUS_WAITING = 0; // 未结算、待入账
|
||||
const COMMISSION_REWARD_STATUS_ACCOUNTED = 1; // 已结算、已入账
|
||||
const COMMISSION_REWARD_STATUS_BACK = -1; // 已退回
|
||||
const COMMISSION_REWARD_STATUS_CANCEL = -2; // 已取消
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$status_name = '';
|
||||
|
||||
switch ($data['status']) {
|
||||
case self::COMMISSION_REWARD_STATUS_WAITING:
|
||||
$status_name = '待结算';
|
||||
break;
|
||||
case self::COMMISSION_REWARD_STATUS_ACCOUNTED:
|
||||
$status_name = '已结算';
|
||||
break;
|
||||
case self::COMMISSION_REWARD_STATUS_BACK:
|
||||
$status_name = '已退回';
|
||||
break;
|
||||
case self::COMMISSION_REWARD_STATUS_CANCEL:
|
||||
$status_name = '已取消';
|
||||
break;
|
||||
}
|
||||
|
||||
return $status_name;
|
||||
}
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$type_text = '';
|
||||
|
||||
switch ($data['type']) {
|
||||
case 'money':
|
||||
$type_text = '余额';
|
||||
break;
|
||||
case 'score':
|
||||
$type_text = '积分';
|
||||
break;
|
||||
case 'cash':
|
||||
$type_text = '现金(手动打款)';
|
||||
break;
|
||||
case 'change':
|
||||
$type_text = '企业付款到零钱';
|
||||
break;
|
||||
case 'bank':
|
||||
$type_text = '企业付款到银行卡';
|
||||
break;
|
||||
}
|
||||
|
||||
return $type_text;
|
||||
}
|
||||
|
||||
|
||||
public function buyer()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'buyer_id')->field('id,nickname,avatar,mobile,prevtime,logintime,jointime');
|
||||
}
|
||||
|
||||
public function agent()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'agent_id')->field('id,nickname,avatar,mobile,prevtime,logintime,jointime');
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\order\Order::class, 'order_id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 待入账
|
||||
*/
|
||||
public function scopeWaiting($query)
|
||||
{
|
||||
return $query->where('status', 0);
|
||||
}
|
||||
|
||||
public function commissionOrder()
|
||||
{
|
||||
// 要把 下单人信息移除
|
||||
return $this->belongsTo(\app\admin\model\shopro\commission\Order::class, 'commission_order_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\customerservice;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 客服表
|
||||
*/
|
||||
class CustomerService extends Model
|
||||
{
|
||||
|
||||
// 表名,不含前缀
|
||||
protected $name = 'shopro_customer_service';
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\dispatch;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Autosend extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_dispatch_autosend';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\dispatch;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Dispatch extends Model
|
||||
{
|
||||
use SoftDelete;
|
||||
// 表名
|
||||
protected $name = 'shopro_dispatch';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
];
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['express' => __('Type express'), 'selfetch' => __('Type selfetch'), 'store' => __('Type store'), 'autosend' => __('Type autosend')];
|
||||
}
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\dispatch;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Express extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_dispatch_express';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
'area_text'
|
||||
];
|
||||
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['number' => __('Type number'), 'weight' => __('Type weight')];
|
||||
}
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getAreaTextAttr($value, $data)
|
||||
{
|
||||
$province_ids = explode(',', $data['province_ids']);
|
||||
$city_ids = explode(',', $data['city_ids']);
|
||||
$area_ids = explode(',', $data['area_ids']);
|
||||
$ids = array_merge($province_ids, $city_ids, $area_ids);
|
||||
$provinceText = \app\admin\model\shopro\Area::where('id', 'in', $ids)->field('name')->select();
|
||||
$provinceText = array_column($provinceText, 'name');
|
||||
return implode(',', $provinceText);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\dispatch;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class ExpressCompany extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_express';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\dispatch;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Selfetch extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_dispatch_selfetch';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'store_ids_text',
|
||||
'store_ids_list'
|
||||
];
|
||||
|
||||
|
||||
public function getStoreIdsAttr($value, $data)
|
||||
{
|
||||
// 如果为空直接返回空数组,不做 intval 转换
|
||||
return $value ? array_map("intval", explode(',', $data['store_ids'])) : [];
|
||||
}
|
||||
|
||||
public function getStoreIdsTextAttr($value, $data)
|
||||
{
|
||||
if ($data['store_ids']) {
|
||||
$store_ids = explode(',', $data['store_ids']);
|
||||
$store_ids_text = implode(',', \app\admin\model\shopro\store\Store::where('id', 'in', $store_ids)->column('name'));
|
||||
} else {
|
||||
$store_ids_text = '全部到店/自提门店';
|
||||
}
|
||||
|
||||
return $store_ids_text;
|
||||
}
|
||||
|
||||
public function getStoreIdsListAttr($value, $data)
|
||||
{
|
||||
$store_list = [];
|
||||
if ($data['store_ids']) {
|
||||
$store_list = \app\admin\model\shopro\store\Store::where('id', 'in', $data['store_ids'])->field('id, name, address, province_name, city_name, area_name, status')->select();
|
||||
}
|
||||
|
||||
return $store_list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\dispatch;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Store extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_dispatch_store';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'store_ids_text',
|
||||
'store_ids_list'
|
||||
];
|
||||
|
||||
|
||||
public function getStoreIdsAttr($value, $data)
|
||||
{
|
||||
// 如果为空直接返回空数组,不做 intval 转换
|
||||
return $value ? array_map("intval", explode(',', $data['store_ids'])) : [];
|
||||
}
|
||||
|
||||
public function getStoreIdsTextAttr($value, $data)
|
||||
{
|
||||
if ($data['store_ids']) {
|
||||
$store_ids = explode(',', $data['store_ids']);
|
||||
$store_ids_text = implode(',', \app\admin\model\shopro\store\Store::where('id', 'in', $store_ids)->column('name'));
|
||||
} else {
|
||||
$store_ids_text = '全部商家配送门店';
|
||||
}
|
||||
|
||||
return $store_ids_text;
|
||||
}
|
||||
|
||||
public function getStoreIdsListAttr($value, $data)
|
||||
{
|
||||
$store_list = [];
|
||||
if ($data['store_ids']) {
|
||||
$store_list = \app\admin\model\shopro\store\Store::where('id', 'in', $data['store_ids'])->field('id, name, address, province_name, city_name, area_name, status')->select();
|
||||
}
|
||||
|
||||
return $store_list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\goods;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Comment extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_goods_comment';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'replytime_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['show' => __('Status show'), 'hidden' => __('Status hidden')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getReplytimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['replytime']) ? $data['replytime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setReplytimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->belongsTo(Goods::class, 'goods_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\goods;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
use fast\Tree;
|
||||
use app\admin\model\shopro\activity\Activity;
|
||||
|
||||
class Goods extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_goods';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
'status_text',
|
||||
'dispatch_type_text',
|
||||
'activity_type_arr',
|
||||
'activity_type_text_arr',
|
||||
'app_type_text',
|
||||
'service_ids_arr',
|
||||
'dispatch_type_arr',
|
||||
'dispatch_ids_arr',
|
||||
'images_arr'
|
||||
];
|
||||
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['normal' => __('Type normal'), 'virtual' => __('Type virtual')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['up' => __('Status up'), 'hidden' => __('Status hidden'), 'down' => __('Status down')];
|
||||
}
|
||||
|
||||
public function getDispatchTypeList()
|
||||
{
|
||||
return ['express' => __('Dispatch_type express'), 'selfetch' => __('Dispatch_type selfetch'), 'store' => __('Dispatch_type store'), 'autosend' => __('Dispatch_type autosend')];
|
||||
}
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getDispatchTypeArrAttr($value, $data)
|
||||
{
|
||||
$value = isset($data['dispatch_type']) ? $data['dispatch_type'] : '';
|
||||
$valueArr = explode(',', $value);
|
||||
return $valueArr;
|
||||
}
|
||||
|
||||
public function getDispatchTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['dispatch_type']) ? $data['dispatch_type'] : '');
|
||||
$valueArr = explode(',', $value);
|
||||
$list = $this->getDispatchTypeList();
|
||||
return implode(',', array_intersect_key($list, array_flip($valueArr)));
|
||||
}
|
||||
|
||||
public function getActivityTypeArrAttr($value, $data) {
|
||||
$activity_types = $value ? $value : (isset($data['activity_type']) ? $data['activity_type'] : '');
|
||||
$activityTypes = array_values(array_filter(explode(',', $activity_types)));
|
||||
|
||||
return $activityTypes;
|
||||
}
|
||||
|
||||
public function getActivityTypeTextArrAttr($value, $data)
|
||||
{
|
||||
$activityTypes = $this->activity_type_arr;
|
||||
$list = \app\admin\model\shopro\activity\Activity::getTypeList();
|
||||
|
||||
$activityTypeTextArr = [];
|
||||
foreach ($activityTypes as $key => $activity_type) {
|
||||
if (isset($list[$activity_type])) {
|
||||
|
||||
$activityTypeTextArr[$activity_type] = $list[$activity_type];
|
||||
}
|
||||
}
|
||||
|
||||
return $activityTypeTextArr;
|
||||
}
|
||||
|
||||
|
||||
public function getAppTypeTextAttr($value, $data)
|
||||
{
|
||||
return $value = (isset($data['app_type']) && $data['app_type'] == 'score') ? '积分' : '';
|
||||
}
|
||||
|
||||
public function getCategoryIdsArrAttr($value, $data)
|
||||
{
|
||||
$arr = $data['category_ids'] ? explode(',', $data['category_ids']) : [];
|
||||
|
||||
$category_ids_arr = [];
|
||||
if ($arr) {
|
||||
$tree = Tree::instance();
|
||||
$tree->init(collection(\app\admin\model\shopro\Category::order('weigh desc,id desc')->select())->toArray(), 'pid');
|
||||
|
||||
foreach ($arr as $key => $id) {
|
||||
$category_ids_arr[] = $tree->getParentsIds($id, true);
|
||||
}
|
||||
}
|
||||
|
||||
return $category_ids_arr;
|
||||
}
|
||||
|
||||
public function getServiceIdsArrAttr($value, $data)
|
||||
{
|
||||
return (isset($data['service_ids']) && $data['service_ids']) ? array_values(array_filter(array_map("intval", explode(',', $data['service_ids'])))) : [];
|
||||
}
|
||||
|
||||
public function getDispatchIdsArrAttr($value, $data)
|
||||
{
|
||||
return (isset($data['dispatch_ids']) && $data['dispatch_ids']) ? array_values(array_filter(array_map("intval", explode(',', $data['dispatch_ids'])))) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑的时候手动调用
|
||||
*/
|
||||
public function getDispatchGroupIdsArrAttr($value, $data)
|
||||
{
|
||||
$dispatch_ids_arr = $this->dispatch_ids_arr;
|
||||
$dispatchs = \app\admin\model\shopro\dispatch\Dispatch::where('id', 'in', $dispatch_ids_arr)->select();
|
||||
|
||||
$group = [];
|
||||
foreach ($dispatchs as $key => $dispatch) {
|
||||
$group[$dispatch['type']] = $dispatch['id'];
|
||||
}
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
public function getImagesArrAttr($value, $data)
|
||||
{
|
||||
$imagesArray = [];
|
||||
if (!empty($data['images'])) {
|
||||
$imagesArray = explode(',', $data['images']);
|
||||
return $imagesArray;
|
||||
}
|
||||
return $imagesArray;
|
||||
}
|
||||
|
||||
public function getParamsArrAttr($value, $data)
|
||||
{
|
||||
return (isset($data['params']) && $data['params']) ? json_decode($data['params'], true) : [];
|
||||
}
|
||||
|
||||
protected function setDispatchTypeAttr($value)
|
||||
{
|
||||
return is_array($value) ? implode(',', $value) : $value;
|
||||
}
|
||||
|
||||
|
||||
public function scoreGoodsSkuPrice()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\app\ScoreSkuPrice::class, 'goods_id', 'id')
|
||||
->where('status', 'up')->order('id', 'asc');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\goods;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Service extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_goods_service';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\goods;
|
||||
|
||||
use think\Model;
|
||||
use think\Exception;
|
||||
use think\Db;
|
||||
|
||||
class Sku extends Model
|
||||
{
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_goods_sku';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = false;
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterInsert(function ($row) {
|
||||
$pk = $row->getPk();
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function children() {
|
||||
return $this->hasMany(self::class, 'pid', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\goods;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class SkuPrice extends Model
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_goods_sku_price';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'goods_sku_text'
|
||||
];
|
||||
|
||||
public function getGoodsSkuTextAttr($value, $data)
|
||||
{
|
||||
return array_filter(explode(',', $value));
|
||||
}
|
||||
|
||||
public function getVipAttr($value, $data)
|
||||
{
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
public function activitySkuPrice()
|
||||
{
|
||||
return $this->hasOne(\app\admin\model\shopro\activity\ActivitySkuPrice::class, 'sku_price_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\goods;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class StockWarning extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_stock_warning';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->belongsTo(Goods::class, 'goods_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function skuPrice()
|
||||
{
|
||||
return $this->belongsTo(SkuPrice::class, 'goods_sku_price_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\notification;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Config extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_notification_config';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'content_arr'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['0' => __('Status 0'), '1' => __('Status 1')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getContentArrAttr($value, $data)
|
||||
{
|
||||
return (isset($data['content']) && $data['content']) ? json_decode($data['content'], true) : [];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
use addons\shopro\library\traits\model\order\OrderAftersaleScope;
|
||||
use app\admin\model\shopro\activity\Activity;
|
||||
|
||||
class Aftersale extends Model
|
||||
{
|
||||
|
||||
use SoftDelete, OrderAftersaleScope;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_order_aftersale';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
'dispatch_status_text',
|
||||
'aftersale_status_text',
|
||||
'aftersale_status_desc',
|
||||
'refund_status_text',
|
||||
'activity_type_arr',
|
||||
'activity_type_text_arr',
|
||||
];
|
||||
|
||||
|
||||
// 发货状态
|
||||
const DISPATCH_STATUS_NOSEND = 0; // 未发货
|
||||
const DISPATCH_STATUS_SENDED = 1; // 已发货
|
||||
const DISPATCH_STATUS_GETED = 2; // 已收货
|
||||
|
||||
// 售后状态
|
||||
const AFTERSALE_STATUS_CANCEL = -2; // 售后取消
|
||||
const AFTERSALE_STATUS_REFUSE = -1; // 拒绝
|
||||
const AFTERSALE_STATUS_NOOPER = 0; // 未处理
|
||||
const AFTERSALE_STATUS_AFTERING = 1; // 处理中
|
||||
const AFTERSALE_STATUS_OK = 2; // 售后完成
|
||||
|
||||
|
||||
// 退款状态
|
||||
const REFUND_STATUS_REFUSE = -1; // 拒绝退款(不用了)
|
||||
const REFUND_STATUS_NOREFUND = 0; // 未退款
|
||||
const REFUND_STATUS_FINISH = 1; // 同意
|
||||
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['refund' => __('Type refund'), 'return' => __('Type return'), 'other' => __('Type other')];
|
||||
}
|
||||
|
||||
public function getDispatchStatusList()
|
||||
{
|
||||
return ['0' => __('Dispatch_status 0'), '1' => __('Dispatch_status 1'), '2' => __('Dispatch_status 2')];
|
||||
}
|
||||
|
||||
public function getAftersaleStatusList()
|
||||
{
|
||||
return ['-2' => __('Aftersale_status -2'), '-1' => __('Aftersale_status -1'), '0' => __('Aftersale_status 0'), '1' => __('Aftersale_status 1'), '2' => __('Aftersale_status 2')];
|
||||
}
|
||||
|
||||
public function getAftersaleStatusDescList()
|
||||
{
|
||||
return ['-2' => __('Aftersale_status_desc -2'), '-1' => __('Aftersale_status_desc -1'), '0' => __('Aftersale_status_desc 0'), '1' => __('Aftersale_status_desc 1'), '2' => __('Aftersale_status_desc 2')];
|
||||
}
|
||||
|
||||
public function getRefundStatusList()
|
||||
{
|
||||
return ['-1' => __('Refund_status -1'), '0' => __('Refund_status 0'), '1' => __('Refund_status 1')];
|
||||
}
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getActivityTypeArrAttr($value, $data) {
|
||||
$activity_types = $value ? $value : (isset($data['activity_type']) ? $data['activity_type'] : '');
|
||||
$activityTypes = array_values(array_filter(explode(',', $activity_types)));
|
||||
|
||||
return $activityTypes;
|
||||
}
|
||||
|
||||
public function getActivityTypeTextArrAttr($value, $data)
|
||||
{
|
||||
$activityTypes = $this->activity_type_arr;
|
||||
$list = \app\admin\model\shopro\activity\Activity::getTypeList();
|
||||
|
||||
$activityTypeTextArr = [];
|
||||
foreach ($activityTypes as $key => $activity_type) {
|
||||
if (isset($list[$activity_type])) {
|
||||
|
||||
$activityTypeTextArr[$activity_type] = $list[$activity_type];
|
||||
}
|
||||
}
|
||||
|
||||
return $activityTypeTextArr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function getDispatchStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['dispatch_status']) ? $data['dispatch_status'] : '');
|
||||
$list = $this->getDispatchStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getAftersaleStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['aftersale_status']) ? $data['aftersale_status'] : '');
|
||||
$list = $this->getAftersaleStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getAftersaleStatusDescAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['aftersale_status']) ? $data['aftersale_status'] : '');
|
||||
$list = $this->getAftersaleStatusDescList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getRefundStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['refund_status']) ? $data['refund_status'] : '');
|
||||
$list = $this->getRefundStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\order\Order::class, 'order_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function logs()
|
||||
{
|
||||
return $this->hasMany(AftersaleLog::class, 'order_aftersale_id', 'id')->order('id', 'desc');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AftersaleLog extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_order_aftersale_log';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'images_arr'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getImagesArrAttr($value, $data)
|
||||
{
|
||||
$imagesArray = [];
|
||||
if (!empty($data['images'])) {
|
||||
$imagesArray = explode(',', $data['images']);
|
||||
return $imagesArray;
|
||||
}
|
||||
return $imagesArray;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use addons\shopro\library\traits\model\order\OrderOper;
|
||||
use addons\shopro\library\traits\model\order\OrderScope;
|
||||
use addons\shopro\library\traits\model\order\OrderStatus;
|
||||
use app\admin\model\shopro\activity\Activity;
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
use think\Log;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
|
||||
use OrderOper, OrderScope, OrderStatus, SoftDelete;
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_order';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
'status_text',
|
||||
'pay_type_text',
|
||||
'paytime_text',
|
||||
'platform_text',
|
||||
'ext_arr',
|
||||
'status_code',
|
||||
'status_name',
|
||||
'status_desc',
|
||||
'btns',
|
||||
];
|
||||
|
||||
// 订单状态
|
||||
const STATUS_INVALID = -2; // 已失效|交易关闭
|
||||
const STATUS_CANCEL = -1; // 已取消
|
||||
const STATUS_NOPAY = 0; // 未付款
|
||||
const STATUS_PAYED = 1; // 买家已付款
|
||||
const STATUS_FINISH = 2; // 已完成
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['goods' => __('Type goods'), 'score' => __('Type score')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['-2' => __('Status -2'), '-1' => __('Status -1'), '0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')];
|
||||
}
|
||||
|
||||
public function getPayTypeList()
|
||||
{
|
||||
return ['group' => '组合支付', 'wechat' => __('Pay_type wechat'), 'alipay' => __('Pay_type alipay'), 'wallet' => __('Pay_type wallet'), 'score' => __('Pay_type score')];
|
||||
}
|
||||
|
||||
public function getPlatformList()
|
||||
{
|
||||
return ['H5' => __('Platform h5'), 'wxOfficialAccount' => __('Platform wxofficialaccount'), 'wxMiniProgram' => __('Platform wxminiprogram'), 'App' => __('Platform app')];
|
||||
}
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
return $this->getStatus($data, 'status_name');
|
||||
}
|
||||
|
||||
|
||||
public function getPayTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['pay_type']) ? $data['pay_type'] : '');
|
||||
$list = $this->getPayTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getPaytimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['paytime']) ? $data['paytime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
|
||||
public function getPlatformTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['platform']) ? $data['platform'] : '');
|
||||
$list = $this->getPlatformList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
protected function setPaytimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
public function getExtArrAttr($value, $data)
|
||||
{
|
||||
$ext = (isset($data['ext']) && $data['ext']) ? json_decode($data['ext'], true) : [];
|
||||
|
||||
if ($ext && isset($ext['activity_discount_infos']) && $ext['activity_discount_infos']) {
|
||||
|
||||
foreach ($ext['activity_discount_infos'] as $key => $info) {
|
||||
$ext['activity_discount_infos'][$key]['activity_type_text'] = Activity::getTypeList()[$info['activity_type']];
|
||||
$ext['activity_discount_infos'][$key]['format_text'] = \addons\shopro\model\Activity::formatDiscountTags($info['activity_type'], array_merge([
|
||||
'type' => $info['rule_type'],
|
||||
], $info['discount_rule']));
|
||||
}
|
||||
}
|
||||
return $ext;
|
||||
}
|
||||
|
||||
|
||||
protected function getStatus($data, $type)
|
||||
{
|
||||
$btns = [];
|
||||
$status_name = '';
|
||||
$status_desc = '';
|
||||
|
||||
switch ($this->status_code) {
|
||||
case 'cancel':
|
||||
$status_name = '已取消';
|
||||
$status_desc = '买家已取消';
|
||||
break;
|
||||
case 'invalid':
|
||||
$status_name = '交易关闭';
|
||||
$status_desc = '买家未在规定时间内付款,订单将按照预定时间逾期自动关闭';
|
||||
break;
|
||||
case 'nopay':
|
||||
$status_name = '待付款';
|
||||
$status_desc = '买家已下单,等待付款';
|
||||
break;
|
||||
|
||||
// 已支付的
|
||||
case 'commented':
|
||||
$status_name = '已评价';
|
||||
$status_desc = '买家已评价';
|
||||
$btns[] = 'refund'; // 全部退款 直接不申请退款
|
||||
break;
|
||||
case 'nocomment':
|
||||
$status_name = '未评价';
|
||||
$status_desc = '等待买家评价';
|
||||
$btns[] = 'refund'; // 全部退款 直接不申请退款
|
||||
break;
|
||||
case 'noget':
|
||||
$status_name = '商家已发货';
|
||||
$status_desc = '买家若在设置天数内未确认收货,系统将自动确认收货完成订单';
|
||||
$btns[] = 'refund'; // 全部退款 直接不申请退款
|
||||
break;
|
||||
case 'nosend':
|
||||
$is_send_btn = false;
|
||||
$is_send_store_btn = false;
|
||||
foreach ($this->item as $key => $item) {
|
||||
// 获取 item status
|
||||
$dispatchType[] = $item['dispatch_type'];
|
||||
|
||||
// 如果有一个快递的未发货,显示发货按钮
|
||||
if ($item['dispatch_type'] == 'express' && $item['dispatch_status'] == OrderItem::DISPATCH_STATUS_NOSEND) {
|
||||
$is_send_btn = true;
|
||||
}
|
||||
|
||||
// 如果有一个到店,或者商家配送未发货,显示备货按钮
|
||||
if (in_array($item['dispatch_type'], ['store', 'selfetch']) && $item['dispatch_status'] == OrderItem::DISPATCH_STATUS_NOSEND) {
|
||||
$is_send_store_btn = true;
|
||||
}
|
||||
}
|
||||
$dispatchType = array_unique(array_filter($dispatchType));
|
||||
if (in_array('express', $dispatchType)) {
|
||||
$status_name = '买家已付款';
|
||||
$status_desc = '买家已付款,请尽快发货';
|
||||
} else {
|
||||
$status_name = '买家已付款';
|
||||
$status_desc = '买家已付款,请通知相关门店发货';
|
||||
}
|
||||
|
||||
if ($is_send_btn) {
|
||||
$btns[] = 'send'; // 快递发货
|
||||
}
|
||||
|
||||
if ($is_send_store_btn) {
|
||||
$btns[] = 'send_store'; // 总后台也可直接帮门店发货
|
||||
}
|
||||
|
||||
$btns[] = 'refund'; // 全部退款 直接不申请退款
|
||||
break;
|
||||
case 'refund_finish':
|
||||
$status_name = '退款完成';
|
||||
$status_desc = '订单退款完成';
|
||||
break;
|
||||
case 'refund_ing':
|
||||
$status_name = '退款处理中';
|
||||
$status_desc = '请尽快处理退款';
|
||||
$btns[] = 'refund'; // 全部退款 直接不申请退款
|
||||
break;
|
||||
case 'groupon_ing':
|
||||
$status_name = '等待成团';
|
||||
$status_desc = '请等待拼团完成之后再发货';
|
||||
$btns[] = 'refund'; // 全部退款 直接不申请退款
|
||||
break;
|
||||
case 'groupon_invalid':
|
||||
$status_name = '拼团失败';
|
||||
$status_desc = '未在规定时间完成拼团,团已解散';
|
||||
|
||||
break;
|
||||
// 已支付的结束
|
||||
|
||||
case 'finish':
|
||||
$status_name = '交易完成';
|
||||
$status_desc = '交易已完成';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($data['activity_type']) {
|
||||
// 有活动
|
||||
if (strpos($data['activity_type'], 'groupon') !== false) {
|
||||
// 是拼团订单
|
||||
$ext_arr = json_decode($data['ext'], true);
|
||||
if (isset($ext_arr['groupon_id']) && $ext_arr['groupon_id']) {
|
||||
$btns[] = 'groupon'; // 拼团详情
|
||||
} else {
|
||||
if ($data['status'] > 0) {
|
||||
$btns[] = 'groupon_alone'; // 拼团单独购买,支付了,也没有 groupon_id 的情况
|
||||
} else {
|
||||
$btns[] = 'groupon'; // 拼团详情 未支付显示拼团
|
||||
}
|
||||
}
|
||||
} else if (strpos($data['activity_type'], 'seckill') !== false) {
|
||||
// 秒杀订单
|
||||
$btns[] = 'seckill'; // 秒杀
|
||||
}
|
||||
}
|
||||
|
||||
return $type == 'status_name' ? $status_name : ($type == 'btns' ? $btns : $status_desc);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function item()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\order\OrderItem::class, 'order_id');
|
||||
}
|
||||
|
||||
public function express()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\order\OrderExpress::class, 'order_id');
|
||||
}
|
||||
|
||||
|
||||
public function aftersale()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\order\Aftersale::class, 'order_id')->order('id', 'desc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class OrderAction extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_order_action';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
|
||||
public function oper() {
|
||||
// 用户和system 都不需要关联,这里直接只关联 admin,列表循环处理
|
||||
return $this->belongsTo(\app\admin\model\Admin::class, 'oper_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class OrderExpress extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_order_express';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 记得用的时候一定要额外加上 order_id 等于当前订单号
|
||||
*/
|
||||
public function item()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\order\OrderItem::class, 'express_no', 'express_no');
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(\addons\shopro\model\Order::class, 'order_id');
|
||||
}
|
||||
|
||||
|
||||
public function log()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\order\OrderExpressLog::class, 'order_express_id')->order('id', 'desc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class OrderExpressLog extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_order_express_log';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_name'
|
||||
];
|
||||
|
||||
|
||||
public function getStatusNameAttr($value, $data)
|
||||
{
|
||||
$status = substr($data['status'], 0, 1);
|
||||
|
||||
$list = \addons\shopro\model\OrderExpressLog::getStatusList();
|
||||
return isset($list[$status]) ? $list[$status] : '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class OrderInvoice extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_order_invoice';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
'status_text',
|
||||
'confirmtime_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return ['person' => __('Person'), 'company' => __('Company')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['0' => __('Status 0'), '1' => __('Status 1')];
|
||||
}
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getConfirmtimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['confirmtime']) ? $data['confirmtime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setConfirmtimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\user\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\order\Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
use addons\shopro\library\traits\model\order\OrderItemStatus;
|
||||
|
||||
class OrderItem extends Model
|
||||
{
|
||||
|
||||
use OrderItemStatus, SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_order_item';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'dispatch_type_text',
|
||||
'dispatch_status_text',
|
||||
'aftersale_status_text',
|
||||
'comment_status_text',
|
||||
'activity_type_arr',
|
||||
'activity_type_text_arr',
|
||||
'activity_type_text',
|
||||
'refund_status_text',
|
||||
'status_code',
|
||||
'status_name',
|
||||
'status_desc',
|
||||
'btns',
|
||||
'ext_arr'
|
||||
];
|
||||
|
||||
// 发货状态
|
||||
const DISPATCH_STATUS_NOSEND = 0; // 未发货
|
||||
const DISPATCH_STATUS_SENDED = 1; // 已发货
|
||||
const DISPATCH_STATUS_GETED = 2; // 已收货
|
||||
|
||||
|
||||
// 售后状态
|
||||
const AFTERSALE_STATUS_REFUSE = -1; // 驳回
|
||||
const AFTERSALE_STATUS_NOAFTER = 0; // 未申请
|
||||
const AFTERSALE_STATUS_AFTERING = 1; // 申请退款
|
||||
const AFTERSALE_STATUS_OK = 2; // 售后完成
|
||||
|
||||
|
||||
// 退款状态
|
||||
const REFUND_STATUS_REFUSE = -1; // 拒绝退款 // 驳回aftersale_status(状态不会出现)
|
||||
const REFUND_STATUS_NOREFUND = 0; // 退款状态 未申请
|
||||
const REFUND_STATUS_ING = 1; // 申请中 // 不需要申请(状态不会出现)
|
||||
const REFUND_STATUS_OK = 2; // 已同意
|
||||
const REFUND_STATUS_FINISH = 3; // 退款完成
|
||||
|
||||
// 评价状态
|
||||
const COMMENT_STATUS_NO = 0; // 待评价
|
||||
const COMMENT_STATUS_OK = 1; // 已评价
|
||||
|
||||
public function getExtArrAttr($value, $data)
|
||||
{
|
||||
return (isset($data['ext']) && $data['ext']) ? json_decode($data['ext'], true) : [];
|
||||
}
|
||||
|
||||
public function getDispatchStatusList()
|
||||
{
|
||||
return ['0' => __('Dispatch_status 0'), '1' => __('Dispatch_status 1'), '2' => __('Dispatch_status 2')];
|
||||
}
|
||||
|
||||
public function getAftersaleStatusList()
|
||||
{
|
||||
return ['-1' => __('Aftersale_status -1'), '0' => __('Aftersale_status 0'), '1' => __('Aftersale_status 1'), '2' => __('Aftersale_status 2')];
|
||||
}
|
||||
|
||||
public function getCommentStatusList()
|
||||
{
|
||||
return ['0' => __('Comment_status 0'), '1' => __('Comment_status 1')];
|
||||
}
|
||||
|
||||
public function getRefundStatusList()
|
||||
{
|
||||
return ['-1' => __('Refund_status -1'), '0' => __('Refund_status 0'), '1' => __('Refund_status 1'), '2' => __('Refund_status 2'), '3' => __('Refund_status 3')];
|
||||
}
|
||||
|
||||
|
||||
public function getDispatchTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['dispatch_type']) ? $data['dispatch_type'] : '');
|
||||
$list = (new \app\admin\model\shopro\dispatch\Dispatch)->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getDispatchStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['dispatch_status']) ? $data['dispatch_status'] : '');
|
||||
$list = $this->getDispatchStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getAftersaleStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['aftersale_status']) ? $data['aftersale_status'] : '');
|
||||
$list = $this->getAftersaleStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getActivityTypeArrAttr($value, $data) {
|
||||
$activity_types = $value ? $value : (isset($data['activity_type']) ? $data['activity_type'] : '');
|
||||
$activityTypes = array_values(array_filter(explode(',', $activity_types)));
|
||||
|
||||
return $activityTypes;
|
||||
}
|
||||
|
||||
public function getActivityTypeTextArrAttr($value, $data)
|
||||
{
|
||||
$activityTypes = $this->activity_type_arr;
|
||||
$list = \app\admin\model\shopro\activity\Activity::getTypeList();
|
||||
|
||||
$activityTypeTextArr = [];
|
||||
foreach ($activityTypes as $key => $activity_type) {
|
||||
if (isset($list[$activity_type])) {
|
||||
|
||||
$activityTypeTextArr[$activity_type] = $list[$activity_type];
|
||||
}
|
||||
}
|
||||
|
||||
return $activityTypeTextArr;
|
||||
}
|
||||
|
||||
|
||||
public function getActivityTypeTextAttr($value, $data) {
|
||||
$activityTypeTextArr = $this->activityTypeTextArr;
|
||||
return join(',', $activityTypeTextArr);
|
||||
}
|
||||
|
||||
|
||||
public function getCommentStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['comment_status']) ? $data['comment_status'] : '');
|
||||
$list = $this->getCommentStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getRefundStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['refund_status']) ? $data['refund_status'] : '');
|
||||
$list = $this->getRefundStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getStatus($data, $type)
|
||||
{
|
||||
$btns = [];
|
||||
$status_name = '';
|
||||
$status_desc = '';
|
||||
|
||||
$status_code = $this->status_code;
|
||||
|
||||
$item_code = 'null'; // 有售后的时候,第二状态
|
||||
if (strpos($status_code, '|') !== false) {
|
||||
$codes = explode('|', $status_code);
|
||||
$status_code = $codes[0] ?? 'null';
|
||||
$item_code = $codes[1] ?? 'null';
|
||||
}
|
||||
|
||||
switch ($status_code) {
|
||||
case 'null':
|
||||
case 'cancel':
|
||||
case 'invalid':
|
||||
case 'nopay':
|
||||
// 未支付的返回空
|
||||
break;
|
||||
case 'nosend':
|
||||
$status_name = '待发货';
|
||||
$status_desc = '等待卖家发货';
|
||||
|
||||
// 细分订单发货
|
||||
switch ($data['dispatch_type']) {
|
||||
case 'store':
|
||||
$status_name = '待配送';
|
||||
$status_desc = '等待卖家上门配送';
|
||||
$btns[] = 'send_store'; // 总后台也可直接帮门店发货
|
||||
break;
|
||||
case 'selfetch':
|
||||
$status_name = '待备货';
|
||||
$status_desc = '等待卖家备货';
|
||||
$btns[] = 'send_store'; // 总后台也可直接帮门店发货
|
||||
break;
|
||||
case 'express':
|
||||
$btns[] = 'send'; // 发货
|
||||
break;
|
||||
}
|
||||
|
||||
$btns[] = 'refund'; // 退款
|
||||
break;
|
||||
case 'noget':
|
||||
switch ($data['dispatch_type']) {
|
||||
case 'express':
|
||||
$status_name = '待收货';
|
||||
$status_desc = '等待买家收货';
|
||||
$btns[] = 'get'; // 确认收货
|
||||
break;
|
||||
case 'selfetch':
|
||||
$status_name = '待自提/到店';
|
||||
$status_desc = '等待买家提货/到店';
|
||||
break;
|
||||
case 'store':
|
||||
$status_name = '待取货';
|
||||
$status_desc = '卖家上门配送中';
|
||||
break;
|
||||
case 'autosend': // 正常不需要确认收货
|
||||
$status_name = '待收货';
|
||||
$status_desc = '等待买家收货';
|
||||
$btns[] = 'get'; // 确认收货
|
||||
break;
|
||||
}
|
||||
$btns[] = 'refund'; // 售后
|
||||
break;
|
||||
case 'nocomment':
|
||||
$status_name = '待评价';
|
||||
$status_desc = '等待买家评价';
|
||||
$btns[] = 'refund'; // 退款
|
||||
break;
|
||||
case 'commented':
|
||||
$status_name = '已评价';
|
||||
$status_desc = '订单已评价';
|
||||
$btns[] = 'refund'; // 退款
|
||||
break;
|
||||
case 'refund_finish':
|
||||
$status_name = '退款完成';
|
||||
$status_desc = '订单退款完成';
|
||||
break;
|
||||
case 'refund_ing': // 不需要申请退款(状态不会出现)
|
||||
$status_name = '退款处理中';
|
||||
$status_desc = '退款处理中';
|
||||
$btns[] = 'refund'; // 退款
|
||||
break;
|
||||
case 'refund_refuse': // 驳回aftersale_status(状态不会出现)
|
||||
$status_name = '拒绝退款';
|
||||
$status_desc = '卖家拒绝退款';
|
||||
break;
|
||||
case 'after_ing':
|
||||
$status_name = '售后中';
|
||||
$status_desc = '售后处理中';
|
||||
break;
|
||||
case 'after_refuse':
|
||||
case 'after_finish':
|
||||
switch ($status_code) {
|
||||
case 'after_refuse':
|
||||
$status_name = '售后拒绝';
|
||||
$status_desc = '售后申请拒绝';
|
||||
break;
|
||||
case 'after_finish':
|
||||
$status_name = '售后完成';
|
||||
$status_desc = '售后完成';
|
||||
break;
|
||||
}
|
||||
|
||||
// 售后拒绝,或者完成的时候,还可以继续操作订单
|
||||
switch ($item_code) {
|
||||
case 'nosend':
|
||||
if ($data['dispatch_type'] == 'express') {
|
||||
$btns[] = 'send'; // 发货
|
||||
} else if (in_array($data['dispatch_type'], ['store', 'selfetch'])) {
|
||||
$btns[] = 'send_store'; // 备货
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// 只要有售后单号,就显示售后详情按钮
|
||||
$ext_arr = json_decode($data['ext'], true);
|
||||
if (isset($ext_arr['aftersale_id']) && !empty($ext_arr['aftersale_id'])) {
|
||||
$btns[] = 'aftersale_info'; // 查看详情
|
||||
}
|
||||
|
||||
return $type == 'status_name' ? $status_name : ($type == 'btns' ? $btns : $status_desc);
|
||||
}
|
||||
|
||||
|
||||
// 商家配送, 到店自提的门店
|
||||
public function store()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\store\Store::class, 'store_id');
|
||||
}
|
||||
|
||||
|
||||
public function reward()
|
||||
{
|
||||
return $this->hasMany(\app\admin\model\shopro\commission\Reward::class, 'order_item_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function commissionOrder()
|
||||
{
|
||||
return $this->hasOne(\app\admin\model\shopro\commission\Order::class, 'order_item_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
use think\Log;
|
||||
|
||||
class RefundLog extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_refund_log';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text',
|
||||
];
|
||||
|
||||
// 订单状态
|
||||
const STATUS_INVALID = -2;
|
||||
const STATUS_CANCEL = -1;
|
||||
const STATUS_NOPAY = 0;
|
||||
const STATUS_PAYED = 1;
|
||||
const STATUS_FINISH = 2;
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['-1' => __('Status -1'), '0' => __('Status 0'), '1' => __('Status 1')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
// 获取退款单号
|
||||
public static function getSn($user_id)
|
||||
{
|
||||
$rand = $user_id < 9999 ? mt_rand(100000, 99999999) : mt_rand(100, 99999);
|
||||
$order_sn = date('Yhis') . $rand;
|
||||
|
||||
$id = str_pad($user_id, (24 - strlen($order_sn)), '0', STR_PAD_BOTH);
|
||||
|
||||
return 'R' . $order_sn . $id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use addons\shopro\library\traits\model\order\TradeOrderStatus;
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class TradeOrder extends Model
|
||||
{
|
||||
|
||||
use TradeOrderStatus, SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_trade_order';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_code',
|
||||
'status_name',
|
||||
'status_desc',
|
||||
'pay_type_text',
|
||||
'pay_time_text',
|
||||
'platform_text',
|
||||
'ext_arr'
|
||||
];
|
||||
|
||||
// 订单状态
|
||||
const STATUS_INVALID = -2; // 已失效|交易关闭
|
||||
const STATUS_CANCEL = -1; // 已取消
|
||||
const STATUS_NOPAY = 0; // 未付款
|
||||
const STATUS_PAYED = 1; // 买家已付款
|
||||
const STATUS_FINISH = 2; // 已完成
|
||||
|
||||
|
||||
|
||||
|
||||
public function user ()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'user_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\order;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Verify extends Model
|
||||
{
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_verify';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
'status_code',
|
||||
'status_name'
|
||||
];
|
||||
|
||||
|
||||
public function getTypeList()
|
||||
{
|
||||
return [
|
||||
'verify' => '核销券'
|
||||
];
|
||||
}
|
||||
|
||||
public function scopeCanUse($query)
|
||||
{
|
||||
return $query->where('usetime', null)->where(function ($query) {
|
||||
$query->where('expiretime', null)->whereOr('expiretime', '>', time());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getTypeTextAttr($value, $data)
|
||||
{
|
||||
$value = isset($data['type']) ? $data['type'] : '';
|
||||
$list = $this->getTypeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getStatusNameAttr($value, $data)
|
||||
{
|
||||
$status_name = '';
|
||||
switch ($this->status_code) {
|
||||
case 'used':
|
||||
$status_name = '已使用';
|
||||
break;
|
||||
case 'nouse':
|
||||
$status_name = '未使用';
|
||||
break;
|
||||
case 'expire':
|
||||
$status_name = '已过期';
|
||||
break;
|
||||
}
|
||||
|
||||
return $status_name;
|
||||
}
|
||||
|
||||
|
||||
public function getStatusCodeAttr($value, $data)
|
||||
{
|
||||
$status_code = '';
|
||||
|
||||
if ($data['usetime']) {
|
||||
// 已使用
|
||||
$status_code = 'used';
|
||||
} else {
|
||||
// 未使用
|
||||
if (is_null($data['expiretime']) || $data['expiretime'] > time()) {
|
||||
// 不过期,或者过期时间大于当前时间
|
||||
$status_code = 'nouse';
|
||||
} else {
|
||||
// 已过期
|
||||
$status_code = 'expire';
|
||||
}
|
||||
}
|
||||
|
||||
return $status_code;
|
||||
}
|
||||
|
||||
|
||||
public function orderItem()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\order\OrderItem::class, 'order_item_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\shopro\order\Order::class, 'order_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\store;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Apply extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_store_apply';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'openweeks_text',
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getOpenweeksList()
|
||||
{
|
||||
return ['1' => __('Openweeks 1'), '2' => __('Openweeks 2'), '3' => __('Openweeks 3'), '4' => __('Openweeks 4'), '5' => __('Openweeks 5'), '6' => __('Openweeks 6'), '7' => __('Openweeks 7')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['-1' => __('Status -1'), '0' => __('Status 0'), '1' => __('Status 1')];
|
||||
}
|
||||
|
||||
|
||||
public function getOpenweeksTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['openweeks']) ? $data['openweeks'] : '');
|
||||
$valueArr = explode(',', $value);
|
||||
$list = $this->getOpenweeksList();
|
||||
return implode(',', array_intersect_key($list, array_flip($valueArr)));
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
protected function setOpenweeksAttr($value)
|
||||
{
|
||||
return is_array($value) ? implode(',', $value) : $value;
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\app\admin\model\User::class, 'user_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\store;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Store extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_store';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'area_text',
|
||||
'user_ids',
|
||||
'user_ids_list',
|
||||
];
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
return $data['status'] == '1' ? '启用中' : '禁用中';
|
||||
}
|
||||
|
||||
|
||||
public function getAreaTextAttr($value, $data)
|
||||
{
|
||||
$area_text = '';
|
||||
if(isset($data['service_type']) && $data['service_type'] === 'area') {
|
||||
$province_ids = [];
|
||||
if(!empty($data['service_province_ids']) ) {
|
||||
$province_ids = explode(',', $data['service_province_ids']);
|
||||
}
|
||||
|
||||
$city_ids = [];
|
||||
if(!empty($data['service_city_ids'])) {
|
||||
$city_ids = explode(',', $data['service_city_ids']);
|
||||
}
|
||||
|
||||
$area_ids = [];
|
||||
if(!empty($data['service_area_ids'])) {
|
||||
$area_ids = explode(',', $data['service_area_ids']);
|
||||
}
|
||||
$ids = array_merge($province_ids, $city_ids, $area_ids);
|
||||
if(!empty($ids)) {
|
||||
$areaArray = \app\admin\model\shopro\Area::where('id', 'in', $ids)->column('name');
|
||||
$area_text = implode(',', $areaArray);
|
||||
}
|
||||
}
|
||||
return $area_text;
|
||||
}
|
||||
|
||||
public function getUserIdsAttr($value, $data)
|
||||
{
|
||||
$user_store = \think\Db::name('shopro_user_store')->where('store_id', $data['id'])->select();
|
||||
$user_ids = array_column($user_store, 'user_id');
|
||||
return $user_ids;
|
||||
}
|
||||
|
||||
public function getUserIdsListAttr($value, $data)
|
||||
{
|
||||
$user_store = \think\Db::name('shopro_user_store')->where('store_id', $data['id'])->select();
|
||||
$user_ids_list = [];
|
||||
foreach($user_store as $us) {
|
||||
$user_ids_list[] = \app\admin\model\shopro\user\User::where('id', $us['user_id'])->field('id,nickname')->find();
|
||||
}
|
||||
return $user_ids_list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\user;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Coupon extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_user_coupons';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\order\Order', 'use_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function coupons()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\Coupons', 'coupons_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\user;
|
||||
|
||||
use traits\model\SoftDelete;
|
||||
use think\Model;
|
||||
|
||||
class Favorite extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_user_favorite';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\goods\Goods', 'goods_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\user;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Group extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'user_group';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : $data['status'];
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\user;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Oauth extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_user_oauth';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
// 'prevtime_text',
|
||||
// 'logintime_text',
|
||||
// 'jointime_text'
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\user;
|
||||
|
||||
|
||||
use app\admin\model\shopro\user\MoneyLog;
|
||||
use app\admin\model\shopro\user\ScoreLog;
|
||||
use addons\shopro\library\notify\Notifiable;
|
||||
use think\Model;
|
||||
use think\Db;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
use Notifiable;
|
||||
// 表名
|
||||
protected $name = 'user';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
];
|
||||
|
||||
public function getGenderList()
|
||||
{
|
||||
return ['1' => __('Male'), '0' => __('Female')];
|
||||
}
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
|
||||
}
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo('Group', 'group_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function agent()
|
||||
{
|
||||
return $this->hasOne(\app\admin\model\shopro\commission\Agent::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证字段数组值
|
||||
* @param string $value
|
||||
* @param array $data
|
||||
* @return object
|
||||
*/
|
||||
public function getVerificationAttr($value, $data)
|
||||
{
|
||||
$value = array_filter((array)json_decode($value, true));
|
||||
$value = array_merge(['email' => 0, 'mobile' => 0], $value);
|
||||
return (object)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置验证字段
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
public function setVerificationAttr($value)
|
||||
{
|
||||
$value = is_object($value) || is_array($value) ? json_encode($value) : $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\user;
|
||||
|
||||
use traits\model\SoftDelete;
|
||||
use think\Model;
|
||||
|
||||
class View extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_user_view';
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
public function goods()
|
||||
{
|
||||
return $this->belongsTo('\app\admin\model\shopro\goods\Goods', 'goods_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\user;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 会员钱包日志模型
|
||||
*/
|
||||
class WalletLog extends Model
|
||||
{
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_user_wallet_log';
|
||||
// 开启自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'oper'
|
||||
];
|
||||
|
||||
public function getOperAttr($value, $data)
|
||||
{
|
||||
return \addons\shopro\library\Oper::get($data['oper_type'], $data['oper_id']);
|
||||
}
|
||||
|
||||
public function getWalletAttr($value, $data)
|
||||
{
|
||||
if($data['wallet_type'] === 'score') {
|
||||
return intval($data['wallet']);
|
||||
}else {
|
||||
return $data['wallet'];
|
||||
}
|
||||
}
|
||||
|
||||
public function getBeforeAttr($value, $data)
|
||||
{
|
||||
if($data['wallet_type'] === 'score') {
|
||||
return intval($data['before']);
|
||||
}else {
|
||||
return $data['before'];
|
||||
}
|
||||
}
|
||||
|
||||
public function getAfterAttr($value, $data)
|
||||
{
|
||||
if($data['wallet_type'] === 'score') {
|
||||
return intval($data['after']);
|
||||
}else {
|
||||
return $data['after'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\wechat;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Fans extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'shopro_wechat_fans';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'subscribetime_text',
|
||||
'is_subscribe_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getIsSubscribeList()
|
||||
{
|
||||
return ['0' => __('Is_subscribe 0'), '1' => __('Is_subscribe 1')];
|
||||
}
|
||||
|
||||
|
||||
public function getSubscribetimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['subscribetime']) ? $data['subscribetime'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
|
||||
public function getIsSubscribeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['is_subscribe']) ? $data['is_subscribe'] : '');
|
||||
$list = $this->getIsSubscribeList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
protected function setSubscribetimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\wechat;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Wechat extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'shopro_wechat';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户