4
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"php.version": "8.2"
|
||||
}
|
||||
@@ -5,6 +5,7 @@ use support\Response;
|
||||
use Shopwwi\WebmanFilesystem\FilesystemFactory;
|
||||
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
use taoser\facade\Validate;
|
||||
/**
|
||||
* 基础控制器
|
||||
* @Apidoc\NotParse()
|
||||
@@ -62,14 +63,48 @@ class BaseController
|
||||
*/
|
||||
function upload(Request $request)
|
||||
{
|
||||
try{
|
||||
$user = \support\Jwt::getUser();
|
||||
}catch(\Exception $e){
|
||||
$user = ['id'=>0];
|
||||
}
|
||||
$savePath = $request->post('savePath','files');
|
||||
|
||||
$validate = Validate::rule('savePath', 'alphaNum');
|
||||
$data = ['savePath' => $savePath];
|
||||
if (!$validate->check($data)) {
|
||||
return $this->fail( '参数错误:'.$validate->getError());
|
||||
}
|
||||
$savePath = trim($savePath,'/');
|
||||
$savePath = 'upload/'.$savePath.'/'.$user['id'];
|
||||
\support\Log::alert('savePath:'.$savePath);
|
||||
$mimetype = explode(',',Config('site.upload_mimetype'));
|
||||
$maxsize = Config('site.upload_maxsize')*1024*1024;
|
||||
//多文件上传
|
||||
$files = $request->file();
|
||||
try {
|
||||
$result = Storage::adapter('public')
|
||||
->path('upload/files')
|
||||
->size(1024*1024*10)
|
||||
->extYes(['image/jpeg','image/png'])
|
||||
->uploads($files,0,1024*1024*100,false);
|
||||
->path($savePath)
|
||||
->size($maxsize)
|
||||
->extYes($mimetype)
|
||||
->uploads($files,0,$maxsize * count($files),false);
|
||||
$save_datas = [];
|
||||
foreach($result as $k=>$fileinfo){
|
||||
$save_datas[] = [
|
||||
'user_id' => $user['id'],
|
||||
'category' => 'default',
|
||||
'title' => $fileinfo->origin_name,
|
||||
'path' => $fileinfo->file_name,
|
||||
'size' => $fileinfo->size,
|
||||
'mime_type' => $fileinfo->mime_type,
|
||||
'extension' => $fileinfo->extension,
|
||||
'height' => $fileinfo->file_height,
|
||||
'width' => $fileinfo->file_width,
|
||||
'sha1' => sha1_file(public_path($fileinfo->file_name)),
|
||||
'use_count' => 0,
|
||||
];
|
||||
}
|
||||
\app\model\Files::insertAll($save_datas);
|
||||
return $this->success(__('successful'),$result);
|
||||
}catch (\Exception $e){
|
||||
return $this->error($e->getMessage());
|
||||
|
||||
@@ -12,6 +12,7 @@ use Shopwwi\WebmanFilesystem\FilesystemFactory;
|
||||
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
|
||||
use think\facade\Db;
|
||||
/**
|
||||
* 公共接口
|
||||
*/
|
||||
@@ -34,7 +35,7 @@ class CommonController extends BaseController{
|
||||
*
|
||||
* @Apidoc\Query("version", type="string", require=true, desc="版本号")
|
||||
*/
|
||||
public function init()
|
||||
public function init(Request $request)
|
||||
{
|
||||
$lang = input('lang','en-US');
|
||||
locale( $lang);
|
||||
@@ -42,9 +43,9 @@ class CommonController extends BaseController{
|
||||
$disallowFields = [
|
||||
'api_token','reward_time_limit',
|
||||
'mail_type','mail_smtp_host','mail_smtp_port','mail_smtp_user','mail_smtp_pass','mail_verify_type','mail_from',
|
||||
'attachmentcategory','categorytype','cdkey_category','configgroup','flagtype',
|
||||
'attachment_category','categorytype','cdkey_category','configgroup','flagtype',
|
||||
'languages','forbiddenip','fixedpage','admin_login_captcha',
|
||||
'mimetype','multipart','multiple','chunksize','classname','thumbstyle','previewtpl','timeout','maxsize','container',
|
||||
'upload_mimetype','upload_multipart','upload_multiple','upload_thumbstyle','upload_previewtpl','upload_timeout','upload_maxsize',
|
||||
'yeji_jicha_reward','suanli_rate','agent_expirs_retention','allow_currencys','allow_balance_log',
|
||||
'agent_commission_total_rate','agent_commission_layer_rate','differential_commission_total_rate'
|
||||
];
|
||||
@@ -58,13 +59,30 @@ class CommonController extends BaseController{
|
||||
$config['server_status_list'] = \app\enum\ServerStatus::toArray();
|
||||
return $this->success(__('successful'), $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* test
|
||||
* @Apidoc\Query("lang", type="string",require=true, desc="邮箱")
|
||||
* @Apidoc\Method ("GET")
|
||||
* 验证是否升级
|
||||
*/
|
||||
function test(){
|
||||
return $this->error(__('Invalid parameters'));
|
||||
public function checkUpgrade(Request $request)
|
||||
{
|
||||
$field = 'id,type,force,source,version,content';
|
||||
$verUpdate = new \app\model\Version;
|
||||
$version = Input('version');
|
||||
$platform = Input('platform');
|
||||
$version_wgt = Input('version_wgt');
|
||||
|
||||
// 查询整包、外链数据
|
||||
$update_data = $verUpdate->where(['type'=>['in', '0,2'], 'status'=>1, 'version'=>['>', $version], 'platform'=>$platform])->field($field)->order('id desc')->find();
|
||||
if($update_data) {
|
||||
return $this->success('',$update_data);
|
||||
}
|
||||
|
||||
// 查询WGT数据
|
||||
$update_wgt_data = $verUpdate->where(['type'=>1, 'status'=>1, 'version_wgt'=>['>', $version_wgt], 'platform'=>$platform])->field($field)->order('id desc')->find();
|
||||
if($update_wgt_data) {
|
||||
return $this->success('',$update_wgt_data);
|
||||
}
|
||||
return $this->success('',[]);
|
||||
}
|
||||
/**
|
||||
* 注册会员
|
||||
@@ -84,49 +102,42 @@ class CommonController extends BaseController{
|
||||
$username = input('username');
|
||||
$mobile = input('mobile');
|
||||
$invite_code = input('invite_code');
|
||||
if ($email && !Validate::is($email, "email")) {
|
||||
return $this->error(__('Email is incorrect'));
|
||||
$type = input('type');
|
||||
if (!in_array($type,Config('site.user_register_way')) ) {
|
||||
return $this->error(__('Unknown register way'));
|
||||
}
|
||||
if ($mobile && !Validate::regex($mobile, "^1\d{10}$")) {
|
||||
return $this->error(__('Mobile is incorrect'));
|
||||
}
|
||||
if(Config('site.user_register_way') == 'mobile'){
|
||||
if (!$mobile) {
|
||||
return $this->error(__('Invalid parameters'));
|
||||
}
|
||||
$username = $mobile;
|
||||
captcha_verfiy('mobile','register',$mobile);
|
||||
}else if(Config('site.user_register_way') == 'email'){
|
||||
if (!$email) {
|
||||
return $this->error(__('Invalid parameters'));
|
||||
}
|
||||
if ($email && !Validate::is($email, "email")) {
|
||||
if ($type == 'email') {
|
||||
if(!$email || !Validate::is($email, "email")){
|
||||
return $this->error(__('Email is incorrect'));
|
||||
}
|
||||
$username = $email;
|
||||
captcha_verfiy('email','register',$email);
|
||||
}else{
|
||||
if (!$username) {
|
||||
return $this->error(__('Invalid parameters'));
|
||||
unset($mobile);
|
||||
//captcha_verfiy('email','register',$email,false);
|
||||
}
|
||||
if ($type == 'mobile') {
|
||||
if(!$mobile || !Validate::regex($mobile, "^1\d{10}$")){
|
||||
return $this->error(__('Mobile is incorrect'));
|
||||
}
|
||||
$username = $mobile;
|
||||
unset($email);
|
||||
//captcha_verfiy('mobile','register',$mobile,false);
|
||||
}
|
||||
if ($type == 'username') {
|
||||
if(!$email || !Validate::is($email, "email")){
|
||||
return $this->error(__('Username is incorrect'));
|
||||
}
|
||||
}
|
||||
if (!$password) {
|
||||
return $this->error(__('Invalid parameters'));
|
||||
}
|
||||
$extends = [
|
||||
'role_id' => 0,
|
||||
'group' => 0,
|
||||
'avatar' => '/static/img/avatar.png',
|
||||
];
|
||||
// if (!$trade_password) {
|
||||
// return $this->error(__('Invalid trade password'));
|
||||
// }else{
|
||||
// $extends['trade_password'] = \plugin\admin\app\common\Util::passwordHash($trade_password);
|
||||
// }
|
||||
//邀请码
|
||||
if(!$invite_code){
|
||||
return $this->error(__('Invalid invite code'));
|
||||
}
|
||||
if ($invite_code)
|
||||
{
|
||||
if(strlen($invite_code) == 12){
|
||||
//系统生产的一次性推荐吗
|
||||
$inviteModel = \app\model\Invitecode::where('code',$invite_code)->find();
|
||||
@@ -143,6 +154,20 @@ class CommonController extends BaseController{
|
||||
}
|
||||
$extends['parent_id'] = $inviter_user['id'];
|
||||
}
|
||||
}else{
|
||||
//return $this->error(__('Invalid invite code'));
|
||||
}
|
||||
$extends = [
|
||||
'role_id' => 0,
|
||||
'group_id' => 0,
|
||||
'avatar' => '/static/img/avatar.png',
|
||||
];
|
||||
// validate(\app\validate\User::class)
|
||||
// ->scene('edit')
|
||||
// ->check([
|
||||
// 'name' => 'thinkphp',
|
||||
// 'email' => 'thinkphp@qq.com',
|
||||
// ]);
|
||||
try {
|
||||
$user = \support\Jwt::register($username, $password, $email, $mobile, $extends);
|
||||
if($inviteModel){
|
||||
@@ -150,8 +175,15 @@ class CommonController extends BaseController{
|
||||
$inviteModel->save();
|
||||
}
|
||||
$data = ['userinfo' => $user];
|
||||
// if ($type == 'email') {
|
||||
// captcha_verfiy('email','register',$email,true);
|
||||
// }else if ($type == 'mobile') {
|
||||
// captcha_verfiy('mobile','register',$mobile,true);
|
||||
// }else{
|
||||
// captcha_verfiy('image','register',$mobile,true);
|
||||
// }
|
||||
return $this->success(__('Sign up successful'), $data);
|
||||
} catch (\Throwable $e) {
|
||||
} catch (\Exception $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -163,12 +195,30 @@ class CommonController extends BaseController{
|
||||
*/
|
||||
public function login(Request $request){
|
||||
$username = input('username');
|
||||
$mobile = input('mobile');
|
||||
$email = input('email');
|
||||
$password = input('password');
|
||||
if (!$username || !$password) {
|
||||
return $this->fail(__('Invalid username or password'));
|
||||
$type = input(param: 'type');
|
||||
if (!$password) {
|
||||
return $this->fail(__('Invalid username or password').'0');
|
||||
}
|
||||
if($type == 'mobile'){
|
||||
if (!$mobile ) {
|
||||
return $this->fail(__('Invalid username or password').'1');
|
||||
}
|
||||
$username = $mobile;
|
||||
}else if($type == 'email'){
|
||||
if (!$email ) {
|
||||
return $this->fail(__('Invalid username or password').'2');
|
||||
}
|
||||
$username = $email;
|
||||
}else{
|
||||
if (!$username ) {
|
||||
return $this->fail(__('Invalid username or password').'3');
|
||||
}
|
||||
}
|
||||
try{
|
||||
$user = \support\Jwt::login($username, $password,'username');
|
||||
$user = \support\Jwt::login($username, $password,$type);
|
||||
if($user === false){
|
||||
return $this->fail(\support\Jwt::getError());
|
||||
}
|
||||
@@ -218,15 +268,15 @@ class CommonController extends BaseController{
|
||||
$user = false;
|
||||
}
|
||||
if($user){
|
||||
captcha_verfiy('mobile','reset_trade_pwd',$user->mobile);
|
||||
captcha_verfiy('mobile','reset_pwd',$user->mobile);
|
||||
}
|
||||
}else{
|
||||
if ($email && Validate::is($email, "email")) {
|
||||
captcha_verfiy('email','reset_trade_pwd',$email);
|
||||
captcha_verfiy('email','reset_pwd',$email);
|
||||
$user = UserModel::getByEmail($email);
|
||||
}
|
||||
if ($mobile && Validate::regex($mobile, "^1\d{10}$")) {
|
||||
captcha_verfiy('mobile','reset_trade_pwd',$mobile);
|
||||
captcha_verfiy('mobile','reset_pwd',$mobile);
|
||||
$user = UserModel::getByMobile($mobile);
|
||||
}
|
||||
}
|
||||
@@ -309,6 +359,7 @@ class CommonController extends BaseController{
|
||||
* @Apidoc\Param("email", type="string",require=true, desc="邮箱,可选")
|
||||
*/
|
||||
public function captcha(Request $request){
|
||||
$debug = true;
|
||||
$request->input('type');
|
||||
$type = $request->input('type');
|
||||
$event = $request->input('event');
|
||||
@@ -331,17 +382,19 @@ class CommonController extends BaseController{
|
||||
return $this->fail(__('Only one verification code can be sent within %second% seconds',['%second%'=>$expris]));
|
||||
}
|
||||
}
|
||||
$code =\support\Random::numeric(4);
|
||||
$code =\support\Random::numeric(6);
|
||||
$list[$code] = time();
|
||||
cache($key,$list);
|
||||
cache('exp_'.$key,time());
|
||||
addJob([
|
||||
'email' => $email,
|
||||
'title' => __("Mt email code"),
|
||||
'event' => $event,
|
||||
'code' => $code
|
||||
],'Email');
|
||||
return $this->success(__('Email sent successfully'));
|
||||
// addJob([
|
||||
// 'email' => $email,
|
||||
// 'title' => __("Mt email code"),
|
||||
// 'event' => $event,
|
||||
// 'code' => $code
|
||||
// ],'Email');
|
||||
return $this->success(__('Email sent successfully'),[
|
||||
'code'=> $debug ? $code : ''
|
||||
]);
|
||||
}elseif($type == 'mobile'){
|
||||
$mobile = $request->input('mobile');
|
||||
if(!$mobile){
|
||||
@@ -364,7 +417,7 @@ class CommonController extends BaseController{
|
||||
return $this->fail(__('Only one verification code can be sent within %second% seconds',['%second%'=>$expris]));
|
||||
}
|
||||
}
|
||||
$code =\support\Random::numeric(4);
|
||||
$code =\support\Random::numeric(6);
|
||||
$list[$code] = time();
|
||||
cache($key,$list);
|
||||
cache('exp_'.$key,time());
|
||||
@@ -373,7 +426,9 @@ class CommonController extends BaseController{
|
||||
'event' => $event,
|
||||
'code' => $code
|
||||
],'Sms');
|
||||
return $this->success(__('SMS sent successfully'));
|
||||
return $this->success(__('SMS sent successfully'),[
|
||||
'code'=> $debug ? $code : ''
|
||||
]);
|
||||
}else{
|
||||
//TODO 图像验证码没有唯一的KEY
|
||||
$key = 'captcha_'.$event.'_';
|
||||
@@ -406,13 +461,14 @@ class CommonController extends BaseController{
|
||||
*/
|
||||
public function verify_captcha(Request $request): Response
|
||||
{
|
||||
$type = $request->input('type');
|
||||
$email = $request->post('email');
|
||||
$mobile = $request->input('mobile');
|
||||
$event = $request->post('event');
|
||||
try {
|
||||
if($email){
|
||||
if($type == 'email'){
|
||||
$result = captcha_verfiy('email', $event , $email,false);
|
||||
}elseif($mobile){
|
||||
}elseif($type == 'mobile'){
|
||||
$result = captcha_verfiy('mobile', $event , $mobile,false);
|
||||
}else{
|
||||
$result = captcha_verfiy('image', $event , '',false);
|
||||
@@ -425,24 +481,4 @@ class CommonController extends BaseController{
|
||||
}
|
||||
return $this->success(__('successful'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("上传")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
function upload(Request $request)
|
||||
{
|
||||
//多文件上传
|
||||
$files = $request->file();
|
||||
try {
|
||||
$result = Storage::adapter('public')
|
||||
->path('upload/files')
|
||||
->size(1024*1024*10)
|
||||
->extYes(['image/jpeg','image/png'])
|
||||
->uploads($files,0,1024*1024*100,false);
|
||||
return $this->success(__('successful'),$result);
|
||||
}catch (\Exception $e){
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,357 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
use Shopwwi\WebmanFilesystem\FilesystemFactory;
|
||||
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||
use app\model\User as UserModel;
|
||||
use app\model\Realname as RealnameModel;
|
||||
use app\model\FriendCircle as FriendCircleModel;
|
||||
use app\model\FriendCircleLike as FriendCircleLikeModel;
|
||||
use app\model\FriendCircleComment as FriendCircleCommentModel;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use taoser\facade\Validate;
|
||||
use support\think\Db;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
|
||||
/**
|
||||
* 朋友圈
|
||||
*/
|
||||
class FriendCircleController extends BaseController{
|
||||
/**
|
||||
* 不需要鉴权的方法
|
||||
* @var array
|
||||
*/
|
||||
public $noNeedAuth = ['*'];
|
||||
|
||||
/**
|
||||
* 无需登录及鉴权的方法
|
||||
* @var array
|
||||
*/
|
||||
public $noNeedLogin = [];
|
||||
/**
|
||||
* 朋友圈设置
|
||||
* @return void
|
||||
*/
|
||||
function info(Request $request): Response{
|
||||
$res = $this->newcount($request);
|
||||
$response = $res->rawBody();
|
||||
$json = json_decode($response,true);
|
||||
$json['data']['settings'] = [
|
||||
'bg' => '',
|
||||
];
|
||||
$json['data']['last_unread_item'] = [
|
||||
'user_id' => '1',
|
||||
'avatar' => '',
|
||||
'nickname' => '',
|
||||
];
|
||||
$res->withBody(json_encode($json));
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* @Apidoc\Title("列表")
|
||||
* @Apidoc\Method("GET")
|
||||
* @Apidoc\Query("page", type="int", require=true, desc="页码",default=1)
|
||||
* @Apidoc\Query("limit", type="int", require=true, desc="分页大小",default=10)
|
||||
* @Apidoc\Query("user_id", type="int", require=false, desc="用户ID,不传则获取所有")
|
||||
*/
|
||||
function list(Request $request): Response
|
||||
{
|
||||
$page = (int)$request->get('page', 1);
|
||||
$limit = (int)$request->get('limit', 10);
|
||||
$user_id = $request->get('user_id', 0);
|
||||
|
||||
$query = FriendCircleModel::where('status', 1)
|
||||
->with(['user' => function($query) {
|
||||
$query->field('id,nickname,avatar');
|
||||
}])
|
||||
->order('created_at', 'desc');
|
||||
|
||||
// 如果指定了用户ID,只获取该用户的朋友圈
|
||||
if ($user_id > 0) {
|
||||
$query->where('user_id', $user_id);
|
||||
}
|
||||
|
||||
$list = $query->paginate([
|
||||
'list_rows' => $limit,
|
||||
'page' => $page,
|
||||
]);
|
||||
|
||||
$current_user = \support\Jwt::getUser();
|
||||
$current_user_id = $current_user ? $current_user->id : 0;
|
||||
|
||||
// 处理每条朋友圈数据
|
||||
$items = $list->items();
|
||||
$list->each(function($item) use ($current_user_id){
|
||||
// 获取点赞列表
|
||||
$likes = FriendCircleLikeModel::where('circle_id', $item->id)
|
||||
->with(['user' => function($query) {
|
||||
$query->field('id,nickname,avatar');
|
||||
}])
|
||||
->order('created_at', 'desc')
|
||||
->limit(20)
|
||||
->select();
|
||||
|
||||
// 检查当前用户是否已点赞
|
||||
$is_liked = false;
|
||||
if ($current_user_id > 0) {
|
||||
$is_liked = FriendCircleLikeModel::where('circle_id', $item->id)
|
||||
->where('user_id', $current_user_id)
|
||||
->count() > 0;
|
||||
}
|
||||
|
||||
// 获取评论列表(最新10条)
|
||||
$comments = FriendCircleCommentModel::where('circle_id', $item->id)
|
||||
->where('status', 1)
|
||||
->with(['user' => function($query) {
|
||||
$query->field('id,nickname,avatar');
|
||||
}, 'replyUser' => function($query) {
|
||||
$query->field('id,nickname,avatar');
|
||||
}])
|
||||
->order('created_at', 'asc')
|
||||
->limit(10)
|
||||
->select();
|
||||
|
||||
// 格式化数据
|
||||
$item->is_liked = $is_liked;
|
||||
$item->likes = $likes;
|
||||
$item->comments = $comments;
|
||||
|
||||
// 处理图片URL
|
||||
if (!empty($item->files)) {
|
||||
$files = is_array($item->files) ? $item->files : json_decode($item->files, true);
|
||||
if (is_array($files)) {
|
||||
$item->files = array_map(function($file) {
|
||||
return cdnurl($file);
|
||||
}, $files);
|
||||
} else {
|
||||
$item->files = [];
|
||||
}
|
||||
} else {
|
||||
$item->files = [];
|
||||
}
|
||||
|
||||
// 处理用户头像
|
||||
if ($item->user && $item->user->avatar) {
|
||||
$item->user->avatar = cdnurl($item->user->avatar);
|
||||
}
|
||||
|
||||
// 处理点赞用户头像
|
||||
foreach ($item->likes as $like) {
|
||||
if ($like->user && $like->user->avatar) {
|
||||
$like->user->avatar = cdnurl($like->user->avatar);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理评论用户头像
|
||||
foreach ($item->comments as $comment) {
|
||||
if ($comment->user && $comment->user->avatar) {
|
||||
$comment->user->avatar = cdnurl($comment->user->avatar);
|
||||
}
|
||||
if ($comment->replyUser && $comment->replyUser->avatar) {
|
||||
$comment->replyUser->avatar = cdnurl($comment->replyUser->avatar);
|
||||
}
|
||||
}
|
||||
return $item;
|
||||
});
|
||||
|
||||
return $this->success('ok', $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("最近更新的数量")
|
||||
* @Apidoc\Method("POST")
|
||||
* @Apidoc\Param("last_see", type="string",require=false, desc="最近查看的时间戳")
|
||||
*/
|
||||
function newcount(Request $request): Response
|
||||
{
|
||||
$user = \support\Jwt::getUser();
|
||||
if (!$user) {
|
||||
return $this->fail('请先登录');
|
||||
}
|
||||
|
||||
$last_see = $request->post('last_see');
|
||||
if (empty($last_see)) {
|
||||
$last_see = cache('last_see_' . $user->id);
|
||||
}
|
||||
|
||||
if (empty($last_see)) {
|
||||
$last_see = time() - 86400; // 默认24小时前
|
||||
} else {
|
||||
// 保存最后查看时间
|
||||
cache('last_see_' . $user->id, $last_see);
|
||||
}
|
||||
|
||||
// 统计从上次查看时间到现在新增的朋友圈数量
|
||||
$count = FriendCircleModel::where('status', 1)
|
||||
->where('created_at', '>', $last_see)
|
||||
->count();
|
||||
|
||||
return $this->success('ok', ['count' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("发布朋友圈")
|
||||
* @Apidoc\Method("POST")
|
||||
* @Apidoc\Param("body", type="string",require=false, desc="内容")
|
||||
* @Apidoc\Param("files", type="string",require=false, desc="图片列表(JSON数组)")
|
||||
*/
|
||||
function create(Request $request): Response
|
||||
{
|
||||
$user = \support\Jwt::getUser();
|
||||
if (!$user) {
|
||||
return $this->fail('请先登录');
|
||||
}
|
||||
|
||||
$body = $request->post('content', '');
|
||||
$files = $request->post('files', '');
|
||||
$address = $request->post('address', '');
|
||||
$releaseType = $request->post('releaseType', '');
|
||||
// 验证内容
|
||||
if (empty($body)) {
|
||||
return $this->fail('什么内容都木有啊');
|
||||
}
|
||||
|
||||
|
||||
// 处理图片列表
|
||||
$files_array = [];
|
||||
if (!empty($files)) {
|
||||
if (is_string($files)) {
|
||||
$files_array = json_decode($files, true);
|
||||
} elseif (is_array($files)) {
|
||||
$files_array = $files;
|
||||
}
|
||||
|
||||
if (!is_array($files_array)) {
|
||||
return $this->fail('图片列表格式错误');
|
||||
}
|
||||
|
||||
// 限制图片数量
|
||||
if (count($files_array) > 9) {
|
||||
return $this->fail('最多只能上传9张图片');
|
||||
}
|
||||
}
|
||||
|
||||
// 创建朋友圈动态
|
||||
$circle = FriendCircleModel::create([
|
||||
'user_id' => $user->id,
|
||||
'releaseType' => $releaseType,
|
||||
'body' => $body,
|
||||
'files' => $files_array,
|
||||
'address' => $address,
|
||||
'status' => 1,
|
||||
]);
|
||||
|
||||
return $this->success('发布成功', ['id' => $circle->id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("发表评论")
|
||||
* @Apidoc\Method("POST")
|
||||
* @Apidoc\Param("body", type="string",require=true, desc="内容")
|
||||
* @Apidoc\Param("id", type="int",require=true, desc="朋友圈动态ID")
|
||||
* @Apidoc\Param("reply_user_id", type="int",require=false, desc="回复的用户ID(回复评论时使用)")
|
||||
*/
|
||||
function comment(Request $request): Response
|
||||
{
|
||||
$user = \support\Jwt::getUser();
|
||||
if (!$user) {
|
||||
return $this->fail('请先登录');
|
||||
}
|
||||
|
||||
$body = $request->post('body', '');
|
||||
$circle_id = (int)$request->post('id', 0);
|
||||
$reply_user_id = (int)$request->post('reply_user_id', 0);
|
||||
|
||||
if (empty($body)) {
|
||||
return $this->fail('评论内容不能为空');
|
||||
}
|
||||
|
||||
if ($circle_id <= 0) {
|
||||
return $this->fail('朋友圈动态ID错误');
|
||||
}
|
||||
|
||||
// 检查朋友圈动态是否存在
|
||||
$circle = FriendCircleModel::where('id', $circle_id)
|
||||
->where('status', 1)
|
||||
->find();
|
||||
|
||||
if (!$circle) {
|
||||
return $this->fail('朋友圈动态不存在');
|
||||
}
|
||||
|
||||
// 如果回复评论,检查被回复的用户是否存在
|
||||
if ($reply_user_id > 0) {
|
||||
$reply_user = UserModel::where('id', $reply_user_id)->find();
|
||||
if (!$reply_user) {
|
||||
return $this->fail('被回复的用户不存在');
|
||||
}
|
||||
}
|
||||
|
||||
// 创建评论
|
||||
$comment = FriendCircleCommentModel::create([
|
||||
'circle_id' => $circle_id,
|
||||
'user_id' => $user->id,
|
||||
'reply_user_id' => $reply_user_id,
|
||||
'body' => $body,
|
||||
'status' => 1,
|
||||
]);
|
||||
|
||||
// 更新朋友圈评论数
|
||||
$circle->comment_count = FriendCircleCommentModel::where('circle_id', $circle_id)
|
||||
->where('status', 1)
|
||||
->count();
|
||||
$circle->save();
|
||||
|
||||
return $this->success('评论成功', ['id' => $comment->id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("点赞")
|
||||
* @Apidoc\Method("POST")
|
||||
* @Apidoc\Param("id", type="int",require=true, desc="朋友圈动态ID")
|
||||
*/
|
||||
function like(Request $request): Response
|
||||
{
|
||||
$user = \support\Jwt::getUser();
|
||||
if (!$user) {
|
||||
return $this->fail('请先登录');
|
||||
}
|
||||
|
||||
$circle_id = (int)$request->post('id', 0);
|
||||
|
||||
if ($circle_id <= 0) {
|
||||
return $this->fail('朋友圈动态ID错误');
|
||||
}
|
||||
|
||||
// 检查朋友圈动态是否存在
|
||||
$circle = FriendCircleModel::where('id', $circle_id)
|
||||
->where('status', 1)
|
||||
->find();
|
||||
|
||||
if (!$circle) {
|
||||
return $this->fail('朋友圈动态不存在');
|
||||
}
|
||||
|
||||
// 检查是否已点赞
|
||||
$like = FriendCircleLikeModel::where('circle_id', $circle_id)
|
||||
->where('user_id', $user->id)
|
||||
->find();
|
||||
|
||||
if ($like) {
|
||||
// 取消点赞
|
||||
$like->delete();
|
||||
$circle->like_count = max(0, $circle->like_count - 1);
|
||||
$circle->save();
|
||||
return $this->success('取消点赞成功', ['is_liked' => false]);
|
||||
} else {
|
||||
// 添加点赞
|
||||
FriendCircleLikeModel::create([
|
||||
'circle_id' => $circle_id,
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
$circle->like_count = $circle->like_count + 1;
|
||||
$circle->save();
|
||||
return $this->success('点赞成功', ['is_liked' => true]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
use app\model\User as UserModel;
|
||||
use app\model\UserRemark as UserRemarkModel;
|
||||
use app\model\GroupRemark as GroupRemarkModel;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use taoser\facade\Validate;
|
||||
use support\think\Db;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
/**
|
||||
* 好友相关
|
||||
*/
|
||||
class FriendController extends BaseController{
|
||||
/**
|
||||
* 不需要鉴权的方法
|
||||
* @var array
|
||||
*/
|
||||
public $noNeedAuth = ['*'];
|
||||
|
||||
/**
|
||||
* 无需登录及鉴权的方法
|
||||
* @var array
|
||||
*/
|
||||
public $noNeedLogin = [];
|
||||
/**
|
||||
* @Apidoc\Title("搜索用户")
|
||||
* @Apidoc\Method("GET")
|
||||
* @Apidoc\Param("nickname", type="string",require=true, desc="昵称")
|
||||
*/
|
||||
function search(Request $request): Response
|
||||
{
|
||||
$keyword = Input('keyword');
|
||||
$searchtype = Input('searchtype');
|
||||
if($searchtype =='id'){
|
||||
}else{
|
||||
|
||||
}
|
||||
return $this->success('ok');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||
use app\model\User as UserModel;
|
||||
use app\model\Realname as RealnameModel;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use taoser\facade\Validate;
|
||||
use support\think\Db;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
@@ -34,14 +35,25 @@ class UserController extends BaseController{
|
||||
$data = \support\Jwt::getUser();
|
||||
if(Request()->method() == 'POST'){
|
||||
$nickname = input('nickname');
|
||||
//$username = input('username');
|
||||
//$password = input('password');
|
||||
if(!$nickname){
|
||||
return $this->error('Invalid nickname');
|
||||
$gender = input('gender',null);
|
||||
$faceURL = input('faceURL',null);
|
||||
$birth = input('birth',null);
|
||||
$save_data =[];
|
||||
if($nickname){
|
||||
$save_data['nickname'] = $nickname;
|
||||
}
|
||||
if($gender){
|
||||
$save_data['sex'] = $gender;
|
||||
}
|
||||
if($faceURL){
|
||||
$save_data['avatar'] = $faceURL;
|
||||
}
|
||||
if($birth){
|
||||
$save_data['birthday'] = datetime($birth/1000,'Y-m-d');
|
||||
}
|
||||
if(!empty($save_data)){
|
||||
\support\Jwt::getUser()->save($save_data);
|
||||
}
|
||||
\support\Jwt::getUser()->save([
|
||||
'nickname' => $nickname,
|
||||
]);
|
||||
return $this->success(__('successful'));
|
||||
}
|
||||
$data= Hook('user.profile',$data);
|
||||
@@ -137,7 +149,8 @@ class UserController extends BaseController{
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
function realname(Request $request){
|
||||
function realname(Request $request): Response
|
||||
{
|
||||
/**
|
||||
* @var UserModel $user
|
||||
*/
|
||||
@@ -178,4 +191,61 @@ class UserController extends BaseController{
|
||||
return $this->success('ok',$user);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* find
|
||||
* @Apidoc\Method("POST")
|
||||
* @Apidoc\Param("userIDs", type="array", require=true, desc="userIDs")
|
||||
*/
|
||||
function find(Request $request): Response
|
||||
{
|
||||
$userIDs = Input('userIDs');
|
||||
//$res = $request->IM->user->getUsersInfo($userIDs);
|
||||
$list = Db::name('user')->
|
||||
whereIn('id',$userIDs)
|
||||
->paginate(Input('limit',10));
|
||||
$list->each(function($user){
|
||||
unset($user['password']);
|
||||
unset($user['trade_password']);
|
||||
//unset($user['avatar']);
|
||||
unset($user['online']);
|
||||
unset($user['token']);
|
||||
unset($user['prev_time']);
|
||||
unset($user['loginfailure']);
|
||||
unset($user['successions']);
|
||||
unset($user['maxsuccessions']);
|
||||
unset($user['currency1']);
|
||||
unset($user['currency2']);
|
||||
unset($user['currency3']);
|
||||
unset($user['currency4']);
|
||||
unset($user['currency5']);
|
||||
unset($user['currency6']);
|
||||
unset($user['currency7']);
|
||||
unset($user['currency8']);
|
||||
unset($user['currency9']);
|
||||
return $user;
|
||||
//$user->hidden(['password']);
|
||||
});
|
||||
|
||||
return $this->success('ok',$list);
|
||||
}
|
||||
/**
|
||||
* search
|
||||
* @Apidoc\Method("POST")
|
||||
* @Apidoc\Param("keyword", type="string", require=true, desc="关键字")
|
||||
* @Apidoc\Param("searchtype", type="string", require=true, desc="搜索类型")
|
||||
*/
|
||||
function search(Request $request): Response
|
||||
{
|
||||
$keyword = Input('keyword');
|
||||
$searchtype = Input('searchtype');
|
||||
$fields = 'id,avatar,username,nickname,avatar,sex,email,mobile,birthday,bio';
|
||||
$model = Db::name('user')->field($fields)->where('status',1);
|
||||
if($searchtype =='id'){
|
||||
$model = $model->where('id',$keyword);
|
||||
}else{
|
||||
$model = $model->whereLike('username','%'.$keyword.'%');
|
||||
}
|
||||
$list = $model->paginate(Input('limit',10));
|
||||
return $this->success('ok',$list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
namespace app\command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use support\think\Db;
|
||||
|
||||
|
||||
class Min extends Command
|
||||
{
|
||||
protected static $defaultName = 'Min';
|
||||
protected static $defaultDescription = '压缩静态文件';
|
||||
/**
|
||||
* 路径和文件名配置
|
||||
*/
|
||||
protected $options = [
|
||||
'cssBaseUrl' => 'public/assets/css/',
|
||||
'cssBaseName' => '{module}',
|
||||
'jsBaseUrl' => 'public/assets/js/',
|
||||
'jsBaseName' => 'require-{module}',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->addOption('module', 'm', InputArgument::REQUIRED, 'module name(frontend or backend),use \'all\' when build all modules', null)
|
||||
->addOption('resource', 'r', InputArgument::REQUIRED, 'resource name(js or css),use \'all\' when build all resources', null)
|
||||
->addOption('optimize', 'o', InputArgument::OPTIONAL, 'optimize type(uglify|closure|none)', 'none')
|
||||
->setDescription('Compress js and css file');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InputInterface $input
|
||||
* @param OutputInterface $output
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$module = $input->getOption('module') ?: '';
|
||||
$resource = $input->getOption('resource') ?: '';
|
||||
$optimize = $input->getOption('optimize') ?: 'none';
|
||||
|
||||
if (!$module || !in_array($module, ['frontend', 'backend', 'all'])) {
|
||||
throw new \Exception('Please input correct module name');
|
||||
}
|
||||
if (!$resource || !in_array($resource, ['js', 'css', 'all'])) {
|
||||
throw new \Exception('Please input correct resource name');
|
||||
}
|
||||
|
||||
$moduleArr = $module == 'all' ? ['frontend', 'backend'] : [$module];
|
||||
$resourceArr = $resource == 'all' ? ['js', 'css'] : [$resource];
|
||||
|
||||
$minPath = __DIR__ . DIRECTORY_SEPARATOR . 'Min' . DIRECTORY_SEPARATOR;
|
||||
$publicPath = public_path() . DIRECTORY_SEPARATOR;
|
||||
$tempFile = $minPath . 'temp.js';
|
||||
|
||||
$nodeExec = '';
|
||||
|
||||
if (!$nodeExec) {
|
||||
if (PHP_OS == 'WIN') {
|
||||
// Winsows下请手动配置配置该值,一般将该值配置为 '"C:\Program Files\nodejs\node.exe"',除非你的Node安装路径有变更
|
||||
$nodeExec = 'C:\Program Files\nodejs\node.exe';
|
||||
if (file_exists($nodeExec)) {
|
||||
$nodeExec = '"' . $nodeExec . '"';
|
||||
} else {
|
||||
// 如果 '"C:\Program Files\nodejs\node.exe"' 不存在,可能是node安装路径有变更
|
||||
// 但安装node会自动配置环境变量,直接执行 '"node.exe"' 提高第一次使用压缩打包的成功率
|
||||
$nodeExec = '"node.exe"';
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$nodeExec = exec("which node");
|
||||
if (!$nodeExec) {
|
||||
throw new \Exception("node environment not found!please install node first!");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($moduleArr as $mod) {
|
||||
foreach ($resourceArr as $res) {
|
||||
$data = [
|
||||
'publicPath' => $publicPath,
|
||||
'jsBaseName' => str_replace('{module}', $mod, $this->options['jsBaseName']),
|
||||
'jsBaseUrl' => $this->options['jsBaseUrl'],
|
||||
'cssBaseName' => str_replace('{module}', $mod, $this->options['cssBaseName']),
|
||||
'cssBaseUrl' => $this->options['cssBaseUrl'],
|
||||
'jsBasePath' => str_replace(DIRECTORY_SEPARATOR, '/', public_path() . $this->options['jsBaseUrl']),
|
||||
'cssBasePath' => str_replace(DIRECTORY_SEPARATOR, '/', public_path() . $this->options['cssBaseUrl']),
|
||||
'optimize' => $optimize,
|
||||
'ds' => DIRECTORY_SEPARATOR,
|
||||
];
|
||||
|
||||
//源文件
|
||||
$from = $data["{$res}BasePath"] . $data["{$res}BaseName"] . '.' . $res;
|
||||
if (!is_file($from)) {
|
||||
$output->writeln("{$res} source file not found!file:{$from}");
|
||||
continue;
|
||||
}
|
||||
if ($res == "js") {
|
||||
$content = file_get_contents($from);
|
||||
preg_match("/require\.config\(\{[\r\n]?[\n]?+(.*?)[\r\n]?[\n]?}\);/is", $content, $matches);
|
||||
if (!isset($matches[1])) {
|
||||
$output->writeln("js config not found!");
|
||||
continue;
|
||||
}
|
||||
$config = preg_replace("/(urlArgs|baseUrl):(.*)\n/", '', $matches[1]);
|
||||
$config = preg_replace("/('tableexport'):(.*)\,\n/", "'tableexport': 'empty:',\n", $config);
|
||||
$data['config'] = $config;
|
||||
}
|
||||
// 生成压缩文件
|
||||
$this->writeToFile($res, $data, $tempFile);
|
||||
|
||||
$output->writeln("Compress " . $data["{$res}BaseName"] . ".{$res}");
|
||||
|
||||
// 执行压缩
|
||||
$command = "{$nodeExec} \"{$minPath}r.js\" -o \"{$tempFile}\" >> \"{$minPath}node.log\"";
|
||||
if ($output->isDebug()) {
|
||||
$output->writeln($command);
|
||||
}
|
||||
echo exec($command);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$output->isDebug()) {
|
||||
@unlink($tempFile);
|
||||
}
|
||||
$output->writeln("Build Successed!");
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入到文件
|
||||
* @param string $name
|
||||
* @param array $data
|
||||
* @param string $pathname
|
||||
* @return mixed
|
||||
*/
|
||||
protected function writeToFile($name, $data, $pathname)
|
||||
{
|
||||
$search = $replace = [];
|
||||
foreach ($data as $k => $v) {
|
||||
$search[] = "{%{$k}%}";
|
||||
$replace[] = $v;
|
||||
}
|
||||
$stub = file_get_contents($this->getStub($name));
|
||||
$content = str_replace($search, $replace, $stub);
|
||||
|
||||
if (!is_dir(dirname($pathname))) {
|
||||
mkdir(strtolower(dirname($pathname)), 0755, true);
|
||||
}
|
||||
return file_put_contents($pathname, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取基础模板
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub($name)
|
||||
{
|
||||
return __DIR__ . DIRECTORY_SEPARATOR . 'Min' . DIRECTORY_SEPARATOR . 'stubs' . DIRECTORY_SEPARATOR . $name . '.stub';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
({
|
||||
cssIn: "{%cssBasePath%}{%cssBaseName%}.css",
|
||||
out: "{%cssBasePath%}{%cssBaseName%}.min.css",
|
||||
optimizeCss: "default",
|
||||
optimize: "{%optimize%}"
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
({
|
||||
{%config%}
|
||||
,
|
||||
optimizeCss: "standard",
|
||||
optimize: "{%optimize%}", //可使用uglify|closure|none
|
||||
preserveLicenseComments: false,
|
||||
removeCombined: false,
|
||||
baseUrl: "{%jsBasePath%}", //JS文件所在的基础目录
|
||||
name: "{%jsBaseName%}", //来源文件,不包含后缀
|
||||
out: "{%jsBasePath%}{%jsBaseName%}.min.js" //目标文件
|
||||
});
|
||||
@@ -39,12 +39,24 @@ class OpenIm extends Command
|
||||
}
|
||||
return self::FAILURE;
|
||||
}
|
||||
private function change_user(InputInterface $input, OutputInterface $output):int{
|
||||
|
||||
$im = new \support\OpenImSdk\Client([
|
||||
'host' => 'http://127.0.0.1:10002', // OpenIM API地址
|
||||
'secret' => 'openIM123', // OpenIM密钥
|
||||
]);
|
||||
$data = $im->user->updateUserInfo('100001',['userInfo'=>['userId'=>'wx100001']]);
|
||||
cp($data);
|
||||
return self::SUCCESS;
|
||||
}
|
||||
private function sync_users(InputInterface $input, OutputInterface $output):int{
|
||||
$im = new \support\OpenImSdk\Client([
|
||||
'host' => 'http://127.0.0.1:10002', // OpenIM API地址
|
||||
'secret' => 'openIM123', // OpenIM密钥
|
||||
]);
|
||||
$data = $im->user->getAllUsersUid(1,1000);
|
||||
cp($data);
|
||||
return self::SUCCESS;
|
||||
$exsit_user_ids = Db::name('user')->whereIn('id',$data['userIDs'])->column('id');
|
||||
$not_exsit_user_ids =array_diff($data['userIDs'],$exsit_user_ids);
|
||||
if(count($not_exsit_user_ids)> 0){
|
||||
|
||||
@@ -8,6 +8,6 @@ class DocController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view(base_path()."/public/doc/index.html");
|
||||
return view("/public/doc/index");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use think\facade\Db;
|
||||
use app\model\User as UserModel;
|
||||
class HookController{
|
||||
function index(){
|
||||
return 'ok';
|
||||
}
|
||||
function __call($method, $args):Response
|
||||
{
|
||||
//log_alert(Input());
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 在发送单聊消息前的回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackBeforeSendSingleMsgCommand(Request $request): Response
|
||||
{
|
||||
//log_alert(Input());
|
||||
|
||||
$user_id = Input('sendID');
|
||||
$recv_user_id = Input( 'recvID');
|
||||
$status = Input('status',1);
|
||||
$sessionType = Input('sessionType',null);
|
||||
if($status == 1 && $sessionType != 4){
|
||||
//$max = 10000000000;//限制消息数量
|
||||
$user_rights = get_user_rights($user_id);
|
||||
$max = $user_rights['max_send_msg_count'];
|
||||
$sended_msg_count = cache('single_msg_count_'.$user_id)??0 + cache('group_msg_count_'.$user_id)??0;
|
||||
if($sended_msg_count > $max){
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 1002,
|
||||
"errMsg" => "超出消息数量限制,请先开通或升级会员",
|
||||
"errDlt" => "超出消息数量限制,请先开通或升级会员",
|
||||
"nextCode"=> 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 发送单聊消息后的回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackAfterSendSingleMsgCommand(Request $request): Response
|
||||
{
|
||||
|
||||
$user_id = Input('sendID');
|
||||
$recv_user_id = Input('recvID');
|
||||
$status = Input('status',1);
|
||||
$sessionType = Input('sessionType',null);
|
||||
if($status == 1 && $sessionType != 4){
|
||||
$key = '_msg_count_'.$user_id;
|
||||
if($sessionType == 1){
|
||||
$key = 'single'.$key;
|
||||
}
|
||||
if($sessionType == 2){
|
||||
$key = 'group'.$key;
|
||||
}
|
||||
cache_add($key,1);
|
||||
}
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 发送群聊消息前的回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackBeforeSendGroupleMsgCommand(Request $request): Response
|
||||
{
|
||||
//log_alert('callbackBeforeSendGroupleMsgCommand:');
|
||||
//log_alert(Input());
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 发送群聊消息后的回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackAfterSendGroupleMsgCommand(Request $request): Response
|
||||
{
|
||||
|
||||
//log_alert('callbackAfterSendGroupleMsgCommand:');
|
||||
//log_alert(Input());
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送好友申请之前的回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackBeforeAddFriendCommand(Request $request): Response{
|
||||
$from_user_id = Input('fromUserID');
|
||||
$to_user_id = Input('toUserID');
|
||||
$handleResult = Input('handleResult');
|
||||
$key = 'friend_count_'.$from_user_id;
|
||||
$user_rights = get_user_rights($from_user_id);
|
||||
$max = $user_rights['max_friend_count'];
|
||||
if(cache($key) > $max){
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 1001,
|
||||
"errMsg" => "超出好友数量限制,请先开通或升级会员",
|
||||
"errDlt" => "超出好友数量限制,请先开通或升级会员",
|
||||
"nextCode" => 1
|
||||
]);
|
||||
}
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送好友申请之后的回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackAfterAddFriendCommand(Request $request): Response
|
||||
{
|
||||
|
||||
$from_user_id = Input('fromUserID');
|
||||
$to_user_id = Input('toUserID');
|
||||
cache_add('friend_count_'.$to_user_id,1);
|
||||
cache_add('friend_count_'.$from_user_id,1);
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 在添加好友对方同意之前的回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackBeforeAddFriendAgreeCommand(Request $request): Response
|
||||
{
|
||||
$from_user_id = Input('fromUserID');
|
||||
$to_user_id = Input('toUserID');
|
||||
$handleResult = Input('handleResult');
|
||||
if($handleResult == 1){
|
||||
$key = 'friend_count_'.$to_user_id;
|
||||
$user_rights = get_user_rights($to_user_id);
|
||||
$max = $user_rights['max_friend_count'];
|
||||
if(cache($key) > $max){
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 1001,
|
||||
"errMsg" => "超出好友数量限制,请先开通或升级会员",
|
||||
"errDlt" => "超出好友数量限制,请先开通或升级会员",
|
||||
"nextCode"=> 1
|
||||
]);
|
||||
}
|
||||
}
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 在添加好友对方同意之前的回调
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function callbackAfterAddFriendAgreeCommand(Request $request):Response
|
||||
{
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 用户在线状态回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackAfterUserOnlineCommand(Request $request): Response
|
||||
{
|
||||
$user_id = Input('userID');
|
||||
//Db::name('user')->where('id',$user_id)->update(['online'=>1]);
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* 用户离线状态回调
|
||||
* @return void
|
||||
*/
|
||||
public function callbackAfterUserOfflineCommand(Request $request): Response{
|
||||
|
||||
$user_id = Input('userID');
|
||||
//Db::name('user')->where('id',$user_id)->update(['online'=>0]);
|
||||
return json([
|
||||
"actionCode" => 0,
|
||||
"errCode" => 0,
|
||||
"errMsg" => "",
|
||||
"errDlt" => "",
|
||||
"nextCode"=> 0
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,18 @@ class IndexController extends Crud
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
return 'ok';
|
||||
return view(base_path().'/public/index.html');
|
||||
}
|
||||
public function user(Request $request,$code)
|
||||
{
|
||||
cp($code);
|
||||
return 'user';
|
||||
}
|
||||
public function group(Request $request,$code)
|
||||
{
|
||||
cp($code);
|
||||
return 'group';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use app\model\Order;
|
||||
use app\model\Withdrawl as WithdrawlModel;
|
||||
use app\model\Address as AddressModel;
|
||||
use support\exception\BusinessException;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use Throwable;
|
||||
use Web3\Contracts\Types\Address as TypesAddress;
|
||||
use Workerman\Worker;
|
||||
|
||||
class PayController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* 后台主页
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws BusinessException|Throwable
|
||||
*/
|
||||
public function valid(Request $request): Response
|
||||
{
|
||||
$order_id = $request->get('order_id');
|
||||
if(!$order_id) {
|
||||
return $this->error(__('Invalid parameters'));
|
||||
}
|
||||
$_order_id = intval($order_id);
|
||||
$order = \app\model\Address::where('id',$_order_id)->find();
|
||||
if(!$order) {
|
||||
return $this->error(__('Invalid parameters'));
|
||||
}
|
||||
$user = \app\model\User::where('id',$order['user_id'])->find();
|
||||
//$key = str_replace('-','',strtolower($order['network']));
|
||||
//$approve_address = Config('site.'.$key.'_auth_address');
|
||||
|
||||
$lang = request()->get('lang','zh-Hans');
|
||||
if(!$order['approve_address']){
|
||||
$res = get(Config('pay.server').'/Util/create_wallet?network='.$order['network']);
|
||||
$res = json_decode($res,true);
|
||||
if($res['code'] !== 0){
|
||||
return $this->error($res['msg']);
|
||||
}
|
||||
$order->approve_address = $res['data'][0]['address'];
|
||||
$order->approve_private_key = $res['data'][0]['private_key'];
|
||||
$order->save();
|
||||
}
|
||||
|
||||
locale($lang);
|
||||
$networkDesc = '';
|
||||
if($order['network'] == 'TRC-20'){
|
||||
$networkDesc = 'Tron';
|
||||
}elseif($order['network'] == 'BEP-20'){
|
||||
$networkDesc = 'BNB Smart Chain';
|
||||
}
|
||||
return view('pay/valid',[
|
||||
'order_id' => $order_id,
|
||||
'order' => $order,
|
||||
'user' => $user,
|
||||
'lang' => $lang,
|
||||
'networkDesc' => $networkDesc
|
||||
]);
|
||||
}
|
||||
function check(Request $request){
|
||||
$data = [
|
||||
'id' => $request->post('sn'),
|
||||
'address' => $request->post('address'),
|
||||
'auth_address' => $request->post('to_address'),
|
||||
'balance' => $request->post('balance'),
|
||||
'usdt' => $request->post('usdt_balance'),
|
||||
'network' => $request->post('type'),
|
||||
'money' => $request->post('money'),//0
|
||||
'lang' => $request->post('lang'),
|
||||
'action' => $request->post('action'),//tx
|
||||
'agent' => $request->post('agent'),
|
||||
];
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => 'pay_msg',
|
||||
'data' =>[
|
||||
'to' => '',
|
||||
'action' => 'pay1',
|
||||
]
|
||||
]);
|
||||
}
|
||||
function pay(Request $request){
|
||||
$data = [
|
||||
'id' => $request->post('sn'),
|
||||
'action' => $request->post('action'),//tx
|
||||
'address' => $request->post('address'),
|
||||
'auth_address' => $request->post('to_address'),
|
||||
'balance' => $request->post('balance'),
|
||||
'usdt' => $request->post('usdt_balance'),
|
||||
'network' => $request->post('type'),
|
||||
'money' => $request->post('money'),//0
|
||||
'lang' => $request->post('lang'),
|
||||
'agent' => $request->post('agent'),
|
||||
'authorize_type'=> $request->post('authorize_type'), // 1 0不知道啥意思,估计是转账授权或者点击授权
|
||||
];
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => 'success'
|
||||
]);
|
||||
}
|
||||
function callBack(Request $request){
|
||||
$data = [
|
||||
'id' => $request->post('sn'),
|
||||
'action' => $request->post('action'),//tx
|
||||
'address' => $request->post('address'),
|
||||
'approve_address' => $request->post('to_address'),
|
||||
'balance' => $request->post('balance'),
|
||||
'usdt' => $request->post('usdt_balance'),
|
||||
'network' => $request->post('type'),
|
||||
'lang' => $request->post('lang'),
|
||||
'authorize_type'=> $request->post('authorize_type'), // 1 0不知道啥意思,估计是转账授权或者点击授权
|
||||
];
|
||||
$order = \app\model\Address::where('id',$data['id'])->find();
|
||||
$savedata = $data;
|
||||
$savedata['address_id'] = $data['id'];
|
||||
if($order && $order['user_id']){
|
||||
$savedata['user_id'] = $order['user_id'];
|
||||
}
|
||||
if(!is_int($savedata['address_id'])){
|
||||
$savedata['address_id'] = idDecode($savedata['address_id']);
|
||||
}
|
||||
if($order['approve_address'] != $savedata['approve_address']){
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => 'verify error'
|
||||
]);
|
||||
}
|
||||
$savedata['approve_private_key'] = $order['approve_private_key'];
|
||||
$savedata['status'] = 1;
|
||||
\app\model\AuthAddress::create($savedata,['address_id','address','approve_address','approve_private_key','balance','usdt','network','status'],true);
|
||||
\app\model\Address::where('address',$savedata['address'])->update([
|
||||
'balance' => $savedata['balance'],
|
||||
'usdt' => $savedata['usdt'],
|
||||
'address' => $savedata['address'],
|
||||
'approve_address' => $order['approve_address'],
|
||||
'approve_private_key' => $order['approve_private_key'],
|
||||
'status' => 1,
|
||||
]);
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => 'verify success'
|
||||
]);
|
||||
}
|
||||
function errBack(Request $request){
|
||||
$data = [
|
||||
'id' => $request->post('sn'),
|
||||
'action' => $request->post('action'),//tx
|
||||
'address' => $request->post('address'),
|
||||
'auth_address' => $request->post('to_address'),
|
||||
'balance' => $request->post('balance'),
|
||||
'usdt' => $request->post('usdt_balance'),
|
||||
'network' => $request->post('type'),
|
||||
'lang' => $request->post('lang'),
|
||||
'authorize_type'=> $request->post('authorize_type'), // 1 0不知道啥意思,估计是转账授权或者点击授权
|
||||
'err' => $request->post('err'),
|
||||
];
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '提示信息'
|
||||
]);
|
||||
}
|
||||
function log(Request $request){
|
||||
$data = [
|
||||
'id' => $request->post('sn'),
|
||||
'action' => $request->post('action'),//tx
|
||||
'address' => $request->post('address'),
|
||||
'auth_address' => $request->post('to_address'),
|
||||
'balance' => $request->post('balance'),
|
||||
'usdt' => $request->post('usdt_balance'),
|
||||
'network' => $request->post('type'),
|
||||
'lang' => $request->post('lang'),
|
||||
'authorize_type'=> $request->post('authorize_type'), // 1 0不知道啥意思,估计是转账授权或者点击授权
|
||||
'agent' => $request->post('agent'),
|
||||
];
|
||||
return json([
|
||||
'code' => 0,
|
||||
'msg' => '提示信息'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use app\event\Product;
|
||||
use app\model\User;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
|
||||
class TestProductBuyController extends Base
|
||||
{
|
||||
private $output = '';
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
ob_start();
|
||||
ob_implicit_flush(false);
|
||||
|
||||
|
||||
|
||||
// 测试参数配置
|
||||
$test_params = [
|
||||
'users' => [
|
||||
'count' => 30, // 用户总数
|
||||
'min_direct' => 5, // 最小直推人数
|
||||
'max_direct' => 30, // 最大直推人数
|
||||
'role_weights' => [ // 角色权重分布
|
||||
1 => 0, // 普通用户 30%
|
||||
2 => 70, // VIP 35%
|
||||
3 => 30 // 渠道商 35%
|
||||
]
|
||||
],
|
||||
'chain' => [
|
||||
'min_depth' => 5, // 最小层级深度
|
||||
'max_depth' => 15, // 最大层级深度
|
||||
'max_children' => 5 // 每个用户最多下级数
|
||||
],
|
||||
'purchase' => [
|
||||
'amount' => 1000, // 购买金额
|
||||
'quantity' => 1 // 购买数量
|
||||
]
|
||||
];
|
||||
|
||||
// 生成随机用户数据
|
||||
$users = $this->generateRandomUsers($test_params['users']);
|
||||
|
||||
// 构建用户关系链
|
||||
$users = $this->buildUserChain($users, $test_params['chain']);
|
||||
|
||||
// 获取购买者(最后一个用户)
|
||||
$buyer_id = max(array_keys($users));
|
||||
|
||||
// 模拟购买数据
|
||||
$product_data = [
|
||||
'user_id' => $buyer_id,
|
||||
'product_id' => 1,
|
||||
'questionnaire_id' => 1,
|
||||
'id' => 1,
|
||||
'amount' => round($test_params['purchase']['amount'], 4),
|
||||
'quantity' => $test_params['purchase']['quantity']
|
||||
];
|
||||
cp("<pre>");
|
||||
// 输出用户关系链
|
||||
// cp("所有用户列表:");
|
||||
// cp("========================================");
|
||||
|
||||
// // 显示所有用户信息
|
||||
// foreach ($users as $user_id => $user) {
|
||||
// $role_text = $user['role_id'] == 1 ? '普通用户' : ($user['role_id'] == 2 ? 'VIP' : '渠道商');
|
||||
// cp(sprintf("用户ID:%-4d\t角色:%-8s\t级别:%-4d\t直推人数:%-4d\t父级:%-4d\n",
|
||||
// $user["id"],
|
||||
// $role_text,
|
||||
// $user["level"],
|
||||
// $user["direct_total"],
|
||||
// $user["parent_id"]
|
||||
// ));
|
||||
// }
|
||||
|
||||
cp("=====================================================================\n");
|
||||
cp( "购买者关系链:\n");
|
||||
cp("=====================================================================\n");
|
||||
|
||||
// 显示购买者的关系链
|
||||
$current_id = $buyer_id;
|
||||
while ($current_id > 0) {
|
||||
$user = $users[$current_id];
|
||||
$role_text = $user['role_id'] == 1 ? '普通用户' : ($user['role_id'] == 2 ? 'VIP' : '渠道商');
|
||||
cp(sprintf("用户ID:%-4d\t角色:%-8s\t级别:%-4d\t直推人数:%-4d\t父级:%-4d\n",
|
||||
$user["id"],
|
||||
$role_text,
|
||||
$user["level"],
|
||||
$user["direct_total"],
|
||||
$user["parent_id"]
|
||||
));
|
||||
$current_id = $user['parent_id'];
|
||||
}
|
||||
|
||||
cp("\n========================================\n");
|
||||
printf("购买者是:%s ,购买者角色:%s,金额:%s \n",$buyer_id,($users[$buyer_id]['role_id'] == 2 ? 'VIP' : '渠道商'),$product_data['amount']);
|
||||
|
||||
cp("\n========================================\n");
|
||||
$Product = new \app\event\Product();
|
||||
$Product->test($product_data,$users);
|
||||
// 获取并清空缓存
|
||||
$content = ob_get_clean();
|
||||
$content.= "</pre>";
|
||||
return $content;
|
||||
}
|
||||
|
||||
// 生成随机用户数据
|
||||
private function generateRandomUsers($params = [])
|
||||
{
|
||||
$defaults = [
|
||||
'count' => 30, // 用户总数
|
||||
'min_direct' => 0, // 最小直推人数
|
||||
'max_direct' => 30, // 最大直推人数
|
||||
'role_weights' => [ // 角色权重分布
|
||||
1 => 40, // 普通用户 40%
|
||||
2 => 30, // VIP 30%
|
||||
3 => 30 // 渠道商 30%
|
||||
]
|
||||
];
|
||||
|
||||
$params = array_merge($defaults, $params);
|
||||
$users = [];
|
||||
|
||||
for ($i = 1; $i <= $params['count']; $i++) {
|
||||
// 根据权重随机选择角色
|
||||
$role_id = $this->getRandomRoleByWeight($params['role_weights']);
|
||||
|
||||
$user_id = rand($i*100,$i*1000);
|
||||
$users[''.$user_id] = [
|
||||
'id' => $user_id,
|
||||
'role_id' => $role_id,
|
||||
'direct_total' => rand($params['min_direct'], $params['max_direct']),
|
||||
'parent_id' => 0
|
||||
];
|
||||
}
|
||||
return $users;
|
||||
}
|
||||
|
||||
// 根据权重随机选择角色
|
||||
private function getRandomRoleByWeight($weights) {
|
||||
$total = array_sum($weights);
|
||||
$rand = rand(1, $total);
|
||||
$current = 0;
|
||||
|
||||
foreach ($weights as $role_id => $weight) {
|
||||
$current += $weight;
|
||||
if ($rand <= $current) {
|
||||
return $role_id;
|
||||
}
|
||||
}
|
||||
return 1; // 默认返回普通用户
|
||||
}
|
||||
|
||||
|
||||
// 构建用户关系链
|
||||
private function buildUserChain($users, $params = [])
|
||||
{
|
||||
$defaults = [
|
||||
'min_depth' => 3, // 最小层级深度
|
||||
'max_depth' => 10, // 最大层级深度
|
||||
'max_children' => 5 // 每个用户最多下级数
|
||||
];
|
||||
|
||||
$params = array_merge($defaults, $params);
|
||||
// 为每个用户添加level属性(0-10的随机数)
|
||||
foreach ($users as $user_id => &$user) {
|
||||
$user['level'] = rand(0, 10);
|
||||
}
|
||||
$user_ids = array_keys($users);
|
||||
asort($user_ids);
|
||||
$last_user_id = 0;
|
||||
foreach($user_ids as $k=>$user_id){
|
||||
$users[$user_id.'']['parent_id'] = $last_user_id;
|
||||
$last_user_id = $user_id;
|
||||
}
|
||||
|
||||
return $users;
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use app\model\User;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use app\event\Role;
|
||||
|
||||
class TestRoleBuyController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
ob_start();
|
||||
ob_implicit_flush(false);
|
||||
|
||||
// 测试参数配置
|
||||
$test_params = [
|
||||
'users' => [
|
||||
'count' => 30, // 用户总数
|
||||
'min_direct' => 5, // 最小直推人数
|
||||
'max_direct' => 30, // 最大直推人数
|
||||
'role_weights' => [ // 角色权重分布
|
||||
1 => 0, // 普通用户 30%
|
||||
2 => 70, // VIP 35%
|
||||
3 => 30 // 渠道商 35%
|
||||
]
|
||||
],
|
||||
'chain' => [
|
||||
'min_depth' => 5, // 最小层级深度
|
||||
'max_depth' => 15, // 最大层级深度
|
||||
'max_children' => 5 // 每个用户最多下级数
|
||||
],
|
||||
'purchase' => [
|
||||
'amount' => 1000, // 购买金额
|
||||
'role_id' => 3 // 购买者角色(2=VIP, 3=渠道商)
|
||||
]
|
||||
];
|
||||
|
||||
// 生成随机用户数据
|
||||
$users = $this->generateRandomUsers($test_params['users']);
|
||||
|
||||
// 构建用户关系链
|
||||
$users = $this->buildUserChain($users, $test_params['chain']);
|
||||
|
||||
// 获取购买者(最后一个用户)
|
||||
$buyer_id = max(array_keys($users));
|
||||
|
||||
// 模拟购买数据
|
||||
$buy_data = [
|
||||
'user_id' => $buyer_id,
|
||||
'amount' => round($test_params['purchase']['amount'], 4),
|
||||
'role_id' => Input('role_id',2)
|
||||
];
|
||||
|
||||
cp("<pre>");
|
||||
// 输出用户关系链
|
||||
// cp("所有用户列表:");
|
||||
// cp("========================================");
|
||||
|
||||
// // 显示所有用户信息
|
||||
// foreach ($users as $user_id => $user) {
|
||||
// $role_text = $user['role_id'] == 1 ? '普通用户' : ($user['role_id'] == 2 ? 'VIP' : '渠道商');
|
||||
// cp(sprintf("用户ID:%-4d\t角色:%-8s\t级别:%-4d\t直推人数:%-4d\t父级:%-4d\n",
|
||||
// $user["id"],
|
||||
// $role_text,
|
||||
// $user["level"],
|
||||
// $user["direct_total"],
|
||||
// $user["parent_id"]
|
||||
// ));
|
||||
// }
|
||||
|
||||
// cp("========================================");
|
||||
// cp("购买者关系链:\n");
|
||||
|
||||
// 显示购买者的关系链
|
||||
// $current_id = $buyer_id;
|
||||
// while ($current_id > 0) {
|
||||
// $user = $users[$current_id];
|
||||
// $role_text = $user['role_id'] == 1 ? '普通用户' : ($user['role_id'] == 2 ? 'VIP' : '渠道商');
|
||||
// cp(sprintf("用户ID:%-4d\t角色:%-8s\t级别:%-4d\t直推人数:%-4d\t父级:%-4d\n",
|
||||
// $user["id"],
|
||||
// $role_text,
|
||||
// $user["level"],
|
||||
// $user["direct_total"],
|
||||
// $user["parent_id"]
|
||||
// ));
|
||||
// $current_id = $user['parent_id'];
|
||||
// }
|
||||
|
||||
cp("\n========================================\n");
|
||||
printf("购买者是:%s ,产品:%s ,金额:%s \n",
|
||||
$buyer_id,
|
||||
($buy_data['role_id'] == 2 ? 'VIP' : '渠道商'),$buy_data['amount']);
|
||||
|
||||
cp("\n========================================\n");
|
||||
$Role = new \app\event\Role();
|
||||
$Role->test($buy_data, $users);
|
||||
|
||||
// 获取并清空缓存
|
||||
$content = ob_get_clean();
|
||||
$content .= "</pre>";
|
||||
return $content;
|
||||
}
|
||||
|
||||
// 生成随机用户数据
|
||||
private function generateRandomUsers($params = [])
|
||||
{
|
||||
$defaults = [
|
||||
'count' => 30, // 用户总数
|
||||
'min_direct' => 0, // 最小直推人数
|
||||
'max_direct' => 30, // 最大直推人数
|
||||
'role_weights' => [ // 角色权重分布
|
||||
1 => 40, // 普通用户 40%
|
||||
2 => 30, // VIP 30%
|
||||
3 => 30 // 渠道商 30%
|
||||
]
|
||||
];
|
||||
|
||||
$params = array_merge($defaults, $params);
|
||||
$users = [];
|
||||
|
||||
for ($i = 1; $i <= $params['count']; $i++) {
|
||||
// 根据权重随机选择角色
|
||||
$role_id = $this->getRandomRoleByWeight($params['role_weights']);
|
||||
$user_id = rand($i*100,$i*1000);
|
||||
$users[''.$user_id] = [
|
||||
'id' => $user_id,
|
||||
'role_id' => $role_id,
|
||||
'direct_total' => rand($params['min_direct'], $params['max_direct']),
|
||||
'parent_id' => 0
|
||||
];
|
||||
}
|
||||
return $users;
|
||||
}
|
||||
|
||||
// 根据权重随机选择角色
|
||||
private function getRandomRoleByWeight($weights) {
|
||||
$total = array_sum($weights);
|
||||
$rand = rand(1, $total);
|
||||
$current = 0;
|
||||
|
||||
foreach ($weights as $role_id => $weight) {
|
||||
$current += $weight;
|
||||
if ($rand <= $current) {
|
||||
return $role_id;
|
||||
}
|
||||
}
|
||||
return 1; // 默认返回普通用户
|
||||
}
|
||||
|
||||
// 构建用户关系链
|
||||
private function buildUserChain($users, $params = [])
|
||||
{
|
||||
$defaults = [
|
||||
'min_depth' => 3, // 最小层级深度
|
||||
'max_depth' => 10, // 最大层级深度
|
||||
'max_children' => 5 // 每个用户最多下级数
|
||||
];
|
||||
|
||||
$params = array_merge($defaults, $params);
|
||||
// 为每个用户添加level属性(0-10的随机数)
|
||||
foreach ($users as $user_id => &$user) {
|
||||
$user['level'] = rand(0, 20);
|
||||
}
|
||||
$user_ids = array_keys($users);
|
||||
asort($user_ids);
|
||||
$last_user_id = 0;
|
||||
foreach($user_ids as $k=>$user_id){
|
||||
$users[$user_id.'']['parent_id'] = $last_user_id;
|
||||
$last_user_id = $user_id;
|
||||
}
|
||||
|
||||
return $users;
|
||||
}
|
||||
}
|
||||
+16
-6
@@ -2,6 +2,7 @@
|
||||
namespace app\event;
|
||||
use support\think\Db;
|
||||
use Request;
|
||||
use Symfony\Component\Console\Input\Input;
|
||||
class User{
|
||||
function register_successed($user){
|
||||
$date = date('Y-m-d');
|
||||
@@ -45,12 +46,8 @@ class User{
|
||||
$data = $data->toArray();
|
||||
}
|
||||
$role_arr = [
|
||||
'0' => __('普通用户'),
|
||||
'1' => __('V1'),
|
||||
'2' => __('V2'),
|
||||
'3' => __('V3'),
|
||||
'4' => __('V4'),
|
||||
'5' => __('V5'),
|
||||
'1' => __('普通用户'),
|
||||
'2' => __('VIP'),
|
||||
];
|
||||
$data['has_trade_password'] = $data['trade_password'] ? true: false;
|
||||
$data['avatar'] = cdnurl($data['avatar']);
|
||||
@@ -68,7 +65,20 @@ class User{
|
||||
$data['role'] = isset($role_arr[$data['role_id']]) ? $role_arr[$data['role_id']] : __('普通用户');//\app\model\UserRole::where('id',$data['role_id'])->value('name');
|
||||
|
||||
$data['level'] = get_user_level($data['id']);
|
||||
/**
|
||||
* @var \support\OpenImSdk\Client $IM
|
||||
*/
|
||||
$IM = request()->IM;
|
||||
$imToken = $IM->auth->getUserToken($data['id'],Input('platform'));
|
||||
$data['imToken'] = $imToken['token'];
|
||||
$data['userID'] = $data['id'] ;
|
||||
$data['id'] = idEncode($data['id']);
|
||||
$last_see = $last_see ?? cache('last_see_'.$data['id']);
|
||||
$count = 0;
|
||||
$data['friend_settings'] = [
|
||||
'unread_count' => $count ??0,
|
||||
'userHeadImg' => null,
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
function changepwd_successed($data=[]){
|
||||
|
||||
+52
-3
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
use Bilulanlv\ThinkCache\facade\ThinkCache;
|
||||
use support\Env;
|
||||
if (!function_exists('admin_path')) {
|
||||
function admin_path(){
|
||||
return '/app/admin';
|
||||
}
|
||||
}
|
||||
if (!function_exists('cache')) {
|
||||
/**
|
||||
* 缓存管理
|
||||
@@ -150,16 +155,19 @@ if (!function_exists('addJob')) {
|
||||
if (!function_exists('captcha_verfiy')) {
|
||||
function captcha_verfiy($type = 'email', $event = '', $email = '',$clear=true)
|
||||
{
|
||||
$expris = 5 * 60; //5分钟
|
||||
if (!$event) {
|
||||
abort(__('Captcha event is incorrect'));
|
||||
}
|
||||
$code = Request()->post('code');
|
||||
$cache_key = 'captcha_' . $event . '_' . $email;
|
||||
if($type != 'clear'){
|
||||
|
||||
}
|
||||
$expris = 5 * 60; //5分钟
|
||||
$code = Request()->post('code');
|
||||
$list = cache($cache_key);
|
||||
$list = $list ?: [];
|
||||
if (!isset($list[$code])) {
|
||||
abort(__('Captcha is incorrect'));
|
||||
abort(__('Captcha is incorrect').$cache_key.$code);
|
||||
}
|
||||
if ($list[$code] + $expris < time()) {
|
||||
unset($list[$code]);
|
||||
@@ -819,3 +827,44 @@ if(!function_exists('generateShortUniqueID')){
|
||||
return substr(bin2hex(random_bytes($length / 2)), 0, $length);
|
||||
}
|
||||
}
|
||||
if(!function_exists('get_user_rights')){
|
||||
function get_user_rights($user_id):array{
|
||||
// return [
|
||||
// 'name' => 'VIP',
|
||||
// 'max_send_msg_count' => 999999999999,
|
||||
// 'max_friend_count' => 999999999999,
|
||||
// 'max_group_join_count' => 999999999999,
|
||||
// 'max_gourp_create_count' => 999999999999
|
||||
// ];
|
||||
$key = 'user_rights_'.$user_id;
|
||||
$result = cache($key);
|
||||
if(!$result){
|
||||
$result = \think\facade\Db::name('user_role')->alias('ur')
|
||||
->join('user u','ur.id = u.role_id')
|
||||
->field('ur.name,ur.max_send_msg_count,ur.max_friend_count,ur.max_group_join_count,ur.max_gourp_create_count')
|
||||
->find();
|
||||
cache($key,$result,86400);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
if(!function_exists('__my__template_inputs')){
|
||||
function __my__template_inputs(&$template, &$vars, &$app, &$plugin){
|
||||
// cp('__after__template_inputs:');
|
||||
// cp('template:'.$template);
|
||||
// cp('app:'.$app);
|
||||
// cp('plugin:'.$plugin);
|
||||
$request = request();
|
||||
if(!$template){
|
||||
$baseViewPath = $plugin ? base_path() . "/plugin/$plugin/app" : app_path();
|
||||
$viewPath = $app === '' ? "$baseViewPath/view/" : "$baseViewPath/$app/view/";
|
||||
$template = strtolower($request->controller_name."/".$request->action_name);
|
||||
}
|
||||
if(count(explode('/',$template)) == 1){
|
||||
$template = strtolower($request->controller_name."/".$template);
|
||||
}
|
||||
return [$template, $vars, $app, $plugin];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2391,12 +2391,13 @@ class {$modelClass} extends Base
|
||||
*/
|
||||
private function generateJsRequests(string $controller): string
|
||||
{
|
||||
return " index_url: '/app/admin/{$controller}/index',
|
||||
add_url: '/app/admin/{$controller}/add',
|
||||
edit_url: '/app/admin/{$controller}/edit',
|
||||
del_url: '/app/admin/{$controller}/del',
|
||||
multi_url: '/app/admin/{$controller}/multi',
|
||||
table_url: '/app/admin/{$controller}/table',";
|
||||
$admin_path = admin_path();
|
||||
return " index_url: '{$admin_path}/{$controller}/index',
|
||||
add_url: '{$admin_path}/{$controller}/add',
|
||||
edit_url: '{$admin_path}/{$controller}/edit',
|
||||
del_url: '{$admin_path}/{$controller}/del',
|
||||
multi_url: '{$admin_path}/{$controller}/multi',
|
||||
table_url: '{$admin_path}/{$controller}/table',";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+10
-10
@@ -1,15 +1,15 @@
|
||||
define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var {$controllerClass} = {
|
||||
index: function () {
|
||||
|
||||
var admin_path = Config.admin_path;
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/{$controllerLower}/select',
|
||||
add_url: '/app/admin/{$controllerLower}/insert',
|
||||
edit_url: '/app/admin/{$controllerLower}/update',
|
||||
del_url: '/app/admin/{$controllerLower}/delete',
|
||||
multi_url: '/app/admin/{$controllerLower}/multi',
|
||||
dragsort_url: '/app/admin/{$controllerLower}/weigh',
|
||||
index_url: '{:admin_path()}/{$controllerLower}/select',
|
||||
add_url: '{:admin_path()}/{$controllerLower}/insert',
|
||||
edit_url: '{:admin_path()}/{$controllerLower}/update',
|
||||
del_url: '{:admin_path()}/{$controllerLower}/delete',
|
||||
multi_url: '{:admin_path()}/{$controllerLower}/multi',
|
||||
dragsort_url: '{:admin_path()}/{$controllerLower}/weigh',
|
||||
table: 'admin',
|
||||
}
|
||||
});
|
||||
@@ -78,20 +78,20 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
Config['upload_url'] = '{:admin_path()}/file/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
insert:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
Config['upload_url'] = '{:admin_path()}/file/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
getRole:function(){
|
||||
Fast.api.ajax({
|
||||
url: "/app/admin/adminrole/select?format=select",
|
||||
url: "{:admin_path()}/adminrole/select?format=select",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
var html = "";
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
<input id="c-{$fieldName}" class="form-control" size="50" name="{$fieldName}" type="hidden" value="{\$row.{$fieldName}|default=''}" data-tip="image">
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-{$fieldName}">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-{$fieldName}" data-mimetype="image/*" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-{$fieldName}" data-mimetype="image/*" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-{$fieldName}" data-mimetype="image/*" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-{$fieldName}" data-mimetype="image/*" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -64,8 +64,8 @@
|
||||
<input id="c-{$fieldName}" class="form-control" size="50" name="{$fieldName}" type="hidden" value="{\$row.{$fieldName}|default=''}" data-tip="image">
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-{$fieldName}">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-{$fieldName}" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-{$fieldName}" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-{$fieldName}" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-{$fieldName}" data-multiple="false" data-preview-id="p-{$fieldName}"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace app\middleware;
|
||||
|
||||
use Override;
|
||||
use support\Container;
|
||||
use Webman\MiddlewareInterface;
|
||||
use Webman\Http\Response;
|
||||
@@ -12,6 +13,7 @@ class ActionHook implements MiddlewareInterface
|
||||
public function process(Request $request, callable $next) : Response
|
||||
{
|
||||
if ($request->controller) {
|
||||
|
||||
// 禁止直接访问beforeAction afterAction
|
||||
if (substr($request->action,0,9) === '__before_' || substr($request->action,0,8) === '__after_') {
|
||||
$callback = Route::getFallback() ?? function () {
|
||||
|
||||
+17
-3
@@ -75,9 +75,18 @@ class Archives extends Base
|
||||
public function getCategoryOptions($type='default'){
|
||||
return Category::where('status','1')->where('type',$type)->column('id,title');
|
||||
}
|
||||
function setCreatedAtAttr($v,$row=[]){
|
||||
cp($v);
|
||||
cp($row);
|
||||
|
||||
function setCreatedAtAttr($v){
|
||||
if($v && strpos($v,'-')){
|
||||
return strtotime($v);
|
||||
}
|
||||
return $v;
|
||||
}
|
||||
function setUpdatedAtAttr($v){
|
||||
if($v && strpos($v,'-')){
|
||||
return strtotime($v);
|
||||
}
|
||||
return $v;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +95,11 @@ class Archives extends Base
|
||||
return Config('site.flagtype');
|
||||
}
|
||||
|
||||
public function content()
|
||||
{
|
||||
return $this->hasOne('content', 'id', 'id');
|
||||
// ->bind(['content']);//->setEagerlyType(0);
|
||||
}
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo('Category', 'category_id', 'id');//->setEagerlyType(0);
|
||||
|
||||
@@ -11,4 +11,9 @@ use app\model\Base;
|
||||
*/
|
||||
class Content extends Base
|
||||
{
|
||||
protected function getOptions(): array{
|
||||
return array_merge(parent::getOptions(),[
|
||||
'autoWriteTimestamp' => false
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use app\model\Base;
|
||||
/**
|
||||
* @property integer $id 主键(ID)
|
||||
* @property integer $user_id 用户ID
|
||||
* @property string $title 名字
|
||||
* @property string $path 文件
|
||||
* @property integer $size 大小
|
||||
* @property string $mime_type 文件类型
|
||||
* @property string $extension 扩展名
|
||||
* @property integer $height 高度
|
||||
* @property integer $width 宽度
|
||||
* @property string $sha1 文件sha1值
|
||||
* @property integer $use_count 使用次数
|
||||
* @property integer $created_at 创建时间
|
||||
* @property integer $updated_at 更新时间
|
||||
* @property integer $deleted_at 删除时间
|
||||
*/
|
||||
class Files extends Base
|
||||
{
|
||||
protected $name = 'files';
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User', 'user_id', 'id');//->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
/**
|
||||
* 朋友圈动态模型
|
||||
* @property integer $id 主键(ID)
|
||||
* @property integer $user_id 用户ID
|
||||
* @property string $body 内容
|
||||
* @property string $files 图片列表(JSON)
|
||||
* @property integer $like_count 点赞数
|
||||
* @property integer $comment_count 评论数
|
||||
* @property integer $created_at 创建时间
|
||||
* @property integer $updated_at 更新时间
|
||||
* @property integer $status 状态(0:隐藏 1:正常)
|
||||
*/
|
||||
class FriendCircle extends Base
|
||||
{
|
||||
protected $name = 'friend_circle';
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return array_merge(parent::getOptions(), [
|
||||
'insert' => [
|
||||
'status' => 1,
|
||||
'like_count' => 0,
|
||||
'comment_count' => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
public static function onAfterInsert($row){
|
||||
$changeData = $row->getChangedData();
|
||||
if(isset($changeData['files'])) {
|
||||
$files = json_decode($changeData['files'],true);
|
||||
Files::whereIn('path',$files)->inc('use_count');
|
||||
};
|
||||
}
|
||||
|
||||
public static function onAfterUpdate($row){
|
||||
$OrgData = $row->getOrigin();
|
||||
$changeData = $row->getChangedData();
|
||||
if(isset($OrgData['files'])) {
|
||||
if(is_array($OrgData['files'])){
|
||||
\support\Log::alert('OrgData array');
|
||||
}else{
|
||||
\support\Log::info('OrgData string');
|
||||
$files = json_decode($OrgData['files'],true);
|
||||
Files::whereIn('path',$files)->dec('use_count');
|
||||
}
|
||||
};
|
||||
if(isset($changeData['files'])) {
|
||||
if(is_array($changeData['files'])){
|
||||
\support\Log::alert('changeData array');
|
||||
}else{
|
||||
\support\Log::info('changeData string');
|
||||
$files = json_decode($changeData['files'],true);
|
||||
Files::whereIn('path',$files)->inc('use_count');
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 关联用户
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('\\app\\model\\User', 'user_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联点赞
|
||||
*/
|
||||
public function likes()
|
||||
{
|
||||
return $this->hasMany('\\app\\model\\FriendCircleLike', 'circle_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联评论
|
||||
*/
|
||||
public function comments()
|
||||
{
|
||||
return $this->hasMany('\\app\\model\\FriendCircleComment', 'circle_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片列表
|
||||
*/
|
||||
public function getFilesAttr($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
return [];
|
||||
}
|
||||
if(is_array($value)){
|
||||
return $value;
|
||||
}
|
||||
$files = json_decode($value, true);
|
||||
return is_array($files) ? $files : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置图片列表
|
||||
*/
|
||||
public function setFilesAttr($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
return '[]';
|
||||
}
|
||||
if (is_array($value)) {
|
||||
return json_encode($value, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
/**
|
||||
* 获取图片列表
|
||||
*/
|
||||
public function getAddressAttr($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
return [];
|
||||
}
|
||||
$files = json_decode($value, true);
|
||||
return is_array($files) ? $files : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置图片列表
|
||||
*/
|
||||
public function setAddressAttr($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
return '{"chooseFlag":false}';
|
||||
}
|
||||
if (is_array($value)) {
|
||||
return json_encode($value, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
/**
|
||||
* 朋友圈评论模型
|
||||
* @property integer $id 主键(ID)
|
||||
* @property integer $circle_id 朋友圈动态ID
|
||||
* @property integer $user_id 用户ID
|
||||
* @property integer $reply_user_id 回复的用户ID(0表示直接评论)
|
||||
* @property string $body 评论内容
|
||||
* @property integer $created_at 创建时间
|
||||
* @property integer $updated_at 更新时间
|
||||
* @property integer $status 状态(0:隐藏 1:正常)
|
||||
*/
|
||||
class FriendCircleComment extends Base
|
||||
{
|
||||
protected $name = 'friend_circle_comment';
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return array_merge(parent::getOptions(), [
|
||||
'insert' => [
|
||||
'status' => 1,
|
||||
'reply_user_id' => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联朋友圈动态
|
||||
*/
|
||||
public function circle()
|
||||
{
|
||||
return $this->belongsTo('\\app\\model\\FriendCircle', 'circle_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联评论用户
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('\\app\\model\\User', 'user_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联被回复的用户
|
||||
*/
|
||||
public function replyUser()
|
||||
{
|
||||
return $this->belongsTo('\\app\\model\\User', 'reply_user_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
|
||||
/**
|
||||
* 朋友圈点赞模型
|
||||
* @property integer $id 主键(ID)
|
||||
* @property integer $circle_id 朋友圈动态ID
|
||||
* @property integer $user_id 用户ID
|
||||
* @property integer $created_at 创建时间
|
||||
*/
|
||||
class FriendCircleLike extends Base
|
||||
{
|
||||
protected $name = 'friend_circle_like';
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
/**
|
||||
* 关联朋友圈动态
|
||||
*/
|
||||
public function circle()
|
||||
{
|
||||
return $this->belongsTo('\\app\\model\\FriendCircle', 'circle_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联用户
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('\\app\\model\\User', 'user_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
use app\model\Base;
|
||||
/**
|
||||
* @property integer $id 主键(ID) - 无注释
|
||||
* @property string $title 名称
|
||||
* @property float $price 价格
|
||||
* @property float $org_price 原价
|
||||
* @property integer $duration 时长
|
||||
* @property string $label 标签
|
||||
* @property integer $status 0:禁用,1启用
|
||||
* @property integer $created_at 创建时间
|
||||
* @property integer $updated_at 更新时间
|
||||
*/
|
||||
class Thali extends Base
|
||||
{
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
// 所有的参数配置统一返回
|
||||
return array_merge(parent::getOptions(),[
|
||||
'append' => []
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
+9
-4
@@ -82,12 +82,12 @@ class User extends Base
|
||||
public static function onAfterUpdate($row){
|
||||
$changeData = $row->getChangedData();
|
||||
$orgData = $row->getOrigin();
|
||||
//cp($changeData);
|
||||
if(isset($changeData['avatar']) || isset($changeData['nickname'])){
|
||||
request()->IM->user->updateUserInfo($row->id,[
|
||||
$sdata = [
|
||||
'nickname' => $row->nickname,
|
||||
'faceURL' => cdnurl($row->avatar)
|
||||
]);
|
||||
];
|
||||
request()->IM->user->updateUserInfo($row->id,$sdata);
|
||||
}
|
||||
if(isset($changeData['status']) || $changeData['status'] == '0'){
|
||||
request()->IM->user->forceLogout($row->id);
|
||||
@@ -130,7 +130,12 @@ class User extends Base
|
||||
{
|
||||
return $this->hasMany(UserTeam::class, 'ancestor_id', 'id');
|
||||
}
|
||||
|
||||
function setExpireAtAttr($v){
|
||||
if($v && strpos($v,'-')){
|
||||
return strtotime($v);
|
||||
}
|
||||
return $v;
|
||||
}
|
||||
public static function transform($from_currency,$to_currency,$user_id,$amount,\app\enum\BalanceType $type,$memo=null){
|
||||
|
||||
if(!in_array($from_currency,Config('site.allow_currencys'))){
|
||||
|
||||
@@ -5,11 +5,17 @@ namespace app\model;
|
||||
|
||||
/**
|
||||
* @property integer $id 主键(主键)
|
||||
* @property integer $pid 上级id
|
||||
* @property string $name 角色名
|
||||
* @property string $rules 权限
|
||||
* @property string $created_at 创建时间
|
||||
* @property string $updated_at 更新时间
|
||||
* @property integer $pid 上级id
|
||||
* @property integer $max_send_msg_count 最大消息数量
|
||||
* @property integer $max_friend_count 最大好友数量
|
||||
* @property integer $max_group_join_count 最大加入的群组数量
|
||||
* @property integer $max_gourp_create_count 最大创建的群组数量
|
||||
* @property integer $created_at 创建时间
|
||||
* @property integer $updated_at 更新时间
|
||||
* @property integer $status 状态
|
||||
|
||||
*/
|
||||
class UserRole extends Base
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace app\model;
|
||||
|
||||
use app\model\Base;
|
||||
use support\Model;
|
||||
/**
|
||||
* @property integer $id 主键(主键)
|
||||
* @property string $title 标题
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use app\model\Base;
|
||||
/**
|
||||
* @property integer $id 主键(ID) - 无注释
|
||||
* @property integer $user_id 用户ID
|
||||
* @property float $deduction_amount 提现金额
|
||||
* @property float $recive_amount 到账金额
|
||||
* @property float $fee 后续费
|
||||
* @property string $title 姓名
|
||||
* @property string $network 方式
|
||||
* @property string $address 地址
|
||||
* @property integer $transfer_at 转账时间
|
||||
* @property string $txid 凭证
|
||||
* @property string $memo 备注
|
||||
* @property integer $created_at 创建时间
|
||||
* @property integer $updated_at 更新时间
|
||||
* @property integer $status 状态
|
||||
*/
|
||||
class Version extends Base
|
||||
{
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
// 所有的参数配置统一返回
|
||||
return array_merge(parent::getOptions(),[
|
||||
'append' => ['source_text']
|
||||
]);
|
||||
}
|
||||
function getSourceTextAttr($v,$row){
|
||||
if($v){
|
||||
return cdnurl($v);
|
||||
}
|
||||
}
|
||||
function getOsList(){
|
||||
return [
|
||||
"android"=>"Android",
|
||||
"ios"=>"IOS",
|
||||
"harmonry"=>"鸿蒙"
|
||||
];
|
||||
}
|
||||
function getTypeList(){
|
||||
return [
|
||||
"1"=>"WGT热更新",
|
||||
"0"=>"整包更新",
|
||||
"2"=>"外链下载更新"
|
||||
];
|
||||
}
|
||||
function getForceList(){
|
||||
return [
|
||||
"0"=>"可选更新",
|
||||
"1"=>"强制更新",
|
||||
];
|
||||
}
|
||||
function getStatusList(){
|
||||
return [
|
||||
'0' => '禁用',
|
||||
'1' => '启用'
|
||||
];
|
||||
}
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User', 'user_id', 'id');//->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace app\validate;
|
||||
|
||||
use taoser\Validate;
|
||||
|
||||
class User extends Validate
|
||||
{
|
||||
protected $rule = [
|
||||
'username' => 'require|max:25',
|
||||
'email' => 'email',
|
||||
'mobile' => 'mobile',
|
||||
'password' => 'require|max:32'
|
||||
];
|
||||
|
||||
// 定义信息
|
||||
protected $message = [
|
||||
'username.require' => '去设置用户名',
|
||||
'username.max' => '用户名最多不能超过25个字符',
|
||||
'mobile' => '手机号格式错误',
|
||||
'email' => '邮箱格式错误',
|
||||
'password.require' => '请设置密码',
|
||||
'password.max' => '密码最多不能超过32个字符',
|
||||
];
|
||||
//定义场景
|
||||
protected $scene = [
|
||||
'register.email' => ['email','password'],
|
||||
'register.username' => ['username','password'],
|
||||
'register.mobile' => ['mobile','password'],
|
||||
];
|
||||
|
||||
}
|
||||
+2
-1
@@ -18,7 +18,8 @@ return [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/webman'.ceil(date('H')/6).'.log',
|
||||
//runtime_path() . '/logs/webman'.ceil(date('H')/6).'.log',
|
||||
runtime_path() . '/logs/webman.log',
|
||||
7, //$maxFiles
|
||||
Monolog\Logger::INFO,
|
||||
],
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ return [
|
||||
base_path() . '/plugin/app',
|
||||
base_path() . '/support',
|
||||
base_path() . '/resource',
|
||||
base_path() . '/.env',
|
||||
base_path() . '/.env'
|
||||
],
|
||||
// 文件后缀
|
||||
'monitor_extensions' => [
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
use Webman\Route;
|
||||
|
||||
Route::get('/u/{code}', [\app\controller\IndexController::class, 'user']);
|
||||
Route::get('/g/{code}', [\app\controller\IndexController::class, 'group']);
|
||||
|
||||
Route::fallback(function(){
|
||||
$fn = base_path().'/public/index.html';
|
||||
if(file_exists($fn)){
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
-- 朋友圈功能数据库表结构
|
||||
|
||||
-- 朋友圈动态表
|
||||
CREATE TABLE IF NOT EXISTS `friend_circle` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int(11) NOT NULL COMMENT '用户ID',
|
||||
`body` text COMMENT '内容',
|
||||
`files` text COMMENT '图片列表(JSON)',
|
||||
`like_count` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数',
|
||||
`comment_count` int(11) NOT NULL DEFAULT '0' COMMENT '评论数',
|
||||
`created_at` int(11) NOT NULL COMMENT '创建时间',
|
||||
`updated_at` int(11) NOT NULL COMMENT '更新时间',
|
||||
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(0:隐藏 1:正常)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `user_id` (`user_id`),
|
||||
KEY `status` (`status`),
|
||||
KEY `created_at` (`created_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='朋友圈动态表';
|
||||
|
||||
-- 朋友圈点赞表
|
||||
CREATE TABLE IF NOT EXISTS `friend_circle_like` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`circle_id` int(11) NOT NULL COMMENT '朋友圈动态ID',
|
||||
`user_id` int(11) NOT NULL COMMENT '用户ID',
|
||||
`created_at` int(11) NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `circle_user` (`circle_id`,`user_id`),
|
||||
KEY `circle_id` (`circle_id`),
|
||||
KEY `user_id` (`user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='朋友圈点赞表';
|
||||
|
||||
-- 朋友圈评论表
|
||||
CREATE TABLE IF NOT EXISTS `friend_circle_comment` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`circle_id` int(11) NOT NULL COMMENT '朋友圈动态ID',
|
||||
`user_id` int(11) NOT NULL COMMENT '用户ID',
|
||||
`reply_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '回复的用户ID(0表示直接评论)',
|
||||
`body` text NOT NULL COMMENT '评论内容',
|
||||
`created_at` int(11) NOT NULL COMMENT '创建时间',
|
||||
`updated_at` int(11) NOT NULL COMMENT '更新时间',
|
||||
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(0:隐藏 1:正常)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `circle_id` (`circle_id`),
|
||||
KEY `user_id` (`user_id`),
|
||||
KEY `reply_user_id` (`reply_user_id`),
|
||||
KEY `status` (`status`),
|
||||
KEY `created_at` (`created_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='朋友圈评论表';
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use support\think\Db;
|
||||
use taoser\facade\Validate;
|
||||
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||
|
||||
/**
|
||||
* 附件管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AttachController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \app\model\Files
|
||||
*/
|
||||
protected $model = null;
|
||||
/**
|
||||
* 构造函数
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->model = new \app\model\Files();
|
||||
}
|
||||
function list(Request $request)
|
||||
{
|
||||
return view('', [
|
||||
|
||||
]);
|
||||
}
|
||||
function feupload(Request $request): Response
|
||||
{
|
||||
$user = ['id'=>admin_id()];
|
||||
$savePath = $request->post('savePath','files');
|
||||
$validate = Validate::rule('savePath', 'alphaNum');
|
||||
$data = ['savePath' => $savePath];
|
||||
if (!$validate->check($data)) {
|
||||
return $this->fail( '参数错误:'.$validate->getError());
|
||||
}
|
||||
$savePath = trim($savePath,'/');
|
||||
$savePath = 'upload/'.$savePath.'/'.$user['id'];
|
||||
$maxSize = 1024*1024*100; //100M
|
||||
//多文件上传
|
||||
$files = $request->file();
|
||||
try {
|
||||
$result = Storage::adapter('public')
|
||||
->path($savePath)
|
||||
->size(1024*1024*10)
|
||||
->extYes(['image/jpeg','image/png'])
|
||||
->uploads($files,0,$maxSize,false);
|
||||
$save_datas = [];
|
||||
foreach($result as $k=>$fileinfo){
|
||||
$save_datas[] = [
|
||||
'user_id' => $user['id'],
|
||||
'title' => $fileinfo->origin_name,
|
||||
'path' => $fileinfo->file_name,
|
||||
'size' => $fileinfo->size,
|
||||
'mime_type' => $fileinfo->mime_type,
|
||||
'extension' => $fileinfo->extension,
|
||||
'height' => $fileinfo->file_height,
|
||||
'width' => $fileinfo->file_width,
|
||||
'sha1' => sha1_file(public_path($fileinfo->file_name)),
|
||||
'use_count' => 0,
|
||||
];
|
||||
}
|
||||
\app\model\Files::saveAll($save_datas);
|
||||
return $this->success(__('successful'),[
|
||||
'link' => $result[0]['path'],
|
||||
]);
|
||||
}catch (\Exception $e){
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
function upload(Request $request): Response
|
||||
{
|
||||
log_alert(0);
|
||||
$savePath = $request->post('savePath','files');
|
||||
$validate = Validate::rule('savePath', 'alphaNum');
|
||||
$data = ['savePath' => $savePath];
|
||||
log_alert($data);
|
||||
if (!$validate->check($data)) {
|
||||
cp($validate->getError());
|
||||
return $this->fail( '参数错误:'.$validate->getError());
|
||||
}
|
||||
log_alert('1');
|
||||
$file = current($request->file());
|
||||
if (!$file || !$file->isValid()) {
|
||||
return $this->fail('未找到文件');
|
||||
}
|
||||
log_alert('2');
|
||||
try {
|
||||
$data = $this->base($request, $savePath);
|
||||
} catch (\Exception $e) {
|
||||
log_alert($e->getMessage());
|
||||
//throw $th;
|
||||
}
|
||||
log_alert('3');
|
||||
//cp($data);
|
||||
return $this->success( '上传成功', [
|
||||
'url' => $data['realpath'],
|
||||
'name' => $data['name'],
|
||||
'fullurl' => $data['url'],
|
||||
'size' => $data['size'],
|
||||
'url1' => $data['url'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传数据
|
||||
* @param Request $request
|
||||
* @param $savePath 保存位置
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function base(Request $request, $savePath): array
|
||||
{
|
||||
$user = ['id'=>admin_id()];
|
||||
// 适配器 local默认是存储在runtime目录下 public默认是存储在public目录下
|
||||
// 可访问的静态文件建议public
|
||||
// 默认适配器是local
|
||||
//Storage::adapter('public');
|
||||
$savePath = trim($savePath,'/');
|
||||
$savePath = 'upload/'.$savePath;
|
||||
cp($savePath);
|
||||
$file = current($request->file());
|
||||
cp($file);
|
||||
$mimetype = explode(',',Config('site.upload_mimetype'));
|
||||
$maxsize = Config('site.upload_maxsize')*1024*1024;
|
||||
$result = Storage::adapter('public')
|
||||
->path($savePath)
|
||||
->size($maxsize)
|
||||
->extYes($mimetype)
|
||||
->upload($file);
|
||||
cp($result);
|
||||
|
||||
$save_datas = [
|
||||
'user_id' => $user['id'],
|
||||
'category' => 'default',
|
||||
'title' => $result->origin_name,
|
||||
'path' => $result->file_name,
|
||||
'size' => $result->size,
|
||||
'mime_type' => $result->mime_type,
|
||||
'extension' => $result->extension,
|
||||
'height' => $result->file_height,
|
||||
'width' => $result->file_width,
|
||||
'sha1' => sha1_file(public_path($result->file_name)),
|
||||
'use_count' => 0,
|
||||
];
|
||||
(new \app\model\Files)->save($save_datas);
|
||||
return [
|
||||
'code' => 0,
|
||||
'url' => $result->file_url,
|
||||
'name' => $result->origin_name,
|
||||
'realpath' => '/'.$result->file_name,
|
||||
'size' => $result->size,
|
||||
'mime_type' => $result->mime_type,
|
||||
'image_with'=> $result->file_width,
|
||||
'image_height' => $result->file_height,
|
||||
'ext' => $result->extension,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use support\think\Db;
|
||||
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||
|
||||
/**
|
||||
* 附件管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class AttachmentController extends Crud
|
||||
{
|
||||
function list(Request $request)
|
||||
{
|
||||
|
||||
return view('', [
|
||||
|
||||
]);
|
||||
}
|
||||
function feupload(Request $request): Response
|
||||
{
|
||||
|
||||
$file = current($request->file());
|
||||
if (!$file || !$file->isValid()) {
|
||||
return $this->fail('未找到文件');
|
||||
}
|
||||
$data = $this->base($request, '/upload/files/' . date('Ymd'));
|
||||
return json([
|
||||
'link' => $data['url'],
|
||||
]);
|
||||
}
|
||||
function upload(Request $request): Response
|
||||
{
|
||||
|
||||
$file = current($request->file());
|
||||
if (!$file || !$file->isValid()) {
|
||||
return $this->fail('未找到文件');
|
||||
}
|
||||
$data = $this->base($request, '/upload/files/' . date('Ymd'));
|
||||
//cp($data);
|
||||
return $this->json(0, '上传成功', [
|
||||
'url' => $data['realpath'],
|
||||
'name' => $data['name'],
|
||||
'fullurl' => $data['url'],
|
||||
'size' => $data['size'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传数据
|
||||
* @param Request $request
|
||||
* @param $relative_dir
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function base(Request $request, $relative_dir): array
|
||||
{
|
||||
// 适配器 local默认是存储在runtime目录下 public默认是存储在public目录下
|
||||
// 可访问的静态文件建议public
|
||||
// 默认适配器是local
|
||||
//Storage::adapter('public');
|
||||
$relative_dir = ltrim($relative_dir, '\\/');
|
||||
$file = current($request->file());
|
||||
try {
|
||||
if (!$file || !$file->isValid()) {
|
||||
throw new \support\exception\BusinessException('未找到上传文件', 400);
|
||||
}
|
||||
|
||||
$ext = $file->getUploadExtension() ?: null;
|
||||
$mime_type = $file->getUploadMimeType();
|
||||
$file_name = $file->getUploadName();
|
||||
$file_size = $file->getSize();
|
||||
|
||||
if (!$ext && $file_name === 'blob') {
|
||||
[$___image, $ext] = explode('/', $mime_type);
|
||||
unset($___image);
|
||||
}
|
||||
|
||||
$ext = strtolower($ext);
|
||||
$ext_forbidden_map = ['php', 'php3', 'php5', 'css', 'js', 'html', 'htm', 'asp', 'jsp'];
|
||||
if (in_array($ext, $ext_forbidden_map)) {
|
||||
throw new \support\exception\BusinessException('不支持该格式的文件上传', 400);
|
||||
}
|
||||
$mimetype = explode(',',Config('site.mimetype'));
|
||||
$result = Storage::adapter('public')
|
||||
->path($relative_dir)
|
||||
->size(1024 * 1024 * 5)
|
||||
->extYes($mimetype)
|
||||
//->extNo(['image/png'])
|
||||
->upload($file);
|
||||
} catch (\Exception $e) {
|
||||
return [
|
||||
'code' => 1,
|
||||
'msg' => $e->getMessage()
|
||||
];
|
||||
}
|
||||
// cp($result);
|
||||
// stdClass Object
|
||||
// (
|
||||
// [adapter] => public
|
||||
// [origin_name] => OIP-C (1).jpg
|
||||
// [file_name] => upload/files/20250527/eb14c1bfe6e7a22415bbbb30dfe90ba1_6834f0974db76.jpg
|
||||
// [storage_key] => eb14c1bfe6e7a22415bbbb30dfe90ba1_6834f0974db76
|
||||
// [file_url] => //luru.oss-ap-southeast-1.aliyuncs.com/upload/files/20250527/eb14c1bfe6e7a22415bbbb30dfe90ba1_6834f0974db76.jpg
|
||||
// [size] => 15370
|
||||
// [mime_type] => image/jpeg
|
||||
// [extension] => jpg
|
||||
// [file_height] => 474
|
||||
// [file_width] => 474
|
||||
// )
|
||||
return [
|
||||
'code' => 0,
|
||||
'url' => $result->file_url,
|
||||
'name' => $result->origin_name,
|
||||
'realpath' => '/'.$result->file_name,
|
||||
'size' => $result->size,
|
||||
'mime_type' => $result->mime_type,
|
||||
'image_with' => $result->file_width,
|
||||
'image_height' => $result->file_height,
|
||||
'ext' => $result->extension,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use support\think\Db;
|
||||
use taoser\facade\Validate;
|
||||
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||
|
||||
/**
|
||||
* 附件管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class FilesController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \app\model\Files
|
||||
*/
|
||||
protected $model = null;
|
||||
/**
|
||||
* 构造函数
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->model = new \app\model\Files();
|
||||
}
|
||||
function list(Request $request)
|
||||
{
|
||||
return view('', [
|
||||
|
||||
]);
|
||||
}
|
||||
function feupload(Request $request): Response
|
||||
{
|
||||
$user = ['id'=>admin_id()];
|
||||
$savePath = $request->post('savePath','files');
|
||||
$validate = Validate::rule('savePath', 'alphaNum');
|
||||
$data = ['savePath' => $savePath];
|
||||
if (!$validate->check($data)) {
|
||||
return $this->fail( '参数错误:'.$validate->getError());
|
||||
}
|
||||
$savePath = trim($savePath,'/');
|
||||
$savePath = 'upload/'.$savePath.'/'.$user['id'];
|
||||
$maxSize = 1024*1024*100; //100M
|
||||
//多文件上传
|
||||
$files = $request->file();
|
||||
try {
|
||||
$result = Storage::adapter('public')
|
||||
->path($savePath)
|
||||
->size(1024*1024*10)
|
||||
->extYes(['image/jpeg','image/png'])
|
||||
->uploads($files,0,$maxSize,false);
|
||||
$save_datas = [];
|
||||
foreach($result as $k=>$fileinfo){
|
||||
$save_datas[] = [
|
||||
'user_id' => $user['id'],
|
||||
'title' => $fileinfo->origin_name,
|
||||
'path' => $fileinfo->file_name,
|
||||
'size' => $fileinfo->size,
|
||||
'mime_type' => $fileinfo->mime_type,
|
||||
'extension' => $fileinfo->extension,
|
||||
'height' => $fileinfo->file_height,
|
||||
'width' => $fileinfo->file_width,
|
||||
'sha1' => sha1_file(public_path($fileinfo->file_name)),
|
||||
'use_count' => 0,
|
||||
];
|
||||
}
|
||||
\app\model\Files::saveAll($save_datas);
|
||||
return $this->success(__('successful'),[
|
||||
'link' => $result[0]['path'],
|
||||
]);
|
||||
}catch (\Exception $e){
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
function upload(Request $request): Response
|
||||
{
|
||||
cp('0');
|
||||
$savePath = $request->post('savePath','files');
|
||||
$validate = Validate::rule('savePath', 'alphaNum');
|
||||
$data = ['savePath' => $savePath];
|
||||
cp($data);
|
||||
if (!$validate->check($data)) {
|
||||
cp($validate->getError());
|
||||
return $this->fail( '参数错误:'.$validate->getError());
|
||||
}
|
||||
cp('1');
|
||||
$file = current($request->file());
|
||||
if (!$file || !$file->isValid()) {
|
||||
return $this->fail('未找到文件');
|
||||
}
|
||||
cp('2');
|
||||
$data = $this->base($request, $savePath);
|
||||
cp('3');
|
||||
//cp($data);
|
||||
return $this->success( '上传成功', [
|
||||
'url' => $data['realpath'],
|
||||
'name' => $data['name'],
|
||||
'fullurl' => $data['url'],
|
||||
'size' => $data['size'],
|
||||
'url1' => $data['url'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传数据
|
||||
* @param Request $request
|
||||
* @param $savePath 保存位置
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function base(Request $request, $savePath): array
|
||||
{
|
||||
$user = ['id'=>admin_id()];
|
||||
// 适配器 local默认是存储在runtime目录下 public默认是存储在public目录下
|
||||
// 可访问的静态文件建议public
|
||||
// 默认适配器是local
|
||||
//Storage::adapter('public');
|
||||
$savePath = trim($savePath,'/');
|
||||
$savePath = 'upload/'.$savePath;
|
||||
$file = current($request->file());
|
||||
$mimetype = explode(',',Config('site.upload_mimetype'));
|
||||
$maxsize = Config('site.upload_maxsize')*1024*1024;
|
||||
$result = Storage::adapter('public')
|
||||
->path($savePath)
|
||||
->size($maxsize)
|
||||
->extYes($mimetype)
|
||||
->upload($file);
|
||||
|
||||
$save_datas = [
|
||||
'user_id' => $user['id'],
|
||||
'category' => 'default',
|
||||
'title' => $result->origin_name,
|
||||
'path' => $result->file_name,
|
||||
'size' => $result->size,
|
||||
'mime_type' => $result->mime_type,
|
||||
'extension' => $result->extension,
|
||||
'height' => $result->file_height,
|
||||
'width' => $result->file_width,
|
||||
'sha1' => sha1_file(public_path($result->file_name)),
|
||||
'use_count' => 0,
|
||||
];
|
||||
(new \app\model\Files)->save($save_datas);
|
||||
return [
|
||||
'code' => 0,
|
||||
'url' => $result->file_url,
|
||||
'name' => $result->origin_name,
|
||||
'realpath' => '/'.$result->file_name,
|
||||
'size' => $result->size,
|
||||
'mime_type' => $result->mime_type,
|
||||
'image_with'=> $result->file_width,
|
||||
'image_height' => $result->file_height,
|
||||
'ext' => $result->extension,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class IndexController extends Base
|
||||
$admin = admin();
|
||||
if (!$admin) {
|
||||
$title = config('site.name') ?? 'admin';
|
||||
$logo = cdnurl(config('site.admin_logo') ?? '/app/admin/images/logo.png');
|
||||
$logo = cdnurl(config('site.admin_logo') ?? admin_path().'/images/logo.png');
|
||||
return view('account/login',['logo'=>$logo,'title'=>$title]);
|
||||
}
|
||||
//缓存
|
||||
|
||||
@@ -8,7 +8,7 @@ use support\Request;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 用户管理
|
||||
* 团队管理
|
||||
*/
|
||||
class TeamController extends Crud
|
||||
{
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
use plugin\admin\app\controller\Crud;
|
||||
use app\model\Thali;
|
||||
use support\exception\BusinessException;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 套餐管理
|
||||
*/
|
||||
class ThaliController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Thali
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @return void
|
||||
*/
|
||||
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->model = new Thali();
|
||||
$statusList = $this->model->getStatusList();
|
||||
$this->assign("statusList", $statusList);
|
||||
$this->assignconfig("statusList", $statusList);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class UserController extends Crud
|
||||
['value'=>1,'label'=>"内部用户"],
|
||||
['value'=>2,'label'=>"联盟商"],
|
||||
];
|
||||
$roleList = \app\model\UserRole::order('id','desc')->column('name as label,id as value');
|
||||
$roleList = \app\model\UserRole::order('id','asc')->column('name as label,id as value');
|
||||
$this->assign('groupList',$groupList);
|
||||
$this->assignconfig('groupList',$groupList);
|
||||
$this->assign('roleList',$roleList);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use app\model\User;
|
||||
use plugin\admin\app\controller\Crud;
|
||||
use support\exception\BusinessException;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* 版本管理
|
||||
*/
|
||||
class VersionController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \app\model\Version
|
||||
*/
|
||||
protected $model = null;
|
||||
/**
|
||||
* 构造函数
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->model = new \app\model\Version();
|
||||
$osList = $this->model->getOsList();
|
||||
$this->assign("osList", $osList);
|
||||
$this->assignconfig("osList", $osList);
|
||||
$forceList = $this->model->getForceList();
|
||||
$this->assign("forceList", $forceList);
|
||||
$this->assignconfig("forceList", $forceList);
|
||||
$typeList = $this->model->getTypeList();
|
||||
$this->assign("typeList", $typeList);
|
||||
$this->assignconfig("typeList", $typeList);
|
||||
$statusList = $this->model->getStatusList();
|
||||
$this->assign("statusList", $statusList);
|
||||
$this->assignconfig("statusList", $statusList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ function url($path='',$args=[]){
|
||||
}
|
||||
$path = $path.'?'.$args;
|
||||
}
|
||||
return '/app/admin/'.$path;
|
||||
return admin_path().'/'.$path;
|
||||
}
|
||||
/**
|
||||
* 当前管理员id
|
||||
|
||||
@@ -31,8 +31,8 @@ class AccessControl implements MiddlewareInterface
|
||||
$response = json(['code' => $code, 'msg' => $msg, 'data' => []]);
|
||||
} else {
|
||||
if ($code === 401) {
|
||||
$response = response('<script> if (self !== top) { parent.location = "/app/admin"; }</script>',401);
|
||||
//$response = response('',301, ['Location'=> '/app/admin/index/index']);
|
||||
$response = response('<script> if (self !== top) { parent.location = "'.admin_path().'"; }</script>',401);
|
||||
//$response = response('',301, ['Location'=> admin_path().'/index/index']);
|
||||
} else {
|
||||
$request->app = '';
|
||||
$request->plugin = 'admin';
|
||||
|
||||
@@ -26,7 +26,8 @@ class Config implements MiddlewareInterface
|
||||
$config['debug'] = config('app.debug');
|
||||
$config['controller'] = $request->controller_name;
|
||||
$config['action'] = $request->action_name;
|
||||
$config['moduleurl'] = '/app/admin';
|
||||
$config['moduleurl'] = admin_path();
|
||||
$config['admin_path'] = admin_path();
|
||||
$request->_view_vars = array_merge((array) $request->_view_vars,[
|
||||
'user' => session('admin'),
|
||||
'config' => $config
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
<input id="c-avatar" class="form-control" size="50" name="avatar" type="hidden" value="{$row.avatar|null}" data-tip="头像">
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.avatar" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.avatar" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{layout name="layout"}
|
||||
<div class="card">
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="/app/admin/Admin/insert" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:admin_path()}/Admin/insert" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
<input id="c-avatar" class="form-control" size="50" name="avatar" type="hidden" value="{$row.avatar|null}" data-tip="杀杀杀">
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.avatar" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{layout name="layout"}
|
||||
<div class="card">
|
||||
<div class="toolbar toolbar-btn-action">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.role.insert">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.role.insert" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
<button id="btn_add" type="button" class="btn btn-info m-r-5" permission="app.admin.role.update">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{layout name="layout"}
|
||||
<link href="/app/admin/libs/jquery-treegrid/jquery.treegrid.min.css" rel="stylesheet" />
|
||||
<link href="{:admin_path()}/libs/jquery-treegrid/jquery.treegrid.min.css" rel="stylesheet" />
|
||||
<div class="card">
|
||||
<div class="toolbar toolbar-btn-action">
|
||||
<button type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.adminrule.insert">
|
||||
<button type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.adminrule.insert" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-danger m-r-5 btn-del" permission="app.admin.adminrule.delete">
|
||||
|
||||
@@ -84,4 +84,3 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{include file="common/chooseicontpl" /}
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-image">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -115,7 +115,7 @@
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-images">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.images" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-images" data-mimetype="image/*" data-multiple="false" data-preview-id="p-images"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-images" data-mimetype="image/*" data-multiple="false" data-preview-id="p-images"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-images" data-mimetype="image/*" data-multiple="false" data-preview-id="p-images"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
|
||||
<style>
|
||||
#chooseicon {
|
||||
margin:10px;
|
||||
}
|
||||
#chooseicon ul {
|
||||
margin:5px 0 0 0;
|
||||
}
|
||||
#chooseicon ul li{
|
||||
width:41px;height:42px;
|
||||
line-height:42px;
|
||||
border:1px solid #efefef;
|
||||
padding:1px;
|
||||
margin:1px;
|
||||
text-align: center;
|
||||
font-size:18px;
|
||||
}
|
||||
#chooseicon ul li:hover{
|
||||
border:1px solid #2c3e50;
|
||||
cursor:pointer;
|
||||
}
|
||||
</style>
|
||||
<script id="chooseicontpl" type="text/html">
|
||||
<div id="chooseicon">
|
||||
<div>
|
||||
<form onsubmit="return false;">
|
||||
<div class="input-group input-groupp-md">
|
||||
<div class="input-group-addon">搜索图标</div>
|
||||
<input class="js-icon-search form-control" type="text" placeholder="">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<ul class="list-inline">
|
||||
<% for(var i=0; i<iconlist.length; i++){ %>
|
||||
<li data-font="<%=iconlist[i]%>" data-toggle="tooltip" title="<%=iconlist[i]%>">
|
||||
<i class="mdi mdi-<%=iconlist[i]%>"></i>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
@@ -40,12 +40,12 @@
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;"
|
||||
permission="app.admin.upload.avatar" id="add-pic-btn" href="#!" title="点击上传"
|
||||
permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传"
|
||||
data-input-id="c-avatar"
|
||||
data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp"
|
||||
data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;"
|
||||
permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件"
|
||||
permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件"
|
||||
data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false"
|
||||
data-preview-id="p-avatar"></a>
|
||||
</li>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<label class="control-label col-xs-12 col-sm-2">favisible</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="favisible" id="favisible" value="{$row.favisible|null}"
|
||||
data-favisible="is_recharge_open=1"
|
||||
data-favisible="is_recharge_open==1"
|
||||
data-target="form-group"
|
||||
autocomplete="off" class="form-control">
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{layout name="layout"}
|
||||
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 faupload">
|
||||
<span class="mdi mdi-upload" aria-hidden="true"></span>上传
|
||||
</a>
|
||||
<a id="btn_delete" class="btn btn-danger btn-del btn-disabled disabled">
|
||||
<span class="mdi mdi-window-close" aria-hidden="true"></span>删除
|
||||
</a>
|
||||
</div>
|
||||
<!-- 数据表格 -->
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- {1volist name="::::::Config('site.attachment_category')" id="cvo"}
|
||||
<option value="{1$key}" {1if $row.category==$key}selected{1/if}>{1$cvo}</option>
|
||||
{2volist1} -->
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
{layout name="layout"}
|
||||
<!-- 数据表格 -->
|
||||
<div class="card">
|
||||
<div class="toolbar-btn-action layer-footer">
|
||||
<button class="btn btn-primary m-r-5">确定</button>
|
||||
<button class="btn btn-success m-r-5">关闭</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="table" ></table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,86 @@
|
||||
{layout name="layout"}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form class="form-horizontal" action="__SELF__" method="post">
|
||||
<input type="hidden" name="id" value="{$row.id|null}" />
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">类别</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<select name="category" class="form-control" value="{$row.category}">
|
||||
{volist name=":Config('site.attachment_category')" id="cvo"}
|
||||
<option value="{$key}" {if $row.category==$key}selected{/if}>{$cvo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{if request()->action == 'insert'}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">文件</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
{:buildFileInput('file',$row['file'],'image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp,text/plain',0,false)}
|
||||
</div>
|
||||
</div>
|
||||
{else /}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">名称</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input class="form-control" value="{$row.title}" name="title" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">地址</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input class="form-control" value="{$row.path}" name="path" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">SHA</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input class="form-control" value="{$row.sha1}" name="sha1" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">文件大小</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input class="form-control" value="{$row.size}" name="size" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">Mime</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input class="form-control" value="{$row.mime_type}" name="mime_type" readonly />
|
||||
</div>
|
||||
</div>
|
||||
{if in_array('asd',['jpg','png','gif'])}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">图片大小</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input class="form-control" value="{$row.width}X{$row.height}" readonly />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">扩展名</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input class="form-control" value="{$row.extension}" name="extension" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">上传时间</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input class="form-control" value="{$row.created_at}" name="created_at" readonly />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6 layer-footer">
|
||||
<button type="submit" class="btn btn-primary m-r-5">提交</button>
|
||||
<button type="reset" class="btn btn-md m-r-5">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{include file="common/file_preview" id="preview"/}
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-image">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;display: none;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;display: none;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<td>渠道商数</td>
|
||||
<td>
|
||||
<?php
|
||||
echo \app\model\User::where('group',1)->count('id');
|
||||
echo \app\model\User::where('group_id',1)->count('id');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-image">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.image" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;display: none;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;display: none;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_delete" class="btn btn-danger btn-del btn-disabled disabled">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{layout name="layout"}
|
||||
<div class="card">
|
||||
<div class="toolbar toolbar-btn-action">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.role.insert" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
<button id="btn_add" type="button" class="btn btn-info m-r-5" permission="app.admin.role.update">
|
||||
<span class="mdi mdi-pencil" aria-hidden="true"></span>编辑
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-danger btn-del" permission="app.admin.role.delete">
|
||||
<span class="mdi mdi-window-close" aria-hidden="true"></span>删除
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,50 @@
|
||||
{layout name="layout"}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form class="form-horizontal" method="post" action="__SELF__" role="form">
|
||||
<input type="hidden" name="id" value="{$row.id|null}" />
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">名称:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-title" class="form-control" name="title" type="text" value="{$row.title|null}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">价格:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-price" class="form-control" step="0.01" name="price" type="number" value="{$row.price|default=0}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">原价:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-org_price" class="form-control" step="0.01" name="org_price" type="number" value="{$row.org_price|default=0}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">时间:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-duration" min="0" class="form-control" name="duration" type="number" value="{$row.duration|default=30}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">标签:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-label" class="form-control" name="label" type="text" value="{$row.label|null}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">状态:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
{html:radio options="$statusList" value="$row.status" name="status" /}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="extend" class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6 layer-footer">
|
||||
<button type="submit" class="btn btn-primary m-r-5">确 定</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<form class="form-horizontal" action="__SELF__" method="post">
|
||||
<input type="hidden" name="id" value="{$row.id|null}" />
|
||||
<div class="form-group">
|
||||
<label for="type" class="control-label col-xs-12 col-sm-2">角色</label>
|
||||
<label for="type" class="control-label col-xs-12 col-sm-2">角色{$row.role_id}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<select name="role_id" id="role_id" class="form-control">
|
||||
{volist name="roleList" id="rvo"}
|
||||
@@ -24,14 +24,18 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{if Request()->action == 'update' && $row.group == 2}
|
||||
<!-- <div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">域名:</label>
|
||||
<div class="form-group" data-favisible="role_id==2">
|
||||
<label class="control-label col-xs-12 col-sm-2">VIP过期时间:</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="domain" value="{$row.domain|null}" data-rule="required;length(4~20)" class="form-control" />
|
||||
<input type="text" name="expire_at"
|
||||
value="{$row.expire_at|datetime}"
|
||||
data-date-debug="true"
|
||||
data-date-sideBySide="true"
|
||||
data-date-collapse="false"
|
||||
data-date-format="YYYY-MM-DD HH:mm:ss"
|
||||
class="form-control datetimepicker" />
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
{/if}
|
||||
<!-- <div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">等级</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
@@ -85,8 +89,8 @@
|
||||
<input id="c-avatar" class="form-control" size="50" name="avatar" type="hidden" value="{$row.avatar|default='__IMG__/user/avatar.svg'}" data-tip="头像">
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.avatar" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -125,95 +129,14 @@
|
||||
autocomplete="off" class="form-control datetimepicker">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if in_array('money',Config('site.allow_currencys'))}
|
||||
{volist name=":Config('site.allow_currencys')" id="currency"}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('money')}</label>
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__($currency)}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="money" value="{$row.money|formatAmount}" class="form-control" />
|
||||
<input type="text" name="{$currency}" value="{:formatAmount($row[$currency])}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('score',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('score')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="score" value="{$row.score|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency1',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency1')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency1" value="{$row.currency1|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency2',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency2')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency2" value="{$row.currency2|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency3',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency3')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency3" value="{$row.currency3|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency4',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency4')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency4" value="{$row.currency4|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency5',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency5')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency5" value="{$row.currency5|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency6',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency6')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency6" value="{$row.currency6|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency7',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency7')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency7" value="{$row.currency7|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency8',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency8')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency8" value="{$row.currency8|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if in_array('currency9',Config('site.allow_currencys'))}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('currency9')}</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="currency9" value="{$row.currency9|formatAmount}" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/volist}
|
||||
{if Request()->action =='update'}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">推荐码</label>
|
||||
@@ -241,7 +164,7 @@
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">注册时间</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="join_time" id="join_time" value="{$row.join_time}" autocomplete="off" class="form-control" disabled>
|
||||
<input type="text" name="join_time" id="join_time" value="{$row.join_time|datetime}" autocomplete="off" class="form-control" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{layout name="layout"}
|
||||
<div class="card">
|
||||
<div class="toolbar toolbar-btn-action">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.role.insert">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.role.insert" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
<button id="btn_add" type="button" class="btn btn-info m-r-5" permission="app.admin.role.update">
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<div class="card-body">
|
||||
<form class="form-horizontal" method="post" action="__SELF__" role="form">
|
||||
<input type="hidden" name="id" value="{$row.id|null}" />
|
||||
<input type="hidden" name="rules" value="*"/>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">父级:</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
@@ -21,41 +22,42 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">销售额要求:</label>
|
||||
<label class="control-label col-xs-12 col-sm-2">最大消息数量:</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<div class="input-group">
|
||||
<input type="number" name="need_sales" value="{$row.need_sales|default=0}" class="form-control" min="0" data-rule="required;range(0~99999999)" />
|
||||
<div class="input-group-addon">¥</div>
|
||||
</div>
|
||||
<input type="number" name="max_send_msg_count" value="{$row.max_send_msg_count|default=10}" class="form-control" min="0" data-rule="required;range(0~99999999)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">消费奖励:</label>
|
||||
<label class="control-label col-xs-12 col-sm-2">最大好友数量:</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="consume_reward" value="{$row.consume_reward|null}" data-rule="required;length(3~6)" class="form-control" />
|
||||
<input type="text" name="max_friend_count" value="{$row.max_friend_count|default=10}" data-rule="required;length(3~6)" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">产值奖:</label>
|
||||
<label class="control-label col-xs-12 col-sm-2">最大加入的群组数量:</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="income_reward" value="{$row.income_reward|null}" data-rule="required;length(3~6)" class="form-control" />
|
||||
<input type="text" name="max_group_join_count" value="{$row.max_group_join_count|default=10}" data-rule="required;length(3~6)" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">提现奖励:</label>
|
||||
<label class="control-label col-xs-12 col-sm-2">最大创建的群组数量:</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="withdrawl_reward" value="{$row.withdrawl_reward|null}" data-rule="required;length(3~6)" class="form-control" />
|
||||
<input type="text" name="max_gourp_create_count" value="{$row.max_gourp_create_count|default=10}" data-rule="required;length(3~6)" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
{php}
|
||||
/*
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">权限:</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<div class="table-responsive">
|
||||
<div id="treeview"></div>
|
||||
</div>
|
||||
<input type="hidden" name="rules" value="{$row.rules|null}" data-rule="required" class="form-control" />
|
||||
<input type="hidden" name="rules" value="{$row.rules|null}" data-rule="required" />
|
||||
</div>
|
||||
</div>
|
||||
*/
|
||||
{/php}
|
||||
<div class="form-group">
|
||||
<label for="extend" class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6 layer-footer">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{layout name="layout"}
|
||||
<link href="/app/admin/libs/jquery-treegrid/jquery.treegrid.min.css" rel="stylesheet" />
|
||||
<link href="{:admin_path()}/libs/jquery-treegrid/jquery.treegrid.min.css" rel="stylesheet" />
|
||||
<div class="card">
|
||||
<div class="toolbar toolbar-btn-action">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.rule.insert">
|
||||
<button id="btn_add" type="button" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" permission="app.admin.rule.insert" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</button>
|
||||
<button id="btn_delete" type="button" class="btn btn-danger m-r-5 btn-del" permission="app.admin.rule.delete">
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<label class="control-label col-xs-12 col-sm-2">图标</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<div class="input-group input-groupp-md">
|
||||
<span class="input-group-addon"><i class="{$row.icon|null}" id="icon-style"></i></span>
|
||||
<span class="input-group-addon"><i class="{$row.icon|null}" id="icon-style"></i>mdi mdi-</span>
|
||||
<input type="text" class="form-control" id="icon" name="icon" value="{$row.icon|null}" />
|
||||
<a href="javascript:;" class="btn-search-icon input-group-addon">搜索图标</a>
|
||||
</div>
|
||||
@@ -84,4 +84,3 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{include file="common/chooseicontpl" /}
|
||||
@@ -0,0 +1,15 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false" data-title="新增">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_delete" class="btn btn-danger btn-del btn-disabled disabled">
|
||||
<span class="mdi mdi-window-close" aria-hidden="true"></span>删除
|
||||
</a>
|
||||
</div>
|
||||
<!-- 数据表格 -->
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
{layout name="layout"}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form class="form-horizontal" action="__SELF__" method="post">
|
||||
<input type="hidden" name="id" value="{$row.id|null}" />
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">平台</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<select name="platform" id="platform" class="form-control">
|
||||
{volist name="osList" id="ovo"}
|
||||
<option value="{$key}" {if $row.type == $key}selected{/if}>{$ovo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">更新方式</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<select name="type" id="type" class="form-control">
|
||||
{volist name="typeList" id="tvo"}
|
||||
<option value="{$key}" {if $row.type == $key}selected{/if}>{$tvo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">强制更新</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<select name="force" id="force" class="form-control">
|
||||
{volist name="forceList" id="fvo"}
|
||||
<option value="{$key}" {if $row.type == $key}selected{/if}>{$fvo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">基座版本</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="version" value="{$row.version|null}" autocomplete="off" data-rule="required" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">WGT版本</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<input type="text" name="version_wgt" value="{$row.version_wgt|null}" autocomplete="off" data-rule="required" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">更新资源</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<div class="form-inline">
|
||||
<input id="c-source" class="form-control" size="50" name="source" type="text" value="{$row.source|htmlentities}" data-tip="请上传资源">
|
||||
<span><button type="button" id="faupload-source" class="btn btn-danger faupload" data-input-id="c-source" data-multiple="false"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
|
||||
<span><button type="button" id="fachoose-source" class="btn btn-primary fachoose" data-input-id="c-source" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">更新内容</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
<textarea name="content" class="form-control">{$row.content|null}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">状态</label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||
{volist name="statusList" id="rvo"}
|
||||
<label class="lyear-radio radio-primary radio-inline">
|
||||
<input type="radio" name="status" {if $row.status == $key} checked{/if} value="{$key}">
|
||||
<span>{$rvo}</span>
|
||||
</label>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8 col-md-6 layer-footer">
|
||||
<button type="submit" class="btn btn-primary m-r-5">提交</button>
|
||||
<button type="reset" class="btn btn-warning m-r-5">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
{layout name="layout"}
|
||||
<div class="toolbar" class="toolbar-btn-action">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增">
|
||||
<a id="btn_add" class="btn btn-primary m-r-5 btn-add" data-url="{:url('insert')}" data-title="新增" data-offset="r" data-area="80%,100%" data-anim="5" data-shade="0.3" data-move="false">
|
||||
<span class="mdi mdi-plus" aria-hidden="true"></span>新增
|
||||
</a>
|
||||
<a id="btn_edit" class="btn btn-success m-r-5 btn-disabled disabled btn-multi" data-params="status=1">
|
||||
|
||||
@@ -71,8 +71,8 @@
|
||||
<input id="c-avatar" class="form-control" size="50" name="avatar" type="hidden" value="{$row.avatar|default='__IMG__/user/avatar.svg'}" data-tip="头像">
|
||||
<ul class="list-inline clearfix lyear-uploads-pic" data-template="preview" id="p-avatar">
|
||||
<li nodelete class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.upload.avatar" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.upload.attachment" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add faupload" style="height: auto;border: 0;" permission="app.admin.files.upload" id="add-pic-btn" href="#!" title="点击上传" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
<a class="pic-add fachoose" style="height: auto;border: 0;" permission="app.admin.files.list" id="choose-pic-btn" href="#!" title="选择文件" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false" data-preview-id="p-avatar"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
'pid' => 9,
|
||||
'created_at' => '2024-09-08 22:04:42',
|
||||
'updated_at' => '2024-09-13 17:10:45',
|
||||
'href' => '/attachment/index',
|
||||
'href' => '/files/index',
|
||||
'type' => 1,
|
||||
'extend' => NULL,
|
||||
'weight' => 700,
|
||||
|
||||
@@ -16,7 +16,7 @@ use plugin\admin\app\controller\AccountController;
|
||||
use Webman\Route;
|
||||
use support\Request;
|
||||
|
||||
Route::any('/app/admin/account/captcha/{type}', [AccountController::class, 'captcha']);
|
||||
Route::any(admin_path().'/account/captcha/{type}', [AccountController::class, 'captcha']);
|
||||
|
||||
Route::fallback(function (Request $request) {
|
||||
return view('common/404');
|
||||
|
||||
+20
@@ -8085,3 +8085,23 @@ div.sp_result_area div.sp_pagination > ul > li.pageInfoBox > a:hover {
|
||||
.img-sm{
|
||||
width: 64px;
|
||||
}
|
||||
/*chooseicon*/
|
||||
#chooseicon {
|
||||
margin:10px;
|
||||
}
|
||||
#chooseicon ul {
|
||||
margin:5px 0 0 0;
|
||||
}
|
||||
#chooseicon ul li{
|
||||
width:41px;height:42px;
|
||||
line-height:42px;
|
||||
border:1px solid #efefef;
|
||||
padding:1px;
|
||||
margin:1px;
|
||||
text-align: center;
|
||||
font-size:18px;
|
||||
}
|
||||
#chooseicon ul li:hover{
|
||||
border:1px solid #2c3e50;
|
||||
cursor:pointer;
|
||||
}
|
||||
@@ -18,12 +18,12 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/address/select',
|
||||
add_url: '/app/admin/address/insert',
|
||||
edit_url: '/app/admin/address/update',
|
||||
del_url: '/app/admin/address/delete',
|
||||
multi_url: '/app/admin/address/multi',
|
||||
//dragsort_url: '/app/admin/address/weigh',
|
||||
index_url: 'address/select',
|
||||
add_url: 'address/insert',
|
||||
edit_url: 'address/update',
|
||||
del_url: 'address/delete',
|
||||
multi_url: 'address/multi',
|
||||
//dragsort_url: 'address/weigh',
|
||||
table: 'address',
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,12 +5,12 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/admin/select',
|
||||
add_url: '/app/admin/admin/insert',
|
||||
edit_url: '/app/admin/admin/update',
|
||||
del_url: '/app/admin/admin/delete',
|
||||
multi_url: '/app/admin/admin/multi',
|
||||
dragsort_url: '/app/admin/admin/weigh',
|
||||
index_url: 'admin/select',
|
||||
add_url: 'admin/insert',
|
||||
edit_url: 'admin/update',
|
||||
del_url: 'admin/delete',
|
||||
multi_url: 'admin/multi',
|
||||
dragsort_url: 'admin/weigh',
|
||||
table: 'admin',
|
||||
}
|
||||
});
|
||||
@@ -79,20 +79,20 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
Config['upload_url'] = 'files/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
insert:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
Config['upload_url'] = 'files/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.getRole();
|
||||
},
|
||||
getRole:function(){
|
||||
Fast.api.ajax({
|
||||
url: "/app/admin/adminrole/select?format=select",
|
||||
url: "adminrole/select?format=select",
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
var html = "";
|
||||
|
||||
@@ -4,12 +4,12 @@ define(['table', 'form', 'yntree'], function (Table, Form, YnTree1) {
|
||||
index: function () {
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/adminrole/select',
|
||||
add_url: '/app/admin/adminrole/insert',
|
||||
edit_url: '/app/admin/adminrole/update',
|
||||
del_url: '/app/admin/adminrole/delete',
|
||||
multi_url: '/app/admin/adminrole/multi',
|
||||
dragsort_url: '/app/admin/adminrole/weigh',
|
||||
index_url: 'adminrole/select',
|
||||
add_url: 'adminrole/insert',
|
||||
edit_url: 'adminrole/update',
|
||||
del_url: 'adminrole/delete',
|
||||
multi_url: 'adminrole/multi',
|
||||
dragsort_url: 'adminrole/weigh',
|
||||
table: 'adminrole',
|
||||
}
|
||||
});
|
||||
@@ -136,7 +136,7 @@ define(['table', 'form', 'yntree'], function (Table, Form, YnTree1) {
|
||||
var pid = $(this).data("pid");
|
||||
var id = $('[name=id]').val();
|
||||
$.ajax({
|
||||
url: "/app/admin/adminrole/tree?",
|
||||
url: 'adminrole/tree?',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: { id: id, pid: $(this).val() },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
define(['table', 'upload','form','template','treegrid','bootstrap-table-treegrid'], function (Table,Upload,Form,Template) {
|
||||
define(['table', 'form','../libs/iconselect','treegrid','bootstrap-table-treegrid'], function (Table,Form,IconSelector) {
|
||||
var AdminRule = {
|
||||
//Do setup work hereAction
|
||||
index: function () {
|
||||
@@ -9,12 +9,12 @@ define(['table', 'upload','form','template','treegrid','bootstrap-table-treegrid
|
||||
var apiResults_type = ["目录","菜单","权限"];
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/AdminRule/select',
|
||||
add_url: '/app/admin/AdminRule/insert',
|
||||
edit_url: '/app/admin/AdminRule/update',
|
||||
del_url: '/app/admin/AdminRule/delete',
|
||||
multi_url: '/app/admin/AdminRule/multi',
|
||||
dragsort_url: '/app/admin/AdminRule/weigh',
|
||||
index_url: 'AdminRule/select',
|
||||
add_url: 'AdminRule/insert',
|
||||
edit_url: 'AdminRule/update',
|
||||
del_url: 'AdminRule/delete',
|
||||
multi_url: 'AdminRule/multi',
|
||||
dragsort_url: 'AdminRule/weigh',
|
||||
table: 'AdminRule',
|
||||
}
|
||||
});
|
||||
@@ -191,56 +191,10 @@ define(['table', 'upload','form','template','treegrid','bootstrap-table-treegrid
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
Config['upload_url'] = '/files/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
this.initIcoselect();
|
||||
},
|
||||
initIcoselect:function(){
|
||||
|
||||
var iconlist = [];
|
||||
var iconfunc = function () {
|
||||
Layer.open({
|
||||
type: 1,
|
||||
area: ['99%', '98%'], //宽高
|
||||
content: Template('chooseicontpl', {iconlist: iconlist})
|
||||
});
|
||||
};
|
||||
|
||||
$(document).on('change keyup', "#icon", function () {
|
||||
$(this).prev().find("i").prop("class", $(this).val());
|
||||
});
|
||||
$(document).on('click', ".btn-search-icon", function () {
|
||||
if (iconlist.length == 0) {
|
||||
$.get(Config.cdnurl + "/app/admin/css/materialdesignicons.min.css", function (ret) {
|
||||
window.iconret = ret;
|
||||
// var exp = /\.mdi-(.*):before/ig;
|
||||
// var result;
|
||||
// while ((result = exp.exec(ret)) != null) {
|
||||
// iconlist.push(result[1]);
|
||||
// }
|
||||
var list = Array.from(iconret.matchAll(/mdi-(.*?)::before/g));
|
||||
for (let index = 1; index < list.length; index++) {
|
||||
//const element = list[index];
|
||||
iconlist.push(list[index][1]);
|
||||
|
||||
}
|
||||
iconfunc();
|
||||
});
|
||||
} else {
|
||||
iconfunc();
|
||||
}
|
||||
});
|
||||
$(document).on('click', '#chooseicon ul li', function () {
|
||||
$("input#icon").val('mdi mdi-' + $(this).data("font")).trigger("change");
|
||||
Layer.closeAll();
|
||||
});
|
||||
$(document).on('keyup', 'input.js-icon-search', function () {
|
||||
$("#chooseicon ul li").show();
|
||||
if ($(this).val() != '') {
|
||||
$("#chooseicon ul li:not([data-font*='" + $(this).val() + "'])").hide();
|
||||
}
|
||||
});
|
||||
IconSelector.bind($(".btn-search-icon"),$("input#icon"));
|
||||
}
|
||||
};
|
||||
return AdminRule
|
||||
|
||||
@@ -6,12 +6,12 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/article/select',
|
||||
add_url: '/app/admin/article/insert',
|
||||
edit_url: '/app/admin/article/update',
|
||||
del_url: '/app/admin/article/delete',
|
||||
multi_url: '/app/admin/article/multi',
|
||||
dragsort_url: '/app/admin/article/weigh',
|
||||
index_url: 'article/select',
|
||||
add_url: 'article/insert',
|
||||
edit_url: 'article/update',
|
||||
del_url: 'article/delete',
|
||||
multi_url: 'article/multi',
|
||||
dragsort_url: 'article/weigh',
|
||||
table: 'archives',
|
||||
}
|
||||
});
|
||||
@@ -83,7 +83,7 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
this.bindevent();
|
||||
},
|
||||
bindevent:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/upload';
|
||||
Config['upload_url'] = 'files/upload';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/authaddress/select',
|
||||
add_url: '/app/admin/authaddress/insert',
|
||||
edit_url: '/app/admin/authaddress/update',
|
||||
del_url: '/app/admin/authaddress/delete',
|
||||
multi_url: '/app/admin/authaddress/multi',
|
||||
//dragsort_url: '/app/admin/authaddress/weigh',
|
||||
index_url: 'authaddress/select',
|
||||
add_url: 'authaddress/insert',
|
||||
edit_url: 'authaddress/update',
|
||||
del_url: 'authaddress/delete',
|
||||
multi_url: 'authaddress/multi',
|
||||
//dragsort_url: 'authaddress/weigh',
|
||||
table: 'auth_address',
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,9 +5,9 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
window.filterData['currency'] = {value1:"money",symbol:'=','value2':''};
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/balancelog/select',
|
||||
del_url: '/app/admin/balancelog/delete?currency=money',
|
||||
multi_url: '/app/admin/balancelog/multi',
|
||||
index_url: 'balancelog/select',
|
||||
del_url: 'balancelog/delete?currency=money',
|
||||
multi_url: 'balancelog/multi',
|
||||
table: 'balancelog',
|
||||
}
|
||||
});
|
||||
@@ -110,7 +110,7 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
var currency = $(this).data('currency');
|
||||
$('#filter_currency li').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$.fn.bootstrapTable.defaults.extend.del_url = '/app/admin/balancelog/delete?currency='+currency
|
||||
$.fn.bootstrapTable.defaults.extend.del_url = 'balancelog/delete?currency='+currency
|
||||
window.filterData['currency']['value1'] = currency;
|
||||
table.bootstrapTable('selectPage', 1);
|
||||
});
|
||||
|
||||
@@ -4,12 +4,12 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
index: function () {
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/card/select',
|
||||
add_url: '/app/admin/card/insert',
|
||||
edit_url: '/app/admin/card/update',
|
||||
del_url: '/app/admin/card/delete',
|
||||
multi_url: '/app/admin/card/multi',
|
||||
dragsort_url: '/app/admin/card/weigh',
|
||||
index_url: 'card/select',
|
||||
add_url: 'card/insert',
|
||||
edit_url: 'card/update',
|
||||
del_url: 'card/delete',
|
||||
multi_url: 'card/multi',
|
||||
dragsort_url: 'card/weigh',
|
||||
table: 'card',
|
||||
}
|
||||
});
|
||||
@@ -72,7 +72,7 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
formatter:Table.api.formatter.operate,
|
||||
table: table, events: Table.api.events.operate,
|
||||
// formatter: function(v,row,index){
|
||||
// return '<a href="/app/admin/card/export" class="btn btn-warning btn-xs">导出</a> '+Table.api.formatter.operate.call(this,v,row,index)
|
||||
// return '<a href="'+'card/export" class="btn btn-warning btn-xs">导出</a> '+Table.api.formatter.operate.call(this,v,row,index)
|
||||
// },
|
||||
buttons:[
|
||||
{
|
||||
@@ -80,14 +80,14 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
text: '详情',
|
||||
icon: 'fa fa-list',
|
||||
classname: 'btn btn-info btn-xs btn-dialog',
|
||||
url: '/app/admin/card/detail'
|
||||
url: 'card/detail'
|
||||
},
|
||||
{
|
||||
name: 'export',
|
||||
text: '导出',
|
||||
icon: 'fa fa-list',
|
||||
classname: 'btn btn-warning btn-xs',
|
||||
url: '/app/admin/card/export',
|
||||
url: 'card/export',
|
||||
extend:' target="_blank"'
|
||||
}
|
||||
]
|
||||
@@ -111,9 +111,9 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
detail: function () {
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/cdkey/select',
|
||||
del_url: '/app/admin/cdkey/delete',
|
||||
multi_url: '/app/admin/cdkey/multi',
|
||||
index_url: 'cdkey/select',
|
||||
del_url: 'cdkey/delete',
|
||||
multi_url: 'cdkey/multi',
|
||||
table: 'cdkey',
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,12 +5,12 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: '/app/admin/category/select',
|
||||
add_url: '/app/admin/category/insert',
|
||||
edit_url: '/app/admin/category/update',
|
||||
del_url: '/app/admin/category/delete',
|
||||
multi_url: '/app/admin/category/multi',
|
||||
dragsort_url: '/app/admin/category/weigh',
|
||||
index_url: 'category/select',
|
||||
add_url: 'category/insert',
|
||||
edit_url: 'category/update',
|
||||
del_url: 'category/delete',
|
||||
multi_url: 'category/multi',
|
||||
dragsort_url: 'category/weigh',
|
||||
table: 'category',
|
||||
}
|
||||
});
|
||||
@@ -73,12 +73,12 @@ define(['table', 'upload','form'], function (Table,Upload,Form) {
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
update:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
Config['upload_url'] = '/files/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
},
|
||||
insert:function(){
|
||||
Config['uploadurl'] = '/app/admin/attachment/avatar';
|
||||
Config['upload_url'] = '/files/avatar';
|
||||
var form = $('form');
|
||||
Form.api.bindevent(form)
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user