diff --git a/crmeb/.constant b/crmeb/.constant
index d33d24f9..6b646d01 100644
--- a/crmeb/.constant
+++ b/crmeb/.constant
@@ -1,3 +1,3 @@
+ Options +FollowSymlinks -Multiviews
+ RewriteEngine On
+
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
+
diff --git a/crmeb/.version b/crmeb/.version
index b199800a..feac29c0 100644
--- a/crmeb/.version
+++ b/crmeb/.version
@@ -1,2 +1,2 @@
-version=CRMEB-DT v3.1
-version_code=133
\ No newline at end of file
+version=CRMEB-DT v3.1.1
+version_code=134
\ No newline at end of file
diff --git a/crmeb/app/AppService.php b/crmeb/app/AppService.php
index c24796e3..dd75b7ae 100644
--- a/crmeb/app/AppService.php
+++ b/crmeb/app/AppService.php
@@ -2,6 +2,8 @@
namespace app;
+use crmeb\services\SystemConfigService;
+use crmeb\services\GroupDataService;
use crmeb\utils\Json;
use think\facade\Db;
use think\Service;
@@ -10,7 +12,9 @@ class AppService extends Service
{
public $bind = [
- 'json' => Json::class
+ 'json' => Json::class,
+ 'sysConfig' => SystemConfigService::class,
+ 'sysGroupData' => GroupDataService::class
];
public function boot()
diff --git a/crmeb/app/admin/config/view.php b/crmeb/app/admin/config/view.php
new file mode 100644
index 00000000..082a9a20
--- /dev/null
+++ b/crmeb/app/admin/config/view.php
@@ -0,0 +1,20 @@
+ 'php',
+ // 模板路径
+ 'view_path' => app_path('view'),
+ // 视图输出字符串内容替换
+ 'tpl_replace_string' => [
+ '{__PUBLIC_PATH}' => '/', //public 目录
+ '{__STATIC_PATH}' => '/static/', //全局静态目录
+ '{__PLUG_PATH}' => '/static/plug/', //全局静态插件
+ '{__ADMIN_PATH}' => '/system/', //后台目录
+ '{__FRAME_PATH}' => '/system/frame/', //后台框架
+ '{__MODULE_PATH}' => '/system/module/', //后台模块
+ ]
+];
diff --git a/crmeb/app/admin/controller/AuthController.php b/crmeb/app/admin/controller/AuthController.php
index b3bb7e7e..88cf4fa1 100644
--- a/crmeb/app/admin/controller/AuthController.php
+++ b/crmeb/app/admin/controller/AuthController.php
@@ -37,11 +37,11 @@ class AuthController extends SystemBasic
protected function initialize()
{
parent::initialize();
- if(!SystemAdmin::hasActiveAdmin()) return $this->redirect('Login/index');
+ if(!SystemAdmin::hasActiveAdmin()) return $this->redirect(Url::buildUrl('login/index')->suffix(false)->build());
try{
$adminInfo = SystemAdmin::activeAdminInfoOrFail();
}catch (\Exception $e){
- return $this->failed(SystemAdmin::getErrorInfo($e->getMessage()),Url::buildUrl('Login/index'));
+ return $this->failed(SystemAdmin::getErrorInfo($e->getMessage()),Url::buildUrl('login/index')->suffix(false)->build());
}
$this->adminInfo = $adminInfo;
$this->adminId = $adminInfo['id'];
@@ -58,7 +58,7 @@ class AuthController extends SystemBasic
{
static $allAuth = null;
if($allAuth === null) $allAuth = SystemRole::getAllAuth();
- if($module === null) $module = $this->request->app();
+ if($module === null) $module = app('http')->getName();
if($controller === null) $controller = $this->request->controller();
if($action === null) $action = $this->request->action();
if(!count($route)) $route = $this->request->route();
diff --git a/crmeb/app/admin/controller/Index.php b/crmeb/app/admin/controller/Index.php
index 8fa51f10..5ca306d7 100644
--- a/crmeb/app/admin/controller/Index.php
+++ b/crmeb/app/admin/controller/Index.php
@@ -12,9 +12,9 @@ use app\admin\model\user\UserExtract as UserExtractModel;//分销
use app\admin\model\user\User as UserModel;//用户
use app\admin\model\store\StoreProductReply as StoreProductReplyModel;//评论
use app\admin\model\store\StoreProduct as ProductModel;//产品
-use app\models\store\StoreOrder;
-use crmeb\services\SystemConfigService;
+use crmeb\utils\Template;
use FormBuilder\Json;
+use think\facade\Route;
/**
* 首页控制器
@@ -33,12 +33,29 @@ class Index extends AuthController
$this->assign([
'menuList'=>SystemMenus::menuList(),
'site_logo'=>json_decode($site_logo['value'],true),
- 'new_order_audio_link'=>SystemConfigService::get('new_order_audio_link'),
+ 'new_order_audio_link'=>sysConfig('new_order_audio_link'),
'role_name'=>SystemRole::where('id',$roles[0])->field('role_name')->find()
]);
return $this->fetch();
}
- //后台首页内容
+
+ public function test()
+ {
+ $res = Template::instance()->wechat()
+ ->setTemplateCode('OPENTM207791277')
+ ->setTemplateData([
+ 'first'=>'亲,您购买的商品已支付成功',
+ 'keyword1'=>'wx12545454545',
+ 'keyword2'=>'0.99',
+ 'remark'=>'点击查看订单详情'
+ ])
+ ->setTemplateOpenId('od9iXwj58C4aLy11ABMxFkgJelt0')
+ ->setTemplateUrl(Route::buildUrl('order/detail/wx12545454545'))
+ ->send();
+ var_dump($res);
+ }
+
+ //后台首页内容
public function main()
{
/*首页第一行统计*/
diff --git a/crmeb/app/admin/controller/Login.php b/crmeb/app/admin/controller/Login.php
index 9b725570..e3619801 100644
--- a/crmeb/app/admin/controller/Login.php
+++ b/crmeb/app/admin/controller/Login.php
@@ -39,11 +39,13 @@ class Login extends SystemBasic
$res = SystemAdmin::login($account,$pwd);
if($res){
Session::set('login_error',null);
- return $this->redirect(Url::buildUrl('Index/index'));
+ Session::save();
+ return $this->successful(['url'=>Url::buildUrl('Index/index')->build()]);
}else{
$error['num'] += 1;
$error['time'] = time();
Session::set('login_error',$error);
+ Session::save();
return $this->failed(SystemAdmin::getErrorInfo('用户名错误,请重新输入'));
}
}
@@ -60,6 +62,6 @@ class Login extends SystemBasic
public function logout()
{
SystemAdmin::clearLoginInfo();
- $this->redirect('Login/index');
+ $this->redirect(Url::buildUrl('index')->build());
}
}
\ No newline at end of file
diff --git a/crmeb/app/admin/controller/agent/AgentManage.php b/crmeb/app/admin/controller/agent/AgentManage.php
index 53d4de20..25515b23 100644
--- a/crmeb/app/admin/controller/agent/AgentManage.php
+++ b/crmeb/app/admin/controller/agent/AgentManage.php
@@ -27,7 +27,7 @@ class AgentManage extends AuthController
public function index()
{
$this->assign( 'year',getMonth());
- $this->assign('store_brokerage_statu',\crmeb\services\SystemConfigService::get('store_brokerage_statu'));
+ $this->assign('store_brokerage_statu',sysConfig('store_brokerage_statu'));
return $this->fetch();
}
public function get_spread_list()
@@ -276,10 +276,7 @@ class AgentManage extends AuthController
public function empty_spread($uid=0)
{
if(!$uid) return JsonService::fail('缺少参数');
- $res=true;
- $spread_uid = User::where('spread_uid',$uid)->column('uid','uid');
- if(count($spread_uid)) $res = $res && false !== User::where('spread_uid','in',$spread_uid)->update(['spread_uid'=>0]);
- $res = $res && false !== User::where('spread_uid',$uid)->update(['spread_uid'=>0]);
+ $res = User::where('uid',$uid)->update(['spread_uid'=>0]);
if($res)
return JsonService::successful('清除成功');
else
diff --git a/crmeb/app/admin/controller/article/WechatNews.php b/crmeb/app/admin/controller/article/WechatNews.php
index 76bc0376..16466d92 100644
--- a/crmeb/app/admin/controller/article/WechatNews.php
+++ b/crmeb/app/admin/controller/article/WechatNews.php
@@ -54,7 +54,7 @@ class WechatNews extends AuthController
$news['url'] = '';
$news['cid'] = array();
if($id){
- $news = \app\admin\model\wechat\WechatNews::where('n.id',$id)->alias('n')->field('n.*,c.content')->join('__WECHAT_NEWS_CONTENT__ c','c.nid=n.id')->find();
+ $news = \app\admin\model\wechat\WechatNews::where('n.id',$id)->alias('n')->field('n.*,c.content')->join('wechat_news_content c','c.nid=n.id')->find();
if(!$news) return $this->failedNotice('数据不存在!');
$news['cid'] = explode(',',$news['cid']);
// dump($news);
diff --git a/crmeb/app/admin/controller/finance/UserRecharge.php b/crmeb/app/admin/controller/finance/UserRecharge.php
index 50b27ca1..64b7be1f 100644
--- a/crmeb/app/admin/controller/finance/UserRecharge.php
+++ b/crmeb/app/admin/controller/finance/UserRecharge.php
@@ -124,7 +124,7 @@ SCRIPT;
'keyword2'=>$UserRecharge['price'],
'keyword3'=>date('Y-m-d H:i:s',$UserRecharge['add_time']),
'remark'=>'点击查看订单详情'
- ],Url::buildUrl('wap/My/balance','',true,true));
+ ],Url::buildUrl('/user/bill/2')->suffix(false)->build());
break;
case 'routine':
RoutineTemplate::sendOut('ORDER_REFUND_SUCCESS',$UserRecharge['uid'],[
diff --git a/crmeb/app/admin/controller/order/StoreOrder.php b/crmeb/app/admin/controller/order/StoreOrder.php
index 9ce1da97..32d5d934 100644
--- a/crmeb/app/admin/controller/order/StoreOrder.php
+++ b/crmeb/app/admin/controller/order/StoreOrder.php
@@ -109,6 +109,10 @@ class StoreOrder extends AuthController
}
$orderInfo->status = 2;
if($orderInfo->save()) {
+ OrderRepository::storeProductOrderTakeDeliveryAdmin($orderInfo);
+ StoreOrderStatus::setStatus($orderInfo->id,'take_delivery','已核销');
+ //发送短信
+ event('ShortMssageSend',[$orderInfo['order_id'],'Receiving']);
StoreOrderModel::commitTrans();
return JsonService::successful('核销成功!');
}else {
@@ -475,7 +479,7 @@ class StoreOrder extends AuthController
$refund_data['pay_price'] = $product['pay_price'];
$refund_data['refund_price'] = $refund_price;
if($product['pay_type'] == 'weixin'){
- if($product['is_channel']){//小程序
+ if($product['is_channel'] == 1){//小程序
try{
MiniProgramService::payOrderRefund($product['order_id'],$refund_data);//2.5.36
}catch(\Exception $e){
@@ -717,6 +721,9 @@ class StoreOrder extends AuthController
$res = $res1 && $res2;
BaseModel::checkTrans($res);
if(!$res) return Json::fail('退积分失败!');
+ if($product['pay_price'] == 0 && $bj == 0){
+ $data['refund_status'] = 2;
+ }
StoreOrderModel::edit($data,$id);
StoreOrderStatus::setStatus($id,'integral_back','商品退积分:'.$data['back_integral']);
return Json::successful('退积分成功!');
diff --git a/crmeb/app/admin/controller/order/combinationOrder.php b/crmeb/app/admin/controller/order/combinationOrder.php
index efa720a2..2726852e 100644
--- a/crmeb/app/admin/controller/order/combinationOrder.php
+++ b/crmeb/app/admin/controller/order/combinationOrder.php
@@ -327,7 +327,7 @@ class CombinationOrder extends AuthController
$refund_data['pay_price'] = $product['pay_price'];
$refund_data['refund_price'] = $refund_price;
if($product['pay_type'] == 'weixin'){
- if($product['is_channel']){//TODO 小程序
+ if($product['is_channel'] == 1){//TODO 小程序
try{
MiniProgramService::payOrderRefund($product['order_id'],$refund_data);//2.5.36
}catch(\Exception $e){
diff --git a/crmeb/app/admin/controller/setting/SystemAdmin.php b/crmeb/app/admin/controller/setting/SystemAdmin.php
index b1517ac9..3db53e96 100644
--- a/crmeb/app/admin/controller/setting/SystemAdmin.php
+++ b/crmeb/app/admin/controller/setting/SystemAdmin.php
@@ -176,7 +176,7 @@ class SystemAdmin extends AuthController
* 个人资料 展示
* @return string
*/
- public function adminInfo(){
+ public function admin_info(){
$adminInfo = $this->adminInfo;//获取当前登录的管理员
$this->assign('adminInfo',$adminInfo);
return $this->fetch();
diff --git a/crmeb/app/admin/controller/setting/SystemConfig.php b/crmeb/app/admin/controller/setting/SystemConfig.php
index dd6f24da..d8aa5444 100644
--- a/crmeb/app/admin/controller/setting/SystemConfig.php
+++ b/crmeb/app/admin/controller/setting/SystemConfig.php
@@ -1,6 +1,8 @@
$v){
ConfigModel::edit(['value' => json_encode($v)],$k,'menu_name');
}
+ CacheService::delete(SystemConfigService::CACHE_SYSTEM);
return $this->successful('修改成功');
}
}
diff --git a/crmeb/app/admin/controller/setting/SystemConfigTab.php b/crmeb/app/admin/controller/setting/SystemConfigTab.php
index fdf6873e..4714627c 100644
--- a/crmeb/app/admin/controller/setting/SystemConfigTab.php
+++ b/crmeb/app/admin/controller/setting/SystemConfigTab.php
@@ -42,7 +42,7 @@ class SystemConfigTab extends AuthController
$tab_id = input('tab_id');
if(!$tab_id) return Json::fail('参数错误');
$this->assign('tab_id',$tab_id);
- $list = ConfigModel::getAll($tab_id);
+ $list = ConfigModel::getAll($tab_id,2);
foreach ($list as $k=>$v){
$list[$k]['value'] = json_decode($v['value'],true)?:'';
if($v['type'] == 'radio' || $v['type'] == 'checkbox'){
diff --git a/crmeb/app/admin/controller/setting/SystemGroupData.php b/crmeb/app/admin/controller/setting/SystemGroupData.php
index 5ee511dd..413168fe 100644
--- a/crmeb/app/admin/controller/setting/SystemGroupData.php
+++ b/crmeb/app/admin/controller/setting/SystemGroupData.php
@@ -2,6 +2,7 @@
namespace app\admin\controller\setting;
+use crmeb\services\CacheService;
use crmeb\services\FormBuilder as Form;
use crmeb\services\JsonService as Json;
use crmeb\services\UploadService as Upload;
@@ -122,6 +123,7 @@ class SystemGroupData extends AuthController
$data = array("gid"=>$gid,"add_time"=>time(),"value"=>json_encode($value),"sort"=>$params["sort"],"status"=>$params["status"]);
GroupDataModel::create($data);
+ CacheService::clear();
return Json::successful('添加数据成功!');
}
@@ -231,6 +233,7 @@ class SystemGroupData extends AuthController
}
$data = array("value"=>json_encode($value),"sort"=>$params["sort"],"status"=>$params["status"]);
GroupDataModel::edit($data,$id);
+ CacheService::clear();
return Json::successful('修改成功!');
}
@@ -244,8 +247,10 @@ class SystemGroupData extends AuthController
{
if(!GroupDataModel::del($id))
return Json::fail(GroupDataModel::getErrorInfo('删除失败,请稍候再试!'));
- else
+ else {
+ CacheService::clear();
return Json::successful('删除成功!');
+ }
}
public function upload()
diff --git a/crmeb/app/admin/controller/sms/SmsAdmin.php b/crmeb/app/admin/controller/sms/SmsAdmin.php
index 4cd178e6..2ab940d8 100644
--- a/crmeb/app/admin/controller/sms/SmsAdmin.php
+++ b/crmeb/app/admin/controller/sms/SmsAdmin.php
@@ -26,14 +26,14 @@ class SmsAdmin extends AuthController
public function captcha()
{
- if (!request()->isPost()) return JsonService::fail('发生失败');
+ if (!request()->isPost()) return JsonService::fail('发送失败');
$phone = request()->param('phone');
if (!trim($phone)) return JsonService::fail('请填写手机号');
$res = json_decode(HttpService::getRequest(SMSService::code(), compact('phone')), true);
if (!isset($res['status']) && $res['status'] !== 200)
return JsonService::fail(isset($res['data']['message']) ? $res['data']['message'] : $res['msg']);
- return JsonService::success(isset($res['data']['message']) ? $res['data']['message'] : $res['msg']);
+ return JsonService::success(isset($res['data']['message']) ? $res['data']['message'] : '发送成功');
}
/**
diff --git a/crmeb/app/admin/controller/sms/SmsTemplateApply.php b/crmeb/app/admin/controller/sms/SmsTemplateApply.php
index 97caf7ff..c331e47a 100644
--- a/crmeb/app/admin/controller/sms/SmsTemplateApply.php
+++ b/crmeb/app/admin/controller/sms/SmsTemplateApply.php
@@ -53,6 +53,7 @@ class SmsTemplateApply extends AuthController
{
$field = [
FormBuilder::input('title','模板名称'),
+ FormBuilder::textarea('text','模板内容示例','【您的短信签名】您的验证码是:{$code},有效期为{$time}分钟。如非本人操作,可不用理会。模板中的{$code}和{$time}需要替换成对应的变量,请开发者知晓。修改此项无效!'),
FormBuilder::input('content','模板内容')->type('textarea'),
FormBuilder::radio('type','模板类型',1)->options([['label'=>'验证码','value'=>1],['label'=>'通知','value'=>2],['label'=>'推广','value'=>3]])
];
diff --git a/crmeb/app/admin/controller/store/CopyTaobao.php b/crmeb/app/admin/controller/store/CopyTaobao.php
index e14b392c..996dbbae 100644
--- a/crmeb/app/admin/controller/store/CopyTaobao.php
+++ b/crmeb/app/admin/controller/store/CopyTaobao.php
@@ -30,18 +30,6 @@ class CopyTaobao extends AuthController
use CurdControllerTrait;
- //cookie 采集前请配置自己的 cookie,获取方式浏览器登录平台,F12或查看元素 network->headers 查看Request Headers 复制cookie 到下面变量中
- protected $webcookie = [
- //淘宝
- 'taobao' =>'cookie: miid=8289590761042824660; thw=cn; cna=bpdDExs9KGgCAXuLszWnEXxS; hng=CN%7Czh-CN%7CCNY%7C156; tracknick=taobaorongyao; _cc_=WqG3DMC9EA%3D%3D; tg=0; enc=WQPStocTopRI3wEBOPpj8VUDkqSw4Ph81ASG9053SgG8xBMzaOuq6yMe8KD4xPBlNfQST7%2Ffsk9M9GDtGmn6iQ%3D%3D; t=4bab065740d964a05ad111f5057078d4; cookie2=1965ea371faf24b163093f31af4120c2; _tb_token_=5d3380e119d6e; v=0; mt=ci%3D-1_1; _m_h5_tk=61bf01c61d46a64c98209a7e50e9e1df_1572349453522; _m_h5_tk_enc=9d9adfcbd7af7e2274c9b331dc9bae9b; l=dBgc_jG4vxuski7DBOCgCuI8aj7TIIRAguPRwN0viOCKUxT9CgCDAJt5v8PWVNKO7t1nNetzvui3udLHRntW6KTK6MK9zd9snxf..; isg=BJWVXJ3FZGyiWUENfGCuywlwpJePOkncAk8hmRc6WoxbbrVg3-Jadf0uODL97mFc',
- //阿里巴巴 1688
- 'alibaba' =>'',
- //天猫 可以和淘宝一样
- 'tmall' =>'cookie: miid=8289590761042824660; thw=cn; cna=bpdDExs9KGgCAXuLszWnEXxS; hng=CN%7Czh-CN%7CCNY%7C156; tracknick=taobaorongyao; _cc_=WqG3DMC9EA%3D%3D; tg=0; enc=WQPStocTopRI3wEBOPpj8VUDkqSw4Ph81ASG9053SgG8xBMzaOuq6yMe8KD4xPBlNfQST7%2Ffsk9M9GDtGmn6iQ%3D%3D; t=4bab065740d964a05ad111f5057078d4; cookie2=1965ea371faf24b163093f31af4120c2; _tb_token_=5d3380e119d6e; v=0; mt=ci%3D-1_1; _m_h5_tk=61bf01c61d46a64c98209a7e50e9e1df_1572349453522; _m_h5_tk_enc=9d9adfcbd7af7e2274c9b331dc9bae9b; l=dBgc_jG4vxuski7DBOCgCuI8aj7TIIRAguPRwN0viOCKUxT9CgCDAJt5v8PWVNKO7t1nNetzvui3udLHRntW6KTK6MK9zd9snxf..; isg=BJWVXJ3FZGyiWUENfGCuywlwpJePOkncAk8hmRc6WoxbbrVg3-Jadf0uODL97mFc',
- //京东 可不用配置
- 'jd' =>''
- ];
-
protected $bindModel = ProductModel::class;
//错误信息
protected $errorInfo = true;
@@ -75,8 +63,6 @@ class CopyTaobao extends AuthController
//远程下载附件图片分类名称
protected $AttachmentCategoryName = '远程下载';
- //请求平台名称 taobao alibaba tmall jd
- protected $webnname = 'taobao';
/**
* 显示资源
* @return html
@@ -127,7 +113,6 @@ class CopyTaobao extends AuthController
$url = $this->checkurl($link);
if ($url === false) return JsonService::fail($this->errorInfo);
$this->errorInfo = true;
- $url .= '&ra='.rand(2222222,9999999);
$html = $this->curl_Get($url, 60);
if (!$html) return JsonService::fail('商品HTML信息获取失败');
$html = $this->Utf8String($html);
@@ -167,7 +152,6 @@ class CopyTaobao extends AuthController
* */
public function setProductInfoTaobao($html)
{
- $this->webnname = 'taobao';
//获取轮播图
$images = $this->getTaobaoImg($html);
$images = array_merge($images);
@@ -176,7 +160,7 @@ class CopyTaobao extends AuthController
//获取产品详情请求链接
$link = $this->getTaobaoDesc($html);
//获取请求内容
- $desc_json = $this->curl_Get($link,60);
+ $desc_json = HttpService::getRequest($link);
//转换字符集
$desc_json = $this->Utf8String($desc_json);
//截取掉多余字符
@@ -197,7 +181,6 @@ class CopyTaobao extends AuthController
* */
public function setProductInfoTmall($html)
{
- $this->webnname = 'tmall';
//获取轮播图
$images = $this->getTianMaoImg($html);
$images = array_merge($images);
@@ -207,8 +190,7 @@ class CopyTaobao extends AuthController
//获取产品详情请求链接
$link = $this->getTianMaoDesc($html);
//获取请求内容
- $desc_json = $this->curl_Get($link,60);
-// $desc_json = HttpService::getRequest($link);
+ $desc_json = HttpService::getRequest($link);
//转换字符集
$desc_json = $this->Utf8String($desc_json);
//截取掉多余字符
@@ -227,7 +209,6 @@ class CopyTaobao extends AuthController
* */
public function setProductInfo1688($html)
{
- $this->webnname = 'alibaba';
//获取轮播图
$images = $this->get1688Img($html);
if (isset($images['gaoqing'])) {
@@ -240,8 +221,7 @@ class CopyTaobao extends AuthController
//获取产品详情请求链接
$link = $this->get1688Desc($html);
//获取请求内容
- $desc_json = $this->curl_Get($link,60);
-// $desc_json = HttpService::getRequest($link);
+ $desc_json = HttpService::getRequest($link);
//转换字符集
$desc_json = $this->Utf8String($desc_json);
$this->productInfo['test'] = $desc_json;
@@ -263,7 +243,6 @@ class CopyTaobao extends AuthController
* */
public function setProductInfoJd($html)
{
- $this->webnname = 'jd';
//获取产品详情请求链接
$desc_url = $this->getJdDesc($html);
//获取请求内容
@@ -358,7 +337,8 @@ class CopyTaobao extends AuthController
if (!$AttachmentCategory) $AttachmentCategory = SystemAttachmentCategory::create(['pid' => '0', 'name' => $this->AttachmentCategoryName, 'enname' => '']);
//生成附件目录
try{
- if (make_path('attach', 3) == '') return JsonService::fail('无法创建文件夹,请检查您的上传目录权限:' . app()->getRootPath() . 'public' . DS . 'uploads' . DS. 'attach' . DS);
+ if (make_path('attach', 3,true) === '')
+ return JsonService::fail('无法创建文件夹,请检查您的上传目录权限:' . app()->getRootPath() . 'public' . DS . 'uploads' . DS. 'attach' . DS);
}catch (\Exception $e){
return JsonService::fail($e->getMessage().'或无法创建文件夹,请检查您的上传目录权限:' . app()->getRootPath() . 'public' . DS . 'uploads' . DS. 'attach' . DS);
@@ -701,10 +681,18 @@ class CopyTaobao extends AuthController
//获取淘宝商品描述
public function getTaobaoDesc($html = '')
{
- preg_match("/dscnew.taobao.com.+?'/i", $html, $descarr);
- $url = substr($descarr[0],0,-1);
+ preg_match('/descUrl([^<>]*)counterApi/', $html, $descarr);
+ if (!isset($descarr[1])) return '';
+ $arr = explode(':', $descarr[1]);
+ $url = [];
+ foreach ($arr as $k => $v) {
+ if (strpos($v, '//')) {
+ $str = str_replace(['\'', ',', ' ', '?', ':'], '', $v);
+ $url[] = trim($str);
+ }
+ }
if ($url) {
- return 'https://'.$url;
+ return strpos($url[0], 'http') ? $url[0] : 'http:' . $url[0];
} else {
return '';
}
@@ -718,19 +706,13 @@ class CopyTaobao extends AuthController
{
if (!$url) return '';
$ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
if (stripos($url, "https://") !== FALSE) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在
}
- $headers = ['user-agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36'];
- if($this->webnname){
- $headers[] = $this->webcookie["$this->webnname"];
- }
-
curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('user-agent:' . $_SERVER['HTTP_USER_AGENT']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt ($ch, CURLOPT_REFERER, "www.crmeb.com");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $time_out);
$response = curl_exec($ch);
diff --git a/crmeb/app/admin/controller/store/StoreProduct.php b/crmeb/app/admin/controller/store/StoreProduct.php
index 90b5c032..bc4ba4fc 100644
--- a/crmeb/app/admin/controller/store/StoreProduct.php
+++ b/crmeb/app/admin/controller/store/StoreProduct.php
@@ -52,7 +52,9 @@ class StoreProduct extends AuthController
//已经售馨产品
$outofstock = ProductModel::getModelObject()->where(ProductModel::setData(4))->count();
//警戒库存
- $policeforce =ProductModel::getModelObject()->where(ProductModel::setData(5))->count();
+ $store_stock = sysConfig('store_stock');
+ if($store_stock < 0) $store_stock = 2;
+ $policeforce =ProductModel::getModelObject()->where(ProductModel::setData(5))->where('p.stock','<=',$store_stock)->count();
//回收站
$recycle = ProductModel::where('is_del',1)->count();
if($type == null) $type = 1;
diff --git a/crmeb/app/admin/controller/system/SystemAttachment.php b/crmeb/app/admin/controller/system/SystemAttachment.php
index 141e1b7c..1f3d0df3 100644
--- a/crmeb/app/admin/controller/system/SystemAttachment.php
+++ b/crmeb/app/admin/controller/system/SystemAttachment.php
@@ -30,7 +30,7 @@ class SystemAttachment extends AuthController
$info["size"] = $res['size'];
$info["type"] = $res['type'];
$info["state"] = "SUCCESS";
- if($res['image_type'] == 1) $info['url'] = SystemConfigService::get('site_url').str_replace('\\','/',$res['dir']);
+ if($res['image_type'] == 1) $info['url'] = sysConfig('site_url').str_replace('\\','/',$res['dir']);
}else
$info = array(
"msg" => $res,
diff --git a/crmeb/app/admin/controller/system/SystemCleardata.php b/crmeb/app/admin/controller/system/SystemCleardata.php
index 8785c9c9..2833531d 100644
--- a/crmeb/app/admin/controller/system/SystemCleardata.php
+++ b/crmeb/app/admin/controller/system/SystemCleardata.php
@@ -10,6 +10,7 @@ namespace app\admin\controller\system;
use app\admin\controller\AuthController;
+use app\admin\model\store\StoreProduct;
use crmeb\services\JsonService as Json;
use think\facade\Db;
@@ -131,6 +132,24 @@ class SystemclearData extends AuthController
self::clearData('system_log',1);
return Json::successful('清除数据成功!');
}
+
+ /**
+ * 清除数据
+ * @param int $type
+ * @throws \Exception
+ */
+ public function undata($type = 1)
+ {
+ switch ((int)$type){
+ case 1:
+ \app\admin\model\system\SystemAttachment::where('module_type',2)->delete();
+ break;
+ case 2:
+ StoreProduct::where('is_del',1)->delete();
+ break;
+ }
+ return Json::successful('清除数据成功!');
+ }
//清除制定表数据
public function clearData($table_name,$status){
$table_name = config('database.connections.' . config('database.default'))['prefix'].$table_name;
diff --git a/crmeb/app/admin/controller/system/SystemFile.php b/crmeb/app/admin/controller/system/SystemFile.php
index 90e8634b..be502d8f 100644
--- a/crmeb/app/admin/controller/system/SystemFile.php
+++ b/crmeb/app/admin/controller/system/SystemFile.php
@@ -106,12 +106,11 @@ class SystemFile extends AuthController
public function index()
{
- $app = $this->getDir('./application');
- $extend = $this->getDir('./extend');
- $public = $this->getDir('./public');
+ $rootPath = app()->getRootPath();
+ $app = $this->getDir($rootPath.'app');
+ $extend = $this->getDir($rootPath.'crmeb');
$arr = array();
$arr = array_merge($app, $extend);
- $arr = array_merge($arr, $public);
$fileAll = array();//本地文件
$cha = array();//不同的文件
foreach ($arr as $k => $v) {
@@ -122,7 +121,7 @@ class SystemFile extends AuthController
$cthash = md5($ct);
$update_time = stat($v);
$fileAll[$k]['cthash'] = $cthash;
- $fileAll[$k]['filename'] = $v;
+ $fileAll[$k]['filename'] = str_replace($rootPath,'',$v);
$fileAll[$k]['atime'] = $update_time['atime'];
$fileAll[$k]['mtime'] = $update_time['mtime'];
$fileAll[$k]['ctime'] = $update_time['ctime'];
@@ -149,7 +148,7 @@ class SystemFile extends AuthController
foreach ($fileAll as $ko => $vo) {
if ($v['filename'] == $vo['filename']) {
if ($v['cthash'] != $vo['cthash']) {
- $cha[$k]['filename'] = $v['filename'];
+ $cha[$k]['filename'] = str_replace($rootPath,'',$v['filename']);
$cha[$k]['cthash'] = $v['cthash'];
$cha[$k]['atime'] = $v['atime'];
$cha[$k]['mtime'] = $v['mtime'];
@@ -163,7 +162,7 @@ class SystemFile extends AuthController
}
foreach ($file as $k => $v) {
- $cha[$k]['filename'] = $v['filename'];
+ $cha[$k]['filename'] = str_replace($rootPath,'',$v['filename']);
$cha[$k]['cthash'] = $v['cthash'];
$cha[$k]['atime'] = $v['atime'];
$cha[$k]['mtime'] = $v['mtime'];
@@ -171,7 +170,7 @@ class SystemFile extends AuthController
$cha[$k]['type'] = '已删除';
}
foreach ($fileAll as $k => $v) {
- $cha[$k]['filename'] = $v['filename'];
+ $cha[$k]['filename'] = str_replace($rootPath,'',$v['filename']);
$cha[$k]['cthash'] = $v['cthash'];
$cha[$k]['atime'] = $v['atime'];
$cha[$k]['mtime'] = $v['mtime'];
diff --git a/crmeb/app/admin/controller/system/SystemStore.php b/crmeb/app/admin/controller/system/SystemStore.php
index 2d383e3c..ad79a4a2 100644
--- a/crmeb/app/admin/controller/system/SystemStore.php
+++ b/crmeb/app/admin/controller/system/SystemStore.php
@@ -33,7 +33,7 @@ class SystemStore extends AuthController
* */
public function select_address()
{
- $key = SystemConfigService::get('tengxun_map_key');
+ $key = sysConfig('tengxun_map_key');
if(!$key) return $this->failed('请前往设置->系统设置->物流配置 配置腾讯地图KEY','#');
$this->assign(compact('key'));
return $this->fetch();
@@ -59,7 +59,7 @@ class SystemStore extends AuthController
SystemStoreModel::beginTrans();
try{
$data['address'] = implode(',',$data['address']);
- $data['latlng'] = explode(',',$data['latlng']);
+ $data['latlng'] = is_string($data['latlng']) ? explode(',',$data['latlng']) : $data['latlng'];
if(!isset($data['latlng'][0]) || !isset($data['latlng'][1])) return JsonService::fail('请选择门店位置');
$data['latitude'] = $data['latlng'][0];
$data['longitude'] = $data['latlng'][1];
diff --git a/crmeb/app/admin/controller/user/UserLevel.php b/crmeb/app/admin/controller/user/UserLevel.php
index e825b515..af051e45 100644
--- a/crmeb/app/admin/controller/user/UserLevel.php
+++ b/crmeb/app/admin/controller/user/UserLevel.php
@@ -36,8 +36,8 @@ class UserLevel extends AuthController
if($id) $vipinfo=SystemUserLevel::get($id);
$field[]= Form::input('name','等级名称',isset($vipinfo) ? $vipinfo->name : '')->col(Form::col(24));
$field[]= Form::radio('is_forever','是否为永久',isset($vipinfo) ? $vipinfo->is_forever : 0)->options([['label'=>'永久','value'=>1],['label'=>'非永久','value'=>0]])->col(24);
- $field[]= Form::number('money','等级价格',isset($vipinfo) ? $vipinfo->money : 0)->min(0)->col(24);
- $field[]= Form::radio('is_pay','是否需要购买',isset($vipinfo) ? $vipinfo->is_pay : 0)->options([['label'=>'需要','value'=>1],['label'=>'免费','value'=>0]])->col(24);
+ //$field[]= Form::number('money','等级价格',isset($vipinfo) ? $vipinfo->money : 0)->min(0)->col(24);
+ //$field[]= Form::radio('is_pay','是否需要购买',isset($vipinfo) ? $vipinfo->is_pay : 0)->options([['label'=>'需要','value'=>1],['label'=>'免费','value'=>0]])->col(24);
$field[]= Form::number('valid_date','有效时间(天)',isset($vipinfo) ? $vipinfo->valid_date : 0)->min(0)->col(8);
$field[]= Form::number('grade','等级',isset($vipinfo) ? $vipinfo->grade : 0)->min(0)->col(8);
$field[]= Form::number('discount','享受折扣',isset($vipinfo) ? $vipinfo->discount : 0)->min(0)->col(8);
diff --git a/crmeb/app/admin/controller/wechat/WechatUser.php b/crmeb/app/admin/controller/wechat/WechatUser.php
index 44f24d2f..6045bf58 100644
--- a/crmeb/app/admin/controller/wechat/WechatUser.php
+++ b/crmeb/app/admin/controller/wechat/WechatUser.php
@@ -159,7 +159,7 @@ class WechatUser extends AuthController
$list=[];
if($refresh == 1) {
UserModel::clearUserTag();
- $this->redirect(Url::buildUrl('tag'));
+ $this->redirect(Url::buildUrl('tag')->suffix(false)->build());
}
try{
$list = UserModel::getUserTag();
@@ -252,7 +252,7 @@ class WechatUser extends AuthController
try{
if($refresh == 1) {
UserModel::clearUserGroup();
- $this->redirect(Url::buildUrl('group'));
+ $this->redirect(Url::buildUrl('group')->suffix(false)->build());
}
$list = UserModel::getUserGroup();
}catch (\Exception $e){}
diff --git a/crmeb/app/admin/controller/widget/Images.php b/crmeb/app/admin/controller/widget/Images.php
index 9eef8b3a..645951f6 100644
--- a/crmeb/app/admin/controller/widget/Images.php
+++ b/crmeb/app/admin/controller/widget/Images.php
@@ -70,7 +70,7 @@ class Images extends AuthController
$pid = input('pid')!= NULL ?input('pid'):session('pid');
$upload_type = $this->request->get('upload_type',0);
try{
- $path = make_path('attach');
+ $path = make_path('attach',2,true);
$res = Upload::getInstance()->setUploadPath($path)->setAutoValidate(true)
->setUploadType($upload_type)->image('file');
if(is_object($res) && $res->status === false){
diff --git a/crmeb/app/admin/model/article/Article.php b/crmeb/app/admin/model/article/Article.php
index 44366310..90355aa1 100644
--- a/crmeb/app/admin/model/article/Article.php
+++ b/crmeb/app/admin/model/article/Article.php
@@ -52,7 +52,7 @@ class Article extends BaseModel {
$model = $model->where('mer_id','>',0);
else
$model = $model->where('mer_id',0);
- $model = $model->where('status',1)->where('hide',0);
+ $model = $model->where('status',1)->where('hide',0)->order('id desc');
return self::page($model,function($item){
if(!$item['mer_id']) $item['admin_name'] = '总后台管理员---》'.SystemAdmin::where('id',$item['admin_id'])->value('real_name');
else $item['admin_name'] = Merchant::where('id',$item['mer_id'])->value('mer_name').'---》'.MerchantAdmin::where('id',$item['admin_id'])->value('real_name');
diff --git a/crmeb/app/admin/model/finance/FinanceModel.php b/crmeb/app/admin/model/finance/FinanceModel.php
index 548a5e58..bc39b133 100644
--- a/crmeb/app/admin/model/finance/FinanceModel.php
+++ b/crmeb/app/admin/model/finance/FinanceModel.php
@@ -231,8 +231,8 @@ class FinanceModel extends BaseModel
{
$trans = self::alias('a')
->join('user b', 'a.uid=b.uid')
- ->join('__store_order_cart_info__ c', 'a.id=c.oid')
- ->join('__store_product__ d', 'c.product_id=d.id')
+ ->join('store_order_cart_info c', 'a.id=c.oid')
+ ->join('store_product d', 'c.product_id=d.id')
->field('b.nickname,a.pay_price,d.store_name')
->order('a.add_time DESC')
->limit('6')
diff --git a/crmeb/app/admin/model/order/StoreOrder.php b/crmeb/app/admin/model/order/StoreOrder.php
index 270c5bce..7d839a00 100644
--- a/crmeb/app/admin/model/order/StoreOrder.php
+++ b/crmeb/app/admin/model/order/StoreOrder.php
@@ -86,6 +86,7 @@ class StoreOrder extends BaseModel
$item['_info'] = $_info;
$item['spread_nickname'] = Db::name('user')->where('uid',$item['spread_uid'])->value('nickname');
$item['add_time'] = date('Y-m-d H:i:s',$item['add_time']);
+ $item['back_integral'] = $item['back_integral'] ? : 0;
if($item['pink_id'] || $item['combination_id']){
$pinkStatus = StorePink::where('order_id_key',$item['id'])->value('status');
switch ($pinkStatus){
@@ -172,14 +173,25 @@ class StoreOrder extends BaseModel
$img .='';
}
}
- if(!strlen(trim($img))) $img = '无';
- $item['status_name']=<<申请退款
退款原因:{$item['refund_reason_wap']}
备注说明:{$item['refund_reason_wap_explain']}
退款时间:{$refundReasonTime}
退款凭证:{$img}
HTML;
+ }
}else if($item['paid']==1 && $item['refund_status']==2){
$item['status_name']='已退款';
}
@@ -241,7 +253,7 @@ HTML;
$item['pay_postage'],
$item['coupon_price'],
$item['pay_type_name'],
- $item['pay_time'] > 0 ? date('Y/md H:i',$item['pay_time']) : '暂无',
+ $item['pay_time'] > 0 ? date('Y/m-d H:i',$item['pay_time']) : '暂无',
$item['status_name'],
$item['add_time'],
$item['mark']
@@ -1071,7 +1083,7 @@ HTML;
];
if($postageData['delivery_type'] == 'send'){//送货
$goodsName = StoreOrderCartInfo::getProductNameList($order['id']);
- if($order['is_channel']){
+ if($order['is_channel'] == 1){
//小程序送货模版消息
RoutineTemplate::sendOrderPostage($order);
}else{//公众号
@@ -1086,7 +1098,7 @@ HTML;
WechatTemplateService::sendTemplate($openid,WechatTemplateService::ORDER_DELIVER_SUCCESS,$group,$url);
}
}else if($postageData['delivery_type'] == 'express') {//发货
- if ($order['is_channel']) {
+ if ($order['is_channel'] == 1) {
//小程序发货模版消息
RoutineTemplate::sendOrderPostage($order,1);
} else {//公众号
@@ -1123,7 +1135,7 @@ HTML;
$title = StoreProduct::where('id',$cartInfo['product_id'])->value('store_name');
}
- if($order['is_channel']){//小程序
+ if($order['is_channel'] == 1){//小程序
RoutineTemplate::sendOut('OREDER_TAKEVER',$order['uid'],[
'keyword1'=>$order['order_id'],
'keyword2'=>$title,
@@ -1159,7 +1171,7 @@ HTML;
$store_name = StoreProduct::where('id',$productId)->value('store_name');
$title.=$store_name.',';
}
- if($order->is_channel){
+ if($order->is_channel == 1){
RoutineTemplate::sendOut('ORDER_REFUND_FILE',$order->uid,[
'keyword1'=>$order->order_id,
'keyword2'=>$title,
@@ -1173,7 +1185,7 @@ HTML;
'keyword2'=>$order->pay_price,
'keyword3'=>date('Y-m-d H:i:s',time()),
'remark'=>'给您带来的不便,请谅解!'
- ]);
+ ],Url::buildUrl('/order/detail/'.$order['order_id'])->suffix('')->domain(true)->build());
}
}
diff --git a/crmeb/app/admin/model/record/StoreStatistics.php b/crmeb/app/admin/model/record/StoreStatistics.php
index 18dcabb3..e560bfb7 100644
--- a/crmeb/app/admin/model/record/StoreStatistics.php
+++ b/crmeb/app/admin/model/record/StoreStatistics.php
@@ -130,7 +130,7 @@ class StoreStatistics extends BaseModel
*/
public static function getConsumption($where)
{
- $consumption=self::getTime($where,new UserBill,'b.add_time')->alias('a')->join('__user__ b','a.uid = b.uid')
+ $consumption=self::getTime($where,new UserBill,'b.add_time')->alias('a')->join('user b','a.uid = b.uid')
->field('sum(a.number) number')
->where('a.type','pay_product')->find()->toArray();
return $consumption;
@@ -182,9 +182,9 @@ class StoreStatistics extends BaseModel
public static function trans()
{
$trans = self::alias('a')
- ->join('__user__ b', 'a.uid=b.uid','left')
- ->join('__store_order_cart_info__ c', 'a.id=c.oid')
- ->join('__store_product__ d', 'c.product_id=d.id')
+ ->join('user b', 'a.uid=b.uid','left')
+ ->join('store_order_cart_info c', 'a.id=c.oid')
+ ->join('store_product d', 'c.product_id=d.id')
->field('b.nickname,a.pay_price,d.store_name')
->order('a.add_time DESC')
->limit('6')
diff --git a/crmeb/app/admin/model/store/StoreProduct.php b/crmeb/app/admin/model/store/StoreProduct.php
index 3b2bef6a..14a28c80 100644
--- a/crmeb/app/admin/model/store/StoreProduct.php
+++ b/crmeb/app/admin/model/store/StoreProduct.php
@@ -80,9 +80,7 @@ class StoreProduct extends BaseModel
$data = ['p.is_show'=>1,'p.is_del'=>0,'pav.stock|p.stock'=>0];
break;
case 5:
- $min = SystemConfig::getConfigValue('store_stock');
- $min = $min ? $min : 10;
- $data = ['p.is_show'=>1,'p.is_del'=>0,'pav.stock|p.stock'=>['<=',$min]];
+ $data = ['p.is_show'=>1,'p.is_del'=>0];
break;
case 6:
$data = ['p.is_del'=>1];
@@ -101,7 +99,13 @@ class StoreProduct extends BaseModel
if(!empty($where)){
$model=$model->group('p.id');
if(isset($where['type']) && $where['type']!='' && ($data=self::setData($where['type']))){
- $model = $model->where($data);
+ if ($where['type'] == 5) {
+ $store_stock = sysConfig('store_stock');
+ if($store_stock < 0) $store_stock = 2;
+ $model = $model->where($data)->where('p.stock','<=',$store_stock);
+ } else {
+ $model = $model->where($data);
+ }
}
if(isset($where['store_name']) && $where['store_name']!=''){
$model = $model->where('p.store_name|p.keyword|p.id','LIKE',"%$where[store_name]%");
@@ -117,6 +121,8 @@ class StoreProduct extends BaseModel
}
if(isset($where['order']) && $where['order']!=''){
$model = $model->order(self::setOrder($where['order']));
+ }else{
+ $model = $model->order('p.sort desc,p.id desc');
}
}
return $model;
@@ -359,7 +365,7 @@ class StoreProduct extends BaseModel
*/
public static function getMaxList($where){
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
- $model=StoreOrder::alias('a')->join('StoreOrderCartInfo c','a.id=c.oid')->join('__store_product__ b','b.id=c.product_id');
+ $model=StoreOrder::alias('a')->join('StoreOrderCartInfo c','a.id=c.oid')->join('store_product b','b.id=c.product_id');
$list=self::getModelTime($where,$model,'a.add_time')->group('c.product_id')->order('p_count desc')->limit(10)
->field(['count(c.product_id) as p_count','b.store_name','sum(b.price) as sum_price'])->select();
if(count($list)) $list=$list->toArray();
@@ -386,7 +392,7 @@ class StoreProduct extends BaseModel
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
$model=StoreOrder::alias('a')
->join('StoreOrderCartInfo c','a.id=c.oid')
- ->join('__store_product__ b','b.id=c.product_id')
+ ->join('store_product b','b.id=c.product_id')
->where('b.is_show',1)
->where('b.is_del',0);
$list=self::getModelTime($where,$model,'a.add_time')->group('c.product_id')->order('profity desc')->limit(10)
@@ -480,7 +486,7 @@ class StoreProduct extends BaseModel
}else{
$time['data']=isset($where['data'])? $where['data']:'';
}
- $model=self::getModelTime($time, Db::name('store_cart')->alias('a')->join('__store_product__ b','a.product_id=b.id'),'a.add_time');
+ $model=self::getModelTime($time, Db::name('store_cart')->alias('a')->join('store_product b','a.product_id=b.id'),'a.add_time');
if(isset($where['title']) && $where['title']!=''){
$model=$model->where('b.store_name|b.id','like',"%$where[title]%");
}
diff --git a/crmeb/app/admin/model/store/StoreProductAttrValue.php b/crmeb/app/admin/model/store/StoreProductAttrValue.php
index 733c0f0c..852def7f 100644
--- a/crmeb/app/admin/model/store/StoreProductAttrValue.php
+++ b/crmeb/app/admin/model/store/StoreProductAttrValue.php
@@ -55,7 +55,7 @@ class StoreProductAttrValue extends BaseModel
->dec('stock',$num)->inc('sales',$num)->update();
if($res){
$stock = self::where('product_id',$productId)->where('unique',$unique)->value('stock');
- $replenishment_num = SystemConfigService::get('store_stock') ?? 0;//库存预警界限
+ $replenishment_num = sysConfig('store_stock') ?? 0;//库存预警界限
if($replenishment_num >= $stock){
try{
ChannelService::instance()->send('STORE_STOCK', ['id'=>$productId]);
@@ -100,7 +100,7 @@ class StoreProductAttrValue extends BaseModel
$valueNew[$count]['price'] = $sukValue[$suk]['price'];
$valueNew[$count]['sales'] = $sukValue[$suk]['sales'];
$valueNew[$count]['pic'] = $sukValue[$suk]['pic'];
- $valueNew[$count]['bar_code'] = $sukValue[$suk]['bar_code'];
+ $valueNew[$count]['bar_code'] = $sukValue[$suk]['bar_code'] ?? '';
$valueNew[$count]['check'] = false;
$count++;
}
diff --git a/crmeb/app/admin/model/store/StoreProductRelation.php b/crmeb/app/admin/model/store/StoreProductRelation.php
index bacf07d3..f8589843 100644
--- a/crmeb/app/admin/model/store/StoreProductRelation.php
+++ b/crmeb/app/admin/model/store/StoreProductRelation.php
@@ -28,14 +28,14 @@ class StoreProductRelation extends BaseModel
public static function getCollect($pid){
$model = new self();
$model = $model->where('r.product_id',$pid)->where('r.type','collect');
- $model = $model->alias('r')->join('__WECHAT_USER__ u','u.uid=r.uid');
+ $model = $model->alias('r')->join('wechat_user u','u.uid=r.uid');
$model = $model->field('r.*,u.nickname');
return self::page($model);
}
public static function getLike($pid){
$model = new self();
$model = $model->where('r.product_id',$pid)->where('r.type','like');
- $model = $model->alias('r')->join('__WECHAT_USER__ u','u.uid=r.uid');
+ $model = $model->alias('r')->join('wechat_user u','u.uid=r.uid');
$model = $model->field('r.*,u.nickname');
return self::page($model);
}
diff --git a/crmeb/app/admin/model/store/StoreProductReply.php b/crmeb/app/admin/model/store/StoreProductReply.php
index e9e08f8c..c1197688 100644
--- a/crmeb/app/admin/model/store/StoreProductReply.php
+++ b/crmeb/app/admin/model/store/StoreProductReply.php
@@ -57,7 +57,7 @@ class StoreProductReply extends BaseModel
public static function getProductImaesList($where)
{
- $list=self::valiWhere($where,'a','p')->group('p.id')->join('__wechat_user__ u','u.uid=a.uid')->join("__store_product__ p",'a.product_id=p.id')->field(['p.id','p.image','p.store_name','p.price'])->page($where['page'],$where['limit'])->select();
+ $list=self::valiWhere($where,'a','p')->group('p.id')->join('wechat_user u','u.uid=a.uid','LEFT')->join("store_product p",'a.product_id=p.id','LEFT')->field(['p.id','p.image','p.store_name','p.price'])->page($where['page'],$where['limit'])->select();
$list=count($list) ? $list->toArray() : [];
foreach ($list as &$item){
$item['store_name']=self::getSubstrUTf8($item['store_name'],10,'UTF-8','');
@@ -68,17 +68,18 @@ class StoreProductReply extends BaseModel
public static function getProductReplyList($where)
{
- $data=self::valiWhere($where,'a','p')->join("__store_product__ p",'a.product_id=p.id')
- ->join('__wechat_user__ u','u.uid=a.uid')
+ $data=self::valiWhere($where,'a','p')->join("store_product p",'a.product_id=p.id','left')
+ ->join('user u','u.uid=a.uid','left')
->order('a.add_time desc,a.is_reply asc')
- ->field('a.*,u.nickname,u.headimgurl as avatar')
+ ->field('a.*,u.nickname,u.avatar')
->page((int)$where['message_page'],(int)$where['limit'])
->select();
$data=count($data) ? $data->toArray() : [];
foreach ($data as &$item){
$item['time']=\crmeb\services\UtilService::timeTran($item['add_time']);
}
- $count=self::valiWhere($where,'a','p')->join('__wechat_user__ u','u.uid=a.uid')->join("__store_product__ p",'a.product_id=p.id')->count();
+
+ $count=self::valiWhere($where,'a','p')->join('user u','u.uid=a.uid','left')->join("store_product p",'a.product_id=p.id','left')->count();
return ['list'=>$data,'count'=>$count];
}
/**
@@ -96,8 +97,8 @@ class StoreProductReply extends BaseModel
}
}
if($where['product_id']) $model = $model->where('r.product_id',$where['product_id']);
- $model = $model->alias('r')->join('__wechat_user__ u','u.uid=r.uid');
- $model = $model->join('__store_product__ p','p.id=r.product_id');
+ $model = $model->alias('r')->join('wechat_user u','u.uid=r.uid');
+ $model = $model->join('store_product p','p.id=r.product_id');
$model = $model->where('r.is_del',0);
$model = $model->field('r.*,u.nickname,u.headimgurl,p.store_name');
$model = $model->order('r.add_time desc,r.is_reply asc');
diff --git a/crmeb/app/admin/model/system/SystemAttachment.php b/crmeb/app/admin/model/system/SystemAttachment.php
index 0a24abdd..473ce4d6 100644
--- a/crmeb/app/admin/model/system/SystemAttachment.php
+++ b/crmeb/app/admin/model/system/SystemAttachment.php
@@ -117,10 +117,9 @@ class SystemAttachment extends BaseModel
*/
public static function emptyYesterdayAttachment()
{
- self::beginTrans();
- try{
- $list = self::whereTime('time','yesterday')->where(['module_type'=>2])->column('att_dir','att_id');
- foreach ($list as $att_id => $att_dir){
+ $list = self::whereTime('time','yesterday')->where(['module_type'=>2])->column('att_dir','att_id');
+ foreach ($list as $att_id => $att_dir){
+ try{
if($att_dir && strstr($att_dir,'uploads') !== false){
if(strstr($att_dir,'http') === false)
@unlink(substr($att_dir,1));
@@ -129,11 +128,8 @@ class SystemAttachment extends BaseModel
@unlink($filedir);
}
}
- self::del($att_id);
- }
- self::commitTrans();
- }catch (\Exception $e){
- self::rollbackTrans();
+ }catch (\Throwable $e){}
+ self::del($att_id);
}
}
}
\ No newline at end of file
diff --git a/crmeb/app/admin/model/system/SystemConfig.php b/crmeb/app/admin/model/system/SystemConfig.php
index d9bef572..9c85a7d6 100644
--- a/crmeb/app/admin/model/system/SystemConfig.php
+++ b/crmeb/app/admin/model/system/SystemConfig.php
@@ -193,9 +193,9 @@ class SystemConfig extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
- public static function getAll($id){
+ public static function getAll($id,int $status = 1){
$where['config_tab_id'] = $id;
- $where['status'] = 1;
+ if($status == 1) $where['status'] = $status;
return self::where($where)->order('sort desc,id asc')->select();
}
diff --git a/crmeb/app/admin/model/system/SystemLog.php b/crmeb/app/admin/model/system/SystemLog.php
index 207005fe..6592d019 100644
--- a/crmeb/app/admin/model/system/SystemLog.php
+++ b/crmeb/app/admin/model/system/SystemLog.php
@@ -50,14 +50,14 @@ class SystemLog extends BaseModel
public static function adminVisit($adminId,$adminName,$type)
{
$request = app('request');
- $module = $request->app();
+ $module = app('http')->getName();
$controller = $request->controller();
$action = $request->action();
$route = $request->route();
self::startTrans();
try{
$data = [
- 'method'=>$request->app(),
+ 'method'=>app('http')->getName(),
'admin_id'=>$adminId,
'add_time'=>time(),
'admin_name'=>$adminName,
@@ -90,7 +90,7 @@ class SystemLog extends BaseModel
public static function setCurrentVisit($adminInfo, $page)
{
$request = app('request');
- $module = $request->app();
+ $module = app('http')->getName();
$controller = $request->controller();
$action = $request->action();
$route = $request->route();
diff --git a/crmeb/app/admin/model/system/SystemNotice.php b/crmeb/app/admin/model/system/SystemNotice.php
index 12a2cc6c..4c5d4402 100644
--- a/crmeb/app/admin/model/system/SystemNotice.php
+++ b/crmeb/app/admin/model/system/SystemNotice.php
@@ -103,7 +103,7 @@ class SystemNotice extends BaseModel
public static function getAdminNoticeTotal($adminId)
{
- $list = self::alias('A')->join('__SYSTEM_NOTICE_ADMIN__ B','B.notice_type = A.type')
+ $list = self::alias('A')->join('system_notice_admin B','B.notice_type = A.type')
->where('A.status',1)->where('B.is_visit',0)->where('B.is_click',0)->where('B.admin_id',$adminId)
->field('count(B.id) total')->group('A.id')->select()->toArray();
if(!$list) return 0;
@@ -114,7 +114,7 @@ class SystemNotice extends BaseModel
public static function getAdminNotice($adminId)
{
- $list = self::alias('A')->join('__SYSTEM_NOTICE_ADMIN__ B','B.notice_type = A.type')
+ $list = self::alias('A')->join('system_notice_admin B','B.notice_type = A.type')
->where('A.status',1)->where('B.is_visit',0)->where('B.is_click',0)->where('B.admin_id',$adminId)
->field('A.id,A.type,A.title,A.icon,count(B.id) total,A.template,max(B.add_time) as last_time')
->group('A.id')->having('total > 0')->select()->toArray();
diff --git a/crmeb/app/admin/model/ump/StoreBargain.php b/crmeb/app/admin/model/ump/StoreBargain.php
index 210790ea..10d60dbe 100644
--- a/crmeb/app/admin/model/ump/StoreBargain.php
+++ b/crmeb/app/admin/model/ump/StoreBargain.php
@@ -174,7 +174,7 @@ class StoreBargain extends BaseModel
*/
public static function getMaxList($where){
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
- $model=StoreOrder::alias('a')->join('__store_bargain__ b','b.id=a.bargain_id')->where('a.paid',1);
+ $model=StoreOrder::alias('a')->join('store_bargain b','b.id=a.bargain_id')->where('a.paid',1);
$list=self::getModelTime($where,$model,'a.add_time')->group('a.bargain_id')->order('p_count desc')->limit(10)
->field(['count(a.bargain_id) as p_count','b.title as store_name','sum(b.price) as sum_price'])->select();
if(count($list)) $list=$list->toArray();
@@ -204,7 +204,7 @@ class StoreBargain extends BaseModel
*/
public static function ProfityTop10($where){
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
- $model=StoreOrder::alias('a')->join('__store_bargain__ b','b.id=a.bargain_id')->where('a.paid',1);
+ $model=StoreOrder::alias('a')->join('store_bargain b','b.id=a.bargain_id')->where('a.paid',1);
$list=self::getModelTime($where,$model,'a.add_time')->group('a.bargain_id')->order('profity desc')->limit(10)
->field(['count(a.bargain_id) as p_count','b.title as store_name','sum(b.price) as sum_price','(b.price-b.cost) as profity'])
->select();
@@ -257,7 +257,7 @@ class StoreBargain extends BaseModel
* @return mixed
*/
public static function getBargainRefundList($where = array()){
- $model = StoreOrder::alias('a')->join('__store_bargain__ b','b.id=a.bargain_id');
+ $model = StoreOrder::alias('a')->join('store_bargain b','b.id=a.bargain_id');
$list = self::getModelTime($where,$model,'a.add_time')->where('a.refund_status','<>',0)->group('a.bargain_id')->order('count desc')->page((int)$where['page'],(int)$where['limit'])
->field(['count(a.bargain_id) as count','b.title as store_name','sum(b.price) as sum_price'])->select();
if(count($list)) $list=$list->toArray();
diff --git a/crmeb/app/admin/model/ump/StoreCombination.php b/crmeb/app/admin/model/ump/StoreCombination.php
index 60249d36..bab9bd63 100644
--- a/crmeb/app/admin/model/ump/StoreCombination.php
+++ b/crmeb/app/admin/model/ump/StoreCombination.php
@@ -386,7 +386,7 @@ class StoreCombination extends BaseModel
*/
public static function ProfityTop10($where){
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
- $model = StoreOrder::alias('a')->join('__store_combination__ b','b.id = a.combination_id')->where('a.paid',1);
+ $model = StoreOrder::alias('a')->join('store_combination b','b.id = a.combination_id')->where('a.paid',1);
$list=self::getModelTime($where,$model,'a.add_time')->group('a.seckill_id')->order('profity desc')->limit(10)
->field('count(a.combination_id) as p_count,b.title as store_name,sum(b.price) as sum_price,(b.price-b.cost) as profity')
->select();
@@ -410,7 +410,7 @@ class StoreCombination extends BaseModel
}
public static function getMaxList($where){
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
- $model=StoreOrder::alias('a')->join('__store_combination__ b','b.id=a.combination_id')->where('a.paid',1);
+ $model=StoreOrder::alias('a')->join('store_combination b','b.id=a.combination_id')->where('a.paid',1);
$list=self::getModelTime($where,$model,'a.add_time')->group('a.combination_id')->order('p_count desc')->limit(10)
->field('count(a.combination_id) as p_count,b.title as store_name,sum(b.price) as sum_price')->select();
if(count($list)) $list=$list->toArray();
@@ -438,7 +438,7 @@ class StoreCombination extends BaseModel
* @return mixed
*/
public static function getBargainRefundList($where = array()){
- $model = StoreOrder::alias('a')->join('__store_combination__ b','b.id=a.combination_id');
+ $model = StoreOrder::alias('a')->join('store_combination b','b.id=a.combination_id');
$list = self::getModelTime($where,$model,'a.add_time')->where('a.refund_status','<>',0)->group('a.combination_id')
->order('count desc')->page((int)$where['page'],(int)$where['limit'])
->field('count(a.combination_id) as count,b.title as store_name,sum(b.price) as sum_price')
diff --git a/crmeb/app/admin/model/ump/StoreCouponIssue.php b/crmeb/app/admin/model/ump/StoreCouponIssue.php
index b8439fcb..cc5e226e 100644
--- a/crmeb/app/admin/model/ump/StoreCouponIssue.php
+++ b/crmeb/app/admin/model/ump/StoreCouponIssue.php
@@ -28,7 +28,7 @@ class StoreCouponIssue extends BaseModel
protected $insert = ['add_time'];
public static function stsypage($where){
- $model = self::alias('A')->field('A.*,B.title')->join('__store_coupon__ B','A.cid = B.id')->where('A.is_del',0)->order('A.add_time DESC');
+ $model = self::alias('A')->field('A.*,B.title')->join('store_coupon B','A.cid = B.id')->where('A.is_del',0)->order('A.add_time DESC');
if(isset($where['status']) && $where['status']!=''){
$model=$model->where('A.status',$where['status']);
}
diff --git a/crmeb/app/admin/model/ump/StoreCouponIssueUser.php b/crmeb/app/admin/model/ump/StoreCouponIssueUser.php
index 71b3293d..f3f9b993 100644
--- a/crmeb/app/admin/model/ump/StoreCouponIssueUser.php
+++ b/crmeb/app/admin/model/ump/StoreCouponIssueUser.php
@@ -22,7 +22,7 @@ class StoreCouponIssueUser extends BaseModel
public static function systemCouponIssuePage($issue_coupon_id)
{
$model = self::alias('A')->field('B.nickname,B.avatar,A.add_time')
- ->join('__user__ B','A.uid = B.uid')
+ ->join('user B','A.uid = B.uid')
->where('A.issue_coupon_id',$issue_coupon_id);
return self::page($model,function($item){
$item['add_time'] = $item['add_time'] == 0 ? '未知' : date('Y/m/d H:i',$item['add_time']);
diff --git a/crmeb/app/admin/model/ump/StorePink.php b/crmeb/app/admin/model/ump/StorePink.php
index 0d07e282..073b90ea 100644
--- a/crmeb/app/admin/model/ump/StorePink.php
+++ b/crmeb/app/admin/model/ump/StorePink.php
@@ -37,8 +37,8 @@ class StorePink extends BaseModel
if($where['status']) $model = $model->where('p.status',$where['status']);
$model = $model->where('p.k_id',0);
$model = $model->order('p.id desc');
- $model = $model->join('__store_combination__ c','c.id=p.cid');
- $model = $model->join('__user__ u','u.uid = p.uid');
+ $model = $model->join('store_combination c','c.id=p.cid');
+ $model = $model->join('user u','u.uid = p.uid');
return self::page($model,function($item)use($where){
$item['count_people'] = bcadd(self::where('k_id',$item['id'])->count(),1,0);
},$where);
@@ -72,7 +72,7 @@ class StorePink extends BaseModel
$model = $model->alias('p');
$model = $model->field('p.*,u.nickname,u.avatar');
$model = $model->where('id',$id);
- $model = $model->join('__user__ u','u.uid = p.uid');
+ $model = $model->join('user u','u.uid = p.uid');
$list = $model->find();
if($list) return $list->toArray();
else return [];
@@ -88,7 +88,7 @@ class StorePink extends BaseModel
$model = $model->field('p.*,u.nickname,u.avatar');
$model = $model->where('k_id',$id);
$model = $model->where('is_refund',0);
- $model = $model->join('__user__ u','u.uid = p.uid');
+ $model = $model->join('user u','u.uid = p.uid');
$model = $model->order('id asc');
$list = $model->select();
if($list) return $list->toArray();
diff --git a/crmeb/app/admin/model/ump/StoreSeckill.php b/crmeb/app/admin/model/ump/StoreSeckill.php
index 3fd7633b..83f5bfdd 100644
--- a/crmeb/app/admin/model/ump/StoreSeckill.php
+++ b/crmeb/app/admin/model/ump/StoreSeckill.php
@@ -172,7 +172,7 @@ class StoreSeckill extends BaseModel
*/
public static function getMaxList($where){
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
- $model=StoreOrder::alias('a')->join('__store_seckill__ b','b.id=a.seckill_id')->where('a.paid',1);
+ $model=StoreOrder::alias('a')->join('store_seckill b','b.id=a.seckill_id')->where('a.paid',1);
$list=self::getModelTime($where,$model,'a.add_time')->group('a.seckill_id')->order('p_count desc')->limit(10)
->field(['count(a.seckill_id) as p_count','b.title as store_name','sum(b.price) as sum_price'])->select();
if(count($list)) $list=$list->toArray();
@@ -202,7 +202,7 @@ class StoreSeckill extends BaseModel
*/
public static function ProfityTop10($where){
$classs=['layui-bg-red','layui-bg-orange','layui-bg-green','layui-bg-blue','layui-bg-cyan'];
- $model = StoreOrder::alias('a')->join('__store_seckill__ b','b.id = a.seckill_id')->where('a.paid',1);
+ $model = StoreOrder::alias('a')->join('store_seckill b','b.id = a.seckill_id')->where('a.paid',1);
$list=self::getModelTime($where,$model,'a.add_time')->group('a.seckill_id')->order('profity desc')->limit(10)
->field(['count(a.seckill_id) as p_count','b.title as store_name','sum(b.price) as sum_price','(b.price-b.cost) as profity'])
->select();
@@ -255,7 +255,7 @@ class StoreSeckill extends BaseModel
* @return mixed
*/
public static function getBargainRefundList($where = array()){
- $model = StoreOrder::alias('a')->join('__store_seckill__ b','b.id=a.seckill_id');
+ $model = StoreOrder::alias('a')->join('store_seckill b','b.id=a.seckill_id');
$list = self::getModelTime($where,$model,'a.add_time')->where('a.refund_status','<>',0)->group('a.seckill_id')->order('count desc')->page((int)$where['page'],(int)$where['limit'])
->field(['count(a.seckill_id) as count','b.title as store_name','sum(b.price) as sum_price'])->select();
if(count($list)) $list=$list->toArray();
diff --git a/crmeb/app/admin/model/user/User.php b/crmeb/app/admin/model/user/User.php
index 1dfe4099..a5e0946c 100644
--- a/crmeb/app/admin/model/user/User.php
+++ b/crmeb/app/admin/model/user/User.php
@@ -413,7 +413,7 @@ class User extends BaseModel
public static function getBadgeList($where){
$user_count = self::setWherePage(self::getModelTime($where,new self),$where,['is_promoter','status'])->count();
$user_count_old = self::getOldDate($where)->count();
- $store_brokerage_statu = SystemConfigService::get('store_brokerage_statu');
+ $store_brokerage_statu = sysConfig('store_brokerage_statu');
if($store_brokerage_statu == 1)
$fenxiao = self::setWherePage(self::getModelTime($where,new self),$where,['is_promoter','status'])->where('spread_uid','<>',0)->count();
else
@@ -483,7 +483,7 @@ class User extends BaseModel
(count($xdata) > $limit) && $Zoom = $xdata[$limit-5];
//多次购物会员数量饼状图
$count = self::setWherePage(self::getModelTime($where,new self),$where,['is_promoter'])->count();
- $user_count = self::setWherePage(self::getModelTime($where,self::alias('a')->join('__store_order__ r','r.uid=a.uid'),'a.add_time'),$where,['is_promoter'])
+ $user_count = self::setWherePage(self::getModelTime($where,self::alias('a')->join('store_order r','r.uid=a.uid'),'a.add_time'),$where,['is_promoter'])
->where('r.paid',1)->count('a.uid');
$shop_xdata = ['多次购买数量占比','无购买数量占比'];
$shop_data = [];
@@ -724,7 +724,7 @@ class User extends BaseModel
*/
public static function getUserBusinessChart($where,$limit=20){
//获取购物会员人数趋势图
- $list=self::getModelTime($where,self::where('a.status',1)->alias('a')->join('__store_order__ r','r.uid=a.uid'),'a.add_time')
+ $list=self::getModelTime($where,self::where('a.status',1)->alias('a')->join('store_order r','r.uid=a.uid'),'a.add_time')
->where('r.paid', 1)
->where('a.is_promoter', 0)
->where('a.add_time','<>',0)
@@ -742,7 +742,7 @@ class User extends BaseModel
}
count($xdata) > $limit && $zoom=$xdata[$limit-5];
//会员访问量
- $visit=self::getModelTime($where,self::alias('a')->join('__store_visit__ t','t.uid=a.uid'),'t.add_time')
+ $visit=self::getModelTime($where,self::alias('a')->join('store_visit t','t.uid=a.uid'),'t.add_time')
->where('a.is_promoter',0)
->field('FROM_UNIXTIME(t.add_time,"%Y-%m-%d") as _add_time,count(t.uid) as count_user')
->group('_add_time')
@@ -759,7 +759,7 @@ class User extends BaseModel
count($visit_xdata) > $limit && $visit_zoom=$visit_xdata[$limit-5];
//多次购物会员数量饼状图
$count=self::getModelTime($where,self::where('is_promoter',0))->count();
- $user_count=self::getModelTime($where,self::alias('a')->join('__store_order__ r','r.uid=a.uid'),'a.add_time')
+ $user_count=self::getModelTime($where,self::alias('a')->join('store_order r','r.uid=a.uid'),'a.add_time')
->where('a.is_promoter',0)
->where('r.paid',1)
->group('a.uid')
@@ -817,7 +817,7 @@ class User extends BaseModel
$orderPayCount = StoreOrder::getOrderPayCount($is_promoter);
if($orderPayCount){
$shopcount=self::alias('a')
- ->join('__store_order__ r','r.uid=a.uid')
+ ->join('store_order r','r.uid=a.uid')
->where('r.paid', 1)
->where('a.is_promoter', $is_promoter)
->group('r.uid')
@@ -830,7 +830,7 @@ class User extends BaseModel
//购物金额排行榜
if($orderPayCount){
$order=self::alias('a')
- ->join('__store_order__ r','r.uid=a.uid')
+ ->join('store_order r','r.uid=a.uid')
->where('r.paid', 1)
->where('a.is_promoter', $is_promoter)
->group('r.uid')
@@ -844,7 +844,7 @@ class User extends BaseModel
$orderPayCount = StoreOrder::getOrderPayMonthCount($is_promoter);
if($orderPayCount){
$lastorder=self::alias('a')
- ->join('__store_order__ r','r.uid=a.uid')
+ ->join('store_order r','r.uid=a.uid')
->where('r.paid', 1)
->where('a.is_promoter', $is_promoter)
// ->whereTime('r.pay_time','last month')
@@ -1014,7 +1014,7 @@ class User extends BaseModel
}
count($visit_xdata) > $limit && $visit_zoom=$visit_xdata[$limit-5];
//获取购物会员人数趋势图
- $list=self::getModelTime($where,self::where('a.status',1)->alias('a')->join('__store_order__ r','r.uid=a.uid'),'a.add_time')
+ $list=self::getModelTime($where,self::where('a.status',1)->alias('a')->join('store_order r','r.uid=a.uid'),'a.add_time')
->where('r.paid', 1)
->where('a.is_promoter', 1)
->where('a.add_time','<>',0)
@@ -1034,7 +1034,7 @@ class User extends BaseModel
//多次购物分销会员数量饼状图
$count=self::getModelTime($where,self::where('is_promoter',1))->count();
$user_count=self::getModelTime($where,self::alias('a')
- ->join('__store_order__ r','r.uid=a.uid'),'a.add_time')
+ ->join('store_order r','r.uid=a.uid'),'a.add_time')
->where('a.is_promoter',1)
->where('r.paid',1)
->group('a.uid')
@@ -1110,11 +1110,11 @@ class User extends BaseModel
{
$userInfo = User::getUserInfo($orderInfo['uid']);
if(!$userInfo || !$userInfo['spread_uid']) return true;
- $storeBrokerageStatu = SystemConfigService::get('store_brokerage_statu') ? : 1;//获取后台分销类型
+ $storeBrokerageStatu = sysConfig('store_brokerage_statu') ? : 1;//获取后台分销类型
if($storeBrokerageStatu == 1){
if(!User::be(['uid'=>$userInfo['spread_uid'],'is_promoter'=>1])) return true;
}
- $brokerageRatio = (SystemConfigService::get('store_brokerage_ratio') ?: 0)/100;
+ $brokerageRatio = (sysConfig('store_brokerage_ratio') ?: 0)/100;
if($brokerageRatio <= 0) return true;
$cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价
if($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回
@@ -1142,11 +1142,11 @@ class User extends BaseModel
$userInfo = User::getUserInfo($orderInfo['uid']);
$userInfoTwo = User::getUserInfo($userInfo['spread_uid']);
if(!$userInfoTwo || !$userInfoTwo['spread_uid']) return true;
- $storeBrokerageStatu = SystemConfigService::get('store_brokerage_statu') ? : 1;//获取后台分销类型
+ $storeBrokerageStatu = sysConfig('store_brokerage_statu') ? : 1;//获取后台分销类型
if($storeBrokerageStatu == 1){
if(!User::be(['uid'=>$userInfoTwo['spread_uid'],'is_promoter'=>1])) return true;
}
- $brokerageRatio = (SystemConfigService::get('store_brokerage_two') ?: 0)/100;
+ $brokerageRatio = (sysConfig('store_brokerage_two') ?: 0)/100;
if($brokerageRatio <= 0) return true;
$cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价
if($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回
diff --git a/crmeb/app/admin/model/user/UserBill.php b/crmeb/app/admin/model/user/UserBill.php
index 6e7af2ae..ab46cff6 100644
--- a/crmeb/app/admin/model/user/UserBill.php
+++ b/crmeb/app/admin/model/user/UserBill.php
@@ -130,7 +130,7 @@ class UserBill extends BaseModel
->where('a.type', 'brokerage')
->where('a.pm', 1)
->order('a.number desc')
- ->join('__store_order__ o','o.id=a.link_id')
+ ->join('store_order o','o.id=a.link_id')
->field('o.order_id,FROM_UNIXTIME(a.add_time,"%Y-%c-%d") as add_time,a.uid,o.uid as down_uid,r.nickname,r.avatar,r.spread_uid,r.level,a.number')
->page((int)$where['page'],(int)$where['limit'])
->select();
@@ -139,7 +139,7 @@ class UserBill extends BaseModel
}
//获取返佣用户总人数
public static function getFanCount(){
- return self::alias('a')->join('user r','a.uid=r.uid')->join('__store_order__ o','o.id=a.link_id')->where('a.category','now_money')->where('a.type', 'brokerage')->where('a.pm', 1)->count();
+ return self::alias('a')->join('user r','a.uid=r.uid')->join('store_order o','o.id=a.link_id')->where('a.category','now_money')->where('a.type', 'brokerage')->where('a.pm', 1)->count();
}
//获取用户充值数据
public static function getEchartsRecharge($where,$limit=15){
diff --git a/crmeb/app/admin/model/user/UserExtract.php b/crmeb/app/admin/model/user/UserExtract.php
index 0cd1e648..8550e425 100644
--- a/crmeb/app/admin/model/user/UserExtract.php
+++ b/crmeb/app/admin/model/user/UserExtract.php
@@ -75,7 +75,7 @@ class UserExtract extends BaseModel
if($where['nireid'] != '') $model = $model->where('a.real_name|a.id|b.nickname|a.bank_code|a.alipay_code','like',"%$where[nireid]%");
$model = $model->alias('a');
$model = $model->field('a.*,b.nickname');
- $model = $model->join('__user__ b','b.uid=a.uid','LEFT');
+ $model = $model->join('user b','b.uid=a.uid','LEFT');
$model = $model->order('a.id desc');
return self::page($model, $where);
}
@@ -325,7 +325,7 @@ class UserExtract extends BaseModel
*/
public static function getUserCountPrice($uid = 0){
if(!$uid) return 0;
- $price = self::where('uid',$uid)->where('status',1)->field('sum(extract_price) as price')->find()['price'];
+ $price = self::where('uid',$uid)->where('status',1)->sum('extract_price');
return $price ? $price : 0;
}
diff --git a/crmeb/app/admin/model/user/UserLevel.php b/crmeb/app/admin/model/user/UserLevel.php
index 1608b3c5..d356281b 100644
--- a/crmeb/app/admin/model/user/UserLevel.php
+++ b/crmeb/app/admin/model/user/UserLevel.php
@@ -46,7 +46,7 @@ class UserLevel extends BaseModel
{
$data=self::setWhere($where,'a')->group('a.uid')->order('grade desc')
->field('a.*,u.nickname,u.avatar')
- ->join('__user__ u','a.uid=u.uid')->page((int)$where['page'],(int)$where['limit'])->select();
+ ->join('user u','a.uid=u.uid')->page((int)$where['page'],(int)$where['limit'])->select();
$data=count($data) ? $data->toArray() : [];
foreach ($data as &$item){
$info=SystemUserLevel::where('id',$item['level_id'])->find();
@@ -57,7 +57,7 @@ class UserLevel extends BaseModel
$item['is_forever']= $item['is_forever'] ? '永久会员':'限时会员';
$item['valid_time']=$item['is_forever'] ? '永久':date('Y-m-d H:i:s',$item['valid_time']);
}
- $count=self::setWhere($where,'a')->group('a.level_id')->order('grade desc')->join('__user__ u','a.uid=u.uid')->count();
+ $count=self::setWhere($where,'a')->group('a.level_id')->order('grade desc')->join('user u','a.uid=u.uid')->count();
return compact('data','count');
}
diff --git a/crmeb/app/admin/model/user/UserPoint.php b/crmeb/app/admin/model/user/UserPoint.php
index cd6c4d97..c621f7ae 100644
--- a/crmeb/app/admin/model/user/UserPoint.php
+++ b/crmeb/app/admin/model/user/UserPoint.php
@@ -77,7 +77,7 @@ class UserPoint extends BaseModel
->ExcelSave();
}
public static function setWhere($where){
- $model=UserBill::alias('a')->join('__user__ b','a.uid=b.uid','left')->where('a.category','integral');
+ $model=UserBill::alias('a')->join('user b','a.uid=b.uid','left')->where('a.category','integral');
$time['data']='';
if($where['start_time']!='' && $where['end_time']!=''){
$time['data']=$where['start_time'].' - '.$where['end_time'];
diff --git a/crmeb/app/admin/model/user/UserRecharge.php b/crmeb/app/admin/model/user/UserRecharge.php
index 1f8d186d..76fa07fe 100644
--- a/crmeb/app/admin/model/user/UserRecharge.php
+++ b/crmeb/app/admin/model/user/UserRecharge.php
@@ -44,7 +44,7 @@ use crmeb\services\PHPExcelService;
$model = $model->where('A.recharge_type','weixin');
$model = $model->where('A.paid',1);
$model = $model->field('A.*,B.nickname');
- $model = $model->join('__user__ B','A.uid = B.uid','RIGHT');
+ $model = $model->join('user B','A.uid = B.uid','RIGHT');
$model = $model->order('A.id desc');
return self::page($model,$where);
diff --git a/crmeb/app/admin/model/wechat/WechatUser.php b/crmeb/app/admin/model/wechat/WechatUser.php
index 3da8ada8..f1ab004f 100644
--- a/crmeb/app/admin/model/wechat/WechatUser.php
+++ b/crmeb/app/admin/model/wechat/WechatUser.php
@@ -170,7 +170,7 @@ use app\admin\model\order\StoreOrderStatus;
$model=$model->alias($alias)->join('user u','a.uid=u.uid')->order('u.uid desc');
$alias.='.';
}
- $status = (int)SystemConfigService::get('store_brokerage_statu');
+ $status = (int)sysConfig('store_brokerage_statu');
if ($status == 1) {
if ($Listuids = User::where(['is_promoter' => 1])->field('uid')->select()) {
$newUids = [];
@@ -209,7 +209,7 @@ use app\admin\model\order\StoreOrderStatus;
*/
public static function agentSystemPage($where = array()){
$model=self::setSpreadWhere($where);
- $status =SystemConfigService::get('store_brokerage_statu');
+ $status =sysConfig('store_brokerage_statu');
if(isset($where['excel']) && $where['excel'] == 1){
$list = $model->field(['a.uid','u.phone','a.nickname','a.sex','a.country','a.province','a.city','a.now_money','a.subscribe','u.brokerage_price'])->select()->toArray();
$export = [];
@@ -235,7 +235,7 @@ use app\admin\model\order\StoreOrderStatus;
$uids = array_merge($uids);
}
$item['extract_sum_price'] = self::getModelTime($where,UserExtract::where('uid',$item['uid']))->sum('extract_price');
- $item['extract_count_price'] = UserExtract::getUserCountPrice($item['uid'].$where);//累计提现金额
+ $item['extract_count_price'] = UserExtract::getUserCountPrice($item['uid']);//累计提现金额
$item['extract_count_num'] = UserExtract::getUserCountNum($item['uid'],$where);//提现次数
$item['order_price'] = count($uids) ? StoreOrder::where('uid','in',$uids)->where(['paid'=>1,'refund_status'=>0])->sum('pay_price') : 0;//订单金额
$item['order_count'] = count($uids) ? StoreOrder::where('uid','in',$uids)->where(['paid'=>1,'refund_status'=>0])->count() : 0;//订单数量
@@ -298,7 +298,7 @@ use app\admin\model\order\StoreOrderStatus;
$uids = array_merge($uids);
}
$item['extract_sum_price'] = self::getModelTime($where,UserExtract::where('uid',$item['uid']))->sum('extract_price');
- $item['extract_count_price'] = UserExtract::getUserCountPrice($item['uid'],$where);//累计提现金额
+ $item['extract_count_price'] = UserExtract::getUserCountPrice($item['uid']);//累计提现金额
$item['extract_count_num'] = UserExtract::getUserCountNum($item['uid'],$where);//提现次数
$item['order_price'] = count($uids) ? StoreOrder::where('uid','in',$uids)->where(['paid'=>1,'refund_status'=>0])->sum('pay_price') : 0;//订单金额
$item['order_count'] = count($uids) ? StoreOrder::where('uid','in',$uids)->where(['paid'=>1,'refund_status'=>0])->count() : 0;//订单数量
@@ -539,7 +539,7 @@ use app\admin\model\order\StoreOrderStatus;
public static function getStairList($where)
{
if(!isset($where['uid'])) return [];
- $data = self::setSairWhere($where,new User())->page((int)$where['page'],(int)$where['limit'])->select();
+ $data = self::setSairWhere($where,new User())->order('add_time desc')->page((int)$where['page'],(int)$where['limit'])->select();
$data = count($data) ? $data->toArray() : [];
$userInfo = User::where('uid',$where['uid'])->find();
foreach ($data as &$item){
@@ -719,7 +719,7 @@ use app\admin\model\order\StoreOrderStatus;
public static function clearUserTag()
{
- Cache::deleteItem('_wechat_tag');
+ Cache::delete('_wechat_tag');
}
public static function getUserGroup()
@@ -739,7 +739,7 @@ use app\admin\model\order\StoreOrderStatus;
public static function clearUserGroup()
{
- Cache::deleteItem('_wechat_group');
+ Cache::delete('_wechat_group');
}
/**
diff --git a/crmeb/app/admin/view/agent/agent_manage/index.php b/crmeb/app/admin/view/agent/agent_manage/index.php
index 87b23f56..b32a8d1f 100644
--- a/crmeb/app/admin/view/agent/agent_manage/index.php
+++ b/crmeb/app/admin/view/agent/agent_manage/index.php
@@ -253,16 +253,15 @@
$eb.$swal('delete',function(){
$eb.axios.get(url).then(function(res){
if(res.status == 200 && res.data.code == 200) {
- $eb.$swal('success',res.data.msg);
- obj.del();
+ $eb.$swal('success',res.data.msg)
}else
return Promise.reject(res.data.msg || '清除失败')
}).catch(function(err){
$eb.$swal('error',err);
});
},{
- title:'您将解除【'+data.nickname+'】的推广权限,请谨慎操作!',
- text:'解除后可在会员管理里面开启',
+ title:'您将解除【'+data.nickname+'】的上级推广人,请谨慎操作!',
+ text:'解除后无法恢复',
confirm:'是的我要解除'
})
break;
diff --git a/crmeb/app/admin/view/index/index.php b/crmeb/app/admin/view/index/index.php
index 2d963fa6..74c4aab5 100644
--- a/crmeb/app/admin/view/index/index.php
+++ b/crmeb/app/admin/view/index/index.php
@@ -38,12 +38,12 @@