diff --git a/application/admin/common.php b/application/admin/common.php
index 3c137dcf..316ba6dd 100644
--- a/application/admin/common.php
+++ b/application/admin/common.php
@@ -102,3 +102,18 @@ function clearfile($path,$ext = '*.log')
}
return true;
}
+/**获取当前类方法
+ * @param $class
+ * @return array
+ */
+function get_this_class_methods($class,$array4 = []) {
+ $array1 = get_class_methods($class);
+ if ($parent_class = get_parent_class($class)) {
+ $array2 = get_class_methods($parent_class);
+ $array3 = array_diff($array1, $array2);//去除父级的
+ } else {
+ $array3 = $array1;
+ }
+ $array5 = array_diff($array3, $array4);//去除无用的
+ return $array5;
+}
diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php
index f7e3d0d6..74afc59b 100644
--- a/application/admin/controller/Index.php
+++ b/application/admin/controller/Index.php
@@ -62,8 +62,8 @@ class Index extends AuthController
$topData['treatedExtract'] = UserExtractModel::where('status',0)->count();
- //订单数->日
- $now_day_order_p = StoreOrderModel::where('paid',1)->where('pay_time','gt',$now_day)->count();
+ //订单数->昨日
+ $now_day_order_p = StoreOrderModel::where('paid',1)->whereTime('pay_time','yesterday')->count();
$pre_day_order_p = StoreOrderModel::where('paid',1)->where('pay_time','gt',$pre_day)->where('pay_time','lt',$now_day)->count();
$first_line['d_num'] = [
'data' => $now_day_order_p ? $now_day_order_p : 0,
@@ -72,8 +72,8 @@ class Index extends AuthController
];
//交易额->昨天
- $now_month_order_p = StoreOrderModel::where('paid',1)->where('pay_time','gt',$pre_day)->value('sum(pay_price)');
- $pre_month_order_p = StoreOrderModel::where('paid',1)->where('pay_time','gt',$beforyester_day)->where('pay_time','lt',$pre_day)->value('sum(pay_price)');
+ $now_month_order_p = StoreOrderModel::where('paid',1)->whereTime('pay_time','yesterday')->sum('pay_price');
+ $pre_month_order_p = StoreOrderModel::where('paid',1)->where('pay_time','gt',$beforyester_day)->where('pay_time','lt',$pre_day)->sum('pay_price');
$first_line['d_price'] = [
'data' => $now_month_order_p > 0 ? $now_month_order_p : 0,
'percent' => abs($now_month_order_p - $pre_month_order_p),
@@ -81,7 +81,7 @@ class Index extends AuthController
];
//交易额->月
- $now_month_order_p = StoreOrderModel::where('paid',1)->where('pay_time','gt',$now_month)->value('sum(pay_price)');
+ $now_month_order_p = StoreOrderModel::where('paid',1)->whereTime('pay_time','month')->sum('pay_price');
$pre_month_order_p = StoreOrderModel::where('paid',1)->where('pay_time','gt',$pre_month)->where('pay_time','lt',$now_month)->value('sum(pay_price)');
$first_line['m_price'] = [
'data' => $now_month_order_p > 0 ? $now_month_order_p : 0,
diff --git a/application/admin/controller/agent/AgentManage.php b/application/admin/controller/agent/AgentManage.php
index 4b1aec07..f33180fa 100644
--- a/application/admin/controller/agent/AgentManage.php
+++ b/application/admin/controller/agent/AgentManage.php
@@ -7,7 +7,7 @@ use app\admin\model\order\StoreOrder;
use app\admin\model\user\User;
use app\admin\model\wechat\WechatUser as UserModel;
use app\admin\library\FormBuilder;
-use app\wap\model\user\UserBill;
+use app\core\model\user\UserBill;
use service\UtilService as Util;
/**
diff --git a/application/admin/controller/article/Article.php b/application/admin/controller/article/Article.php
index f1b9436e..7e1c69f8 100644
--- a/application/admin/controller/article/Article.php
+++ b/application/admin/controller/article/Article.php
@@ -159,7 +159,7 @@ class Article extends AuthController
if($res)
return Json::successful('修改图文成功!',$id);
else
- return Json::fail('修改图文失败!',$id);
+ return Json::fail('修改图文失败,您并没有修改什么!',$id);
}else{
$data['add_time'] = time();
$data['admin_id'] = $this->adminId;
diff --git a/application/admin/controller/finance/UserRecharge.php b/application/admin/controller/finance/UserRecharge.php
index d122d5c6..35945433 100644
--- a/application/admin/controller/finance/UserRecharge.php
+++ b/application/admin/controller/finance/UserRecharge.php
@@ -2,7 +2,7 @@
namespace app\admin\controller\finance;
use app\admin\controller\AuthController;
use app\admin\model\user\UserRecharge as UserRechargeModel;
-use app\wap\model\user\UserBill;
+use app\core\model\user\UserBill;
use service\UtilService as Util;
use service\JsonService as Json;
use think\Url;
@@ -10,7 +10,7 @@ use service\FormBuilder as Form;
use think\Request;
use service\HookService;
use behavior\wechat\PaymentBehavior;
-use service\WechatTemplateService;
+use app\core\util\WechatTemplateService;
use app\wap\model\user\WechatUser as WechatUserWap;
/**
* 微信充值记录
@@ -69,6 +69,8 @@ class UserRecharge extends AuthController
if($bj < 0) return Json::fail('退款金额大于支付金额,请修改退款金额');
$refund_data['pay_price'] = $UserRecharge['price'];
$refund_data['refund_price'] = $refund_price;
+// $refund_data['refund_account']='REFUND_SOURCE_RECHARGE_FUNDS';
+
try{
HookService::listen('user_recharge_refund',$UserRecharge['order_id'],$refund_data,true,PaymentBehavior::class);
}catch(\Exception $e){
diff --git a/application/admin/controller/order/StoreOrder.php b/application/admin/controller/order/StoreOrder.php
index 9d98c0f5..75cf6f83 100644
--- a/application/admin/controller/order/StoreOrder.php
+++ b/application/admin/controller/order/StoreOrder.php
@@ -20,7 +20,7 @@ use EasyWeChat\Core\Exception;
use service\CacheService;
use service\HookService;
use service\JsonService;
-use service\SystemConfigService;
+use app\core\util\SystemConfigService;
use service\UtilService as Util;
use service\JsonService as Json;
use think\Db;
@@ -39,7 +39,6 @@ class StoreOrder extends AuthController
*/
public function index()
{
- $config = SystemConfigService::more(['pay_routine_appid','pay_routine_appsecret','pay_routine_mchid','pay_routine_key','pay_routine_client_cert','pay_routine_client_key']);
$this->assign([
'year'=>getMonth('y'),
'real_name'=>$this->request->get('real_name',''),
@@ -376,6 +375,7 @@ class StoreOrder extends AuthController
if($data['type'] == 1) StorePink::setRefundPink($id);
HookService::afterListen('store_product_order_refund_y',$data,$id,false,OrderBehavior::class);
StoreOrderStatus::setStatus($id,'refund_price','退款给用户'.$refund_price.'元');
+ ModelBasic::commitTrans();
return Json::successful('修改成功!');
}else{
StoreOrderStatus::setStatus($id,'refund_price','退款给用户'.$refund_price.'元失败');
diff --git a/application/admin/controller/setting/SystemGroupData.php b/application/admin/controller/setting/SystemGroupData.php
index 4dcd0dca..931da8fd 100644
--- a/application/admin/controller/setting/SystemGroupData.php
+++ b/application/admin/controller/setting/SystemGroupData.php
@@ -53,13 +53,14 @@ class SystemGroupData extends AuthController
if(is_array($params) && !empty($params)){
foreach ($params as $index => $v) {
$vl = explode('=>',$v);
- if(isset($vl[0]) && isset($vl[1]) && count($vl)){
+ if(isset($vl[0]) && isset($vl[1])){
$info[$index]["value"] = $vl[0];
$info[$index]["label"] = $vl[1];
}
}
}
}
+
switch ($value["type"]){
case 'input':
$f[] = Form::input($value["title"],$value["name"]);
@@ -108,23 +109,17 @@ class SystemGroupData extends AuthController
foreach ($params as $key => $param) {
foreach ($Fields['fields'] as $index => $field) {
if($key == $field["title"]){
- if($field['type'] == 'radio'){
- $radioParam = explode("\n",$field["param"]);
- if(is_array($radioParam) && !empty($radioParam)){
- foreach ($radioParam as $radioIndex => &$radioItem) {
- $radioItemCut = explode('=>',$radioItem);
- if(isset($radioItemCut[0]) && isset($radioItemCut[1]) && $radioItemCut[0] == $param) $param = $radioItemCut[1];
- }
- }
- }
- if($param == "") return Json::fail($field["name"]."不能为空!");
- else{
- $value[$key]["type"] = $field["type"];
- $value[$key]["value"] = $param;
- }
+// if($param == "" || count($param) == 0)
+ if($param == "")
+ return Json::fail($field["name"]."不能为空!");
+ else{
+ $value[$key]["type"] = $field["type"];
+ $value[$key]["value"] = $param;
+ }
}
}
}
+
$data = array("gid"=>$gid,"add_time"=>time(),"value"=>json_encode($value),"sort"=>$params["sort"],"status"=>$params["status"]);
GroupDataModel::set($data);
return Json::successful('添加数据成功!');
@@ -168,19 +163,7 @@ class SystemGroupData extends AuthController
}
}
}
- if(isset($value['type']) && $value['type'] == 'radio'){
- if(count($info)){
- foreach ($info as $radioKey=>&$radioItem){
- if(is_array($radioItem) &&
- count($radioItem) == 2 &&
- isset($GroupDataValue[$value['title']]['value']) &&
- strlen(trim($GroupDataValue[$value['title']]['value'])) &&
- $radioItem['label'] === $GroupDataValue[$value['title']]['value']){
- $fvalue = $radioItem['value'];
- }
- }
- }
- }else $fvalue = isset($GroupDataValue[$value['title']]['value'])?$GroupDataValue[$value['title']]['value']:'';
+ $fvalue = isset($GroupDataValue[$value['title']]['value'])?$GroupDataValue[$value['title']]['value']:'';
switch ($value['type']){
case 'input':
$f[] = Form::input($value['title'],$value['name'],$fvalue);
@@ -238,15 +221,6 @@ class SystemGroupData extends AuthController
foreach ($params as $key => $param) {
foreach ($Fields['fields'] as $index => $field) {
if($key == $field["title"]){
- if($field['type'] == 'radio'){
- $radioParam = explode("\n",$field["param"]);
- if(is_array($radioParam) && !empty($radioParam)){
- foreach ($radioParam as $radioIndex => &$radioItem) {
- $radioItemCut = explode('=>',$radioItem);
- if(isset($radioItemCut[0]) && isset($radioItemCut[1]) && $radioItemCut[0] == $param) $param = $radioItemCut[1];
- }
- }
- }
if(!$param)
return Json::fail($field["name"]."不能为空!");
else{
diff --git a/application/admin/controller/store/StoreProduct.php b/application/admin/controller/store/StoreProduct.php
index 8cb6829c..c120501a 100644
--- a/application/admin/controller/store/StoreProduct.php
+++ b/application/admin/controller/store/StoreProduct.php
@@ -9,6 +9,7 @@ use app\admin\model\store\StoreProductAttrResult;
use app\admin\model\store\StoreProductRelation;
use app\admin\model\system\SystemConfig;
use service\JsonService;
+use think\Db;
use traits\CurdControllerTrait;
use service\UtilService as Util;
use service\JsonService as Json;
@@ -218,6 +219,7 @@ class StoreProduct extends AuthController
['is_postage',0],
],$request);
if(count($data['cate_id']) < 1) return Json::fail('请选择产品分类');
+ $cate_id=$data['cate_id'];
$data['cate_id'] = implode(',',$data['cate_id']);
if(!$data['store_name']) return Json::fail('请输入产品名称');
if(count($data['image'])<1) return Json::fail('请上传产品图片');
@@ -229,7 +231,10 @@ class StoreProduct extends AuthController
$data['slider_image'] = json_encode($data['slider_image']);
$data['add_time'] = time();
$data['description'] = '';
- ProductModel::set($data);
+ $res=ProductModel::set($data);
+ foreach ($cate_id as $cid){
+ Db::name('store_product_cate')->insert(['product_id'=>$res['id'],'cate_id'=>$cid,'add_time'=>time()]);
+ }
return Json::successful('添加产品成功!');
}
@@ -271,7 +276,7 @@ class StoreProduct extends AuthController
Form::input('keyword','产品关键字',$product->getData('keyword'))->placeholder('多个用英文状态下的逗号隔开'),
Form::input('unit_name','产品单位',$product->getData('unit_name')),
Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')),$product->getData('image'))->icon('image')->width('100%')->height('500px'),
- Form::frameImages('slider_image','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'slider_image')),json_decode($product->getData('slider_image'),1))->maxLength(5)->icon('images')->width('100%')->height('500px'),
+ Form::frameImages('slider_image','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'slider_image')),json_decode($product->getData('slider_image'),1) ? : [])->maxLength(5)->icon('images')->width('100%')->height('500px'),
Form::number('price','产品售价',$product->getData('price'))->min(0)->precision(2)->col(8),
Form::number('ot_price','产品市场价',$product->getData('ot_price'))->min(0)->col(8),
Form::number('give_integral','赠送积分',$product->getData('give_integral'))->min(0)->precision(0)->col(8),
@@ -329,6 +334,7 @@ class StoreProduct extends AuthController
['is_postage',0],
],$request);
if(count($data['cate_id']) < 1) return Json::fail('请选择产品分类');
+ $cate_id=$data['cate_id'];
$data['cate_id'] = implode(',',$data['cate_id']);
if(!$data['store_name']) return Json::fail('请输入产品名称');
if(count($data['image'])<1) return Json::fail('请上传产品图片');
@@ -340,6 +346,10 @@ class StoreProduct extends AuthController
$data['image'] = $data['image'][0];
$data['slider_image'] = json_encode($data['slider_image']);
ProductModel::edit($data,$id);
+ Db::name('store_product_cate')->where('product_id',$id)->delete();
+ foreach ($cate_id as $cid){
+ Db::name('store_product_cate')->insert(['product_id'=>$id,'cate_id'=>$cid,'add_time'=>time()]);
+ }
return Json::successful('修改成功!');
}
diff --git a/application/admin/controller/store/StoreProductReply.php b/application/admin/controller/store/StoreProductReply.php
index 2dfe1c89..f5daaa6b 100644
--- a/application/admin/controller/store/StoreProductReply.php
+++ b/application/admin/controller/store/StoreProductReply.php
@@ -3,6 +3,8 @@
namespace app\admin\controller\store;
use app\admin\controller\AuthController;
+use service\JsonService;
+use service\UtilService;
use traits\CurdControllerTrait;
use service\UtilService as Util;
use service\JsonService as Json;
@@ -38,10 +40,34 @@ class StoreProductReply extends AuthController
else
$where['product_id'] = 0;
$this->assign('where',$where);
+ $this->assign('is_layui',true);
$this->assign(ProductReplyModel::systemPage($where));
return $this->fetch();
}
+ public function get_product_imaes_list()
+ {
+ $where=UtilService::getMore([
+ ['page',1],
+ ['limit',10],
+ ['title',''],
+ ['is_reply',''],
+ ]);
+ return JsonService::successful(ProductReplyModel::getProductImaesList($where));
+ }
+
+ public function get_product_reply_list()
+ {
+ $where=UtilService::getMore([
+ ['limit',10],
+ ['title',''],
+ ['is_reply',''],
+ ['message_page',1],
+ ['producr_id',0],
+ ]);
+ return JsonService::successful(ProductReplyModel::getProductReplyList($where));
+ }
+
/**
* @param $id
* @return \think\response\Json|void
diff --git a/application/admin/controller/system/SystemAttachment.php b/application/admin/controller/system/SystemAttachment.php
index 9df3fee0..cae82ff1 100755
--- a/application/admin/controller/system/SystemAttachment.php
+++ b/application/admin/controller/system/SystemAttachment.php
@@ -21,9 +21,6 @@ class SystemAttachment extends AuthController
public function upload()
{
$res = Upload::image('upfile','editor/'.date('Ymd'));
- if($res->status==false && $res->error){
- exit(json_encode(['state'=>$res->error]));
- }
//产品图片上传记录
$fileInfo = $res->fileInfo->getinfo();
$thumbPath = Upload::thumb($res->dir);
diff --git a/application/admin/controller/system/SystemCleardata.php b/application/admin/controller/system/SystemCleardata.php
index fddfee52..dbd629b7 100644
--- a/application/admin/controller/system/SystemCleardata.php
+++ b/application/admin/controller/system/SystemCleardata.php
@@ -44,6 +44,11 @@ class SystemclearData extends AuthController
self::clearData('store_product_reply',1);
self::clearData('routine_qrcode',1);
self::clearData('routine_form_id',1);
+ self::clearData('user_sign',1);
+ self::clearData('user_task_finish',1);
+ self::clearData('user_level',1);
+ self::clearData('token',1);
+ self::clearData('user_group',1);
$this->delDirAndFile('./public/uploads/store/comment');
self::clearData('store_product_relation',1);
return Json::successful('清除数据成功!');
@@ -103,8 +108,7 @@ class SystemclearData extends AuthController
public function uploadData(){
self::clearData('system_attachment',1);
self::clearData('system_attachment_category',1);
- $this->delDirAndFile('./public/uploads/attach/');
- $this->delDirAndFile('./public/uploads/editor/');
+ $this->delDirAndFile('./public/uploads/');
return Json::successful('清除上传文件成功!');
}
//清除微信用户
diff --git a/application/admin/controller/system/SystemDatabackup.php b/application/admin/controller/system/SystemDatabackup.php
index a5d1c7c7..36ba5f71 100644
--- a/application/admin/controller/system/SystemDatabackup.php
+++ b/application/admin/controller/system/SystemDatabackup.php
@@ -19,7 +19,7 @@ class SystemDatabackup extends AuthController
public function _initialize()
{
$config = array(
- 'path' => '.'.PUBILC_PATH.'/backup/data/',
+ 'path' => '.'.PUBILC_PATH.'backup/data/',
//数据库备份路径
'part' => 20971520,
//数据库备份卷大小
diff --git a/application/admin/controller/ump/StoreCoupon.php b/application/admin/controller/ump/StoreCoupon.php
index a0c4aa9b..ca22bf17 100644
--- a/application/admin/controller/ump/StoreCoupon.php
+++ b/application/admin/controller/ump/StoreCoupon.php
@@ -42,14 +42,14 @@ class StoreCoupon extends AuthController
public function create()
{
$f = array();
- $f[] = Form::input('title','优惠券名称')->required();
+ $f[] = Form::input('title','优惠券名称');
$f[] = Form::number('coupon_price','优惠券面值',0)->min(0);
$f[] = Form::number('use_min_price','优惠券最低消费')->min(0);
$f[] = Form::number('coupon_time','优惠券有效期限')->min(0);
$f[] = Form::number('sort','排序');
$f[] = Form::radio('status','状态',0)->options([['label'=>'开启','value'=>1],['label'=>'关闭','value'=>0]]);
- $form = Form::make_post_form('添加优惠券',$f,Url::build('save'));//->setSuccessScript('');
+ $form = Form::make_post_form('添加优惠券',$f,Url::build('save'));
$this->assign(compact('form'));
return $this->fetch('public/form-builder');
}
@@ -227,8 +227,8 @@ class StoreCoupon extends AuthController
public function update_issue(Request $request,$id)
{
- list($_id,$rangeTime,$count,$status) = UtilService::postMore([
- 'id',['range_date',['','']],['count',0],['status',0]
+ list($_id,$rangeTime,$count,$status,$is_permanent) = UtilService::postMore([
+ 'id',['range_date',['','']],['count',0],['status',0],['is_permanent',0]
],$request,true);
if($_id != $id) return JsonService::fail('操作失败,信息不对称');
if(!$count) $count = 0;
@@ -241,7 +241,7 @@ class StoreCoupon extends AuthController
if(!$endTime) $endTime = 0;
if(!$startTime && $endTime) return JsonService::fail('请选择正确的开始时间');
if($startTime && !$endTime) return JsonService::fail('请选择正确的结束时间');
- if(StoreCouponIssue::setIssue($id,$count,strtotime($startTime),strtotime($endTime),$count,$status))
+ if(StoreCouponIssue::setIssue($id,$count,strtotime($startTime),strtotime($endTime),$count,$status,$is_permanent))
return JsonService::successful('发布优惠劵成功!');
else
return JsonService::fail('发布优惠劵失败!');
diff --git a/application/admin/controller/ump/UserPoint.php b/application/admin/controller/ump/UserPoint.php
index d2b2632d..2394a73b 100644
--- a/application/admin/controller/ump/UserPoint.php
+++ b/application/admin/controller/ump/UserPoint.php
@@ -23,6 +23,9 @@ class UserPoint extends AuthController
public function index()
{
$this->assign([
+// 'sum_point'=>UserBill::where(['category'=>'integral','type'=>'system_add'])->sum('number'),
+// 'count'=>UserBill::where(['category'=>'integral','type'=>'sign'])->group('uid')->count(),
+// 'song_point'=>UserBill::where(['category'=>'integral','type'=>'sign'])->group('uid')->sum('number'),
'is_layui'=>true,
'year'=>getMonth('y'),
]);
diff --git a/application/admin/controller/wechat/Menus.php b/application/admin/controller/wechat/Menus.php
index 9ba7298b..eec0e9ab 100644
--- a/application/admin/controller/wechat/Menus.php
+++ b/application/admin/controller/wechat/Menus.php
@@ -2,7 +2,7 @@
namespace app\admin\controller\wechat;
use app\admin\controller\AuthController;
-use service\WechatService;
+use app\core\util\WechatService;
use think\Cache;
use think\Db;
use think\Request;
diff --git a/application/admin/controller/wechat/Reply.php b/application/admin/controller/wechat/Reply.php
index 9ab04280..9e0af259 100644
--- a/application/admin/controller/wechat/Reply.php
+++ b/application/admin/controller/wechat/Reply.php
@@ -35,6 +35,7 @@ class Reply extends AuthController
$title = '编辑关键字回复';
break;
}
+
$replay = WechatReply::getDataByKey($key);
$this->assign('replay_arr',json_encode($replay));
$this->assign('key',$key);
diff --git a/application/admin/controller/wechat/WechatNewsCategory.php b/application/admin/controller/wechat/WechatNewsCategory.php
index f97e07a5..7c1eb11a 100644
--- a/application/admin/controller/wechat/WechatNewsCategory.php
+++ b/application/admin/controller/wechat/WechatNewsCategory.php
@@ -14,7 +14,7 @@ use service\UtilService;
use think\Db;
use think\Request;
use think\Url;
-use service\WechatService;
+use app\core\util\WechatService;
use \app\admin\model\wechat\WechatNewsCategory as WechatNewsCategoryModel;
use app\admin\model\article\Article as ArticleModel;
/**
@@ -235,8 +235,8 @@ class WechatNewsCategory extends AuthController
if($v['author'] == '') return JsonService::fail('作者不能为空');
if($v['content'] == '') return JsonService::fail('正文不能为空');
if($v['synopsis'] == '') return JsonService::fail('摘要不能为空');
- $v['add_time'] = time();
$v['status'] = 1;
+ $v['add_time'] = time();
if($v['id']){
$idC = $v['id'];
unset($v['id']);
diff --git a/application/admin/controller/wechat/WechatTemplate.php b/application/admin/controller/wechat/WechatTemplate.php
index 67948778..addc1126 100644
--- a/application/admin/controller/wechat/WechatTemplate.php
+++ b/application/admin/controller/wechat/WechatTemplate.php
@@ -6,7 +6,7 @@ use app\admin\controller\AuthController;
use service\FormBuilder as Form;
use service\UtilService as Util;
use service\JsonService as Json;
-use service\WechatTemplateService;
+use app\core\util\WechatTemplateService;
use think\Cache;
use think\Request;
use think\Url;
diff --git a/application/admin/controller/wechat/WechatUser.php b/application/admin/controller/wechat/WechatUser.php
index ad173946..d0b288dd 100644
--- a/application/admin/controller/wechat/WechatUser.php
+++ b/application/admin/controller/wechat/WechatUser.php
@@ -6,10 +6,10 @@ use app\admin\controller\AuthController;
use service\FormBuilder as Form;
use app\admin\model\user\User;
use app\admin\model\wechat\WechatUser as UserModel;
-use app\wap\model\user\UserBill;
+use app\core\model\user\UserBill;
use service\JsonService;
use service\UtilService as Util;
-use service\WechatService;
+use app\core\util\WechatService;
use think\Collection;
use think\Request;
use think\Url;
@@ -50,11 +50,18 @@ class WechatUser extends AuthController
}
$tagidList = array_unique($tagidList);
$where['tagid_list'] = implode(',',$tagidList);
+ try{
+ $groupList=UserModel::getUserGroup();
+ $tagList=UserModel::getUserTag();
+ }catch (\Exception $e){
+ $groupList=[];
+ $tagList=[];
+ }
$this->assign([
- 'where'=>$where,
- 'groupList'=>UserModel::getUserGroup(),
- 'tagList'=>UserModel::getUserTag()
- ]);
+ 'where'=>$where,
+ 'groupList'=>$groupList,
+ 'tagList'=>$tagList
+ ]);
$limitTimeList = [
'today'=>implode(' - ',[date('Y/m/d'),date('Y/m/d',strtotime('+1 day'))]),
'week'=>implode(' - ',[
@@ -150,11 +157,14 @@ class WechatUser extends AuthController
*/
public function tag($refresh = 0)
{
+ $list=[];
if($refresh == 1) {
UserModel::clearUserTag();
$this->redirect(Url::build('tag'));
}
- $list = UserModel::getUserTag();
+ try{
+ $list = UserModel::getUserTag();
+ }catch (\Exception $e){}
$this->assign(compact('list'));
return $this->fetch();
}
@@ -243,11 +253,14 @@ class WechatUser extends AuthController
public function group($refresh = 0)
{
+ $list=[];
if($refresh == 1) {
UserModel::clearUserGroup();
$this->redirect(Url::build('group'));
}
- $list = UserModel::getUserGroup();
+ try{
+ $list = UserModel::getUserGroup();
+ }catch (\Exception $e){}
$this->assign(compact('list'));
return $this->fetch();
}
diff --git a/application/admin/model/article/Article.php b/application/admin/model/article/Article.php
index 859ad03d..636bea5a 100644
--- a/application/admin/model/article/Article.php
+++ b/application/admin/model/article/Article.php
@@ -36,14 +36,13 @@ class Article extends ModelBasic {
// if($where['status'] !== '') $model = $model->where('status',$where['status']);
// if($where['access'] !== '') $model = $model->where('access',$where['access']);
if($where['title'] !== '') $model = $model->where('title','LIKE',"%$where[title]%");
- if($where['cid'] !== '') {
-// $model = $model->where("CONCAT(',',cid,',') LIKE '%,$where[cid],%'");
+ if($where['cid'] !== '')
$model = $model->where('cid','in',$where['cid']);
- }
- if($where['cid'] == ''){
- if(!$where['merchant']) $model = $model->where('mer_id',0);
- if($where['merchant']) $model = $model->where('mer_id','GT',0);
- }
+ else
+ if($where['merchant'])
+ $model = $model->where('mer_id','GT',0);
+ else
+ $model = $model->where('mer_id',0);
$model = $model->where('status',1)->where('hide',0);
return self::page($model,function($item){
if(!$item['mer_id']) $item['admin_name'] = '总后台管理员---》'.SystemAdmin::where('id',$item['admin_id'])->value('real_name');
diff --git a/application/admin/model/finance/FinanceModel.php b/application/admin/model/finance/FinanceModel.php
index 0242ce24..8564270d 100644
--- a/application/admin/model/finance/FinanceModel.php
+++ b/application/admin/model/finance/FinanceModel.php
@@ -10,7 +10,7 @@ namespace app\admin\model\finance;
use traits\ModelTrait;
use basic\ModelBasic;
use service\ExportService;
-use app\wap\model\user\UserBill;
+use app\core\model\user\UserBill;
use app\admin\model\user\User;
use service\PHPExcelService;
/*数据统计处理*/
diff --git a/application/admin/model/order/StoreOrder.php b/application/admin/model/order/StoreOrder.php
index d49e90ba..b423eaae 100644
--- a/application/admin/model/order/StoreOrder.php
+++ b/application/admin/model/order/StoreOrder.php
@@ -14,13 +14,12 @@ use app\admin\model\ump\StorePink;
use app\admin\model\order\StoreOrderCartInfo;
use app\admin\model\store\StoreProduct;
use app\admin\model\routine\RoutineFormId;
-use app\routine\model\routine\RoutineTemplate;
+use app\core\model\routine\RoutineTemplate;
use service\ProgramTemplateService;
use service\PHPExcelService;
use traits\ModelTrait;
use basic\ModelBasic;
-use service\WechatTemplateService;
-use service\RoutineTemplateService;
+use app\core\util\WechatTemplateService;
use think\Url;
use think\Db;
use app\admin\model\user\User;
@@ -371,16 +370,14 @@ HTML;
*/
public static function refundRoutineTemplate($oid){
$order = self::where('id',$oid)->find();
- $formId = RoutineFormId::getFormIdOne($order['uid']);
- $data['keyword1']['value'] = $order['order_id'];
- $data['keyword2']['value'] = date('Y-m-d H:i:s',time());
- $data['keyword3']['value'] = $order['pay_price'];
- if($order['pay_type'] == 'yue') $data['keyword4']['value'] = '余额支付';
- else if($order['pay_type'] == 'weixin') $data['keyword4']['value'] = '微信支付';
- else if($order['pay_type'] == 'offline') $data['keyword4']['value'] = '线下支付';
- $data['keyword5']['value'] = '已成功退款';
- RoutineFormId::delFormIdOne($formId);
- return RoutineTemplateService::sendTemplate(WechatUser::uidToRoutineOpenid($order['uid']),RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_REFUND_SUCCESS),'',$data,$formId);
+ $data['keyword1'] = $order['order_id'];
+ $data['keyword2'] = date('Y-m-d H:i:s',time());
+ $data['keyword3'] = $order['pay_price'];
+ if($order['pay_type'] == 'yue') $data['keyword4'] = '余额支付';
+ else if($order['pay_type'] == 'weixin') $data['keyword4'] = '微信支付';
+ else if($order['pay_type'] == 'offline') $data['keyword4'] = '线下支付';
+ $data['keyword5'] = '已成功退款';
+ return RoutineTemplate::sendOut('ORDER_REFUND_SUCCESS',$order['uid'],$data);
}
/**
@@ -520,23 +517,32 @@ HTML;
$price['back_integral'] = 0;//退积分总数
$price['deduction_price'] = 0;//抵扣金额
$price['total_num'] = 0; //商品总数
- $model = self::getOrderWhere($where,$model);
- $list = $model->where('is_del',0)->select()->toArray();
+ $sumNumber =self::getOrderWhere($where,$model)->where('is_del',0)->field([
+ 'sum(total_num) as sum_total_num',
+ 'sum(pay_price) as sum_pay_price',
+ 'sum(refund_price) as sum_refund_price',
+ 'sum(use_integral) as sum_use_integral',
+ 'sum(back_integral) as sum_back_integral',
+ 'sum(deduction_price) as sum_deduction_price'
+ ])->find();
+ if($sumNumber) {
+ $price['total_num'] = $sumNumber['sum_total_num'];
+ $price['pay_price'] = $sumNumber['sum_pay_price'];
+ $price['refund_price'] = $sumNumber['sum_refund_price'];
+ $price['use_integral'] = $sumNumber['sum_use_integral'];
+ $price['back_integral'] = $sumNumber['sum_back_integral'];
+ $price['deduction_price'] = $sumNumber['sum_deduction_price'];
+ }
+ $list=self::getOrderWhere($where,$model)->where('is_del',0)->group('pay_type')->field(['sum(pay_price) as sum_pay_price','pay_type'])->select();
foreach ($list as $v){
- $price['total_num'] = bcadd($price['total_num'],$v['total_num'],0);
- $price['pay_price'] = bcadd($price['pay_price'],$v['pay_price'],2);
- $price['refund_price'] = bcadd($price['refund_price'],$v['refund_price'],2);
- $price['use_integral'] = bcadd($price['use_integral'],$v['use_integral'],2);
- $price['back_integral'] = bcadd($price['back_integral'],$v['back_integral'],2);
- $price['deduction_price'] = bcadd($price['deduction_price'],$v['deduction_price'],2);
if ($v['pay_type'] == 'weixin'){
- $price['pay_price_wx'] = bcadd($price['pay_price_wx'],$v['pay_price'],2);
+ $price['pay_price_wx'] = $v['sum_pay_price'];
}elseif($v['pay_type'] == 'yue'){
- $price['pay_price_yue'] = bcadd($price['pay_price_yue'],$v['pay_price'],2);
+ $price['pay_price_yue'] = $v['sum_pay_price'];
}elseif($v['pay_type'] == 'offline'){
- $price['pay_price_offline'] = bcadd($price['pay_price_offline'],$v['pay_price'],2);
+ $price['pay_price_offline'] = $v['sum_pay_price'];
}else{
- $price['pay_price_other'] = bcadd($price['pay_price_other'],$v['pay_price'],2);
+ $price['pay_price_other'] = $v['sum_pay_price'];
}
}
return $price;
@@ -797,26 +803,6 @@ HTML;
public static function getOrderBadge($where){
return [
- [
- 'name'=>'拼团订单数量',
- 'field'=>'个',
- 'count'=>self::setEchatWhere($where,2)->count(),
- 'content'=>'拼团总订单数量',
- 'background_color'=>'layui-bg-cyan',
- 'sum'=>self::setEchatWhere($where,2,true)->count(),
- 'class'=>'fa fa-line-chart',
- 'col'=>2
- ],
- [
- 'name'=>'砍价订单数量',
- 'field'=>'个',
- 'count'=>self::setEchatWhere($where,4)->count(),
- 'content'=>'砍价总订单数量',
- 'background_color'=>'layui-bg-cyan',
- 'sum'=>self::setEchatWhere($where,4,true)->count(),
- 'class'=>'fa fa-line-chart',
- 'col'=>2
- ],
[
'name'=>'秒杀订单数量',
'field'=>'个',
@@ -926,8 +912,8 @@ HTML;
*/
public static function orderPostageAfter($oid,$postageData = [])
{
+
$order = self::where('id',$oid)->find();
- $openid = WechatUser::uidToOpenid($order['uid']);
$url = Url::build('wap/My/order',['uni'=>$order['order_id']],true,true);
$group = [
'first'=>'亲,您的订单已发货,请注意查收',
@@ -939,6 +925,7 @@ HTML;
//小程序送货模版消息
RoutineTemplate::sendOrderPostage($order);
}else{//公众号
+ $openid = WechatUser::where('uid',$order['uid'])->value('openid');
$group = array_merge($group,[
'keyword1'=>$goodsName,
'keyword2'=>$order['pay_type'] == 'offline' ? '线下支付' : date('Y/m/d H:i',$order['pay_time']),
@@ -951,8 +938,9 @@ HTML;
}else if($postageData['delivery_type'] == 'express') {//发货
if ($order['is_channel']) {
//小程序发货模版消息
- RoutineTemplate::sendOrderPostage($order);
+ RoutineTemplate::sendOrderPostage($order,1);
} else {//公众号
+ $openid = WechatUser::where('uid',$order['uid'])->value('openid');
$group = array_merge($group, [
'keyword1' => $order['order_id'],
'keyword2' => $postageData['delivery_name'],
@@ -961,6 +949,7 @@ HTML;
WechatTemplateService::sendTemplate($openid, WechatTemplateService::ORDER_POSTAGE_SUCCESS, $group, $url);
}
}
+
}
/**
* 小程序 订单发货提醒
@@ -974,38 +963,76 @@ HTML;
$routine_openid = WechatUser::uidToRoutineOpenid($order['uid']);
if(!$routine_openid) return true;
if($postageData['delivery_type'] == 'send'){//送货
- $data['keyword1']['value'] = $order['order_id'];
- $data['keyword2']['value'] = $order['delivery_name'];
- $data['keyword3']['value'] = $order['delivery_id'];
- $data['keyword4']['value'] = date('Y-m-d H:i:s',time());
- $data['keyword5']['value'] = '您的商品已经发货请注意查收';
- $formId = RoutineFormId::getFormIdOne($order['uid']);
- if($formId){
- RoutineFormId::delFormIdOne($formId);
- RoutineTemplateService::sendTemplate($routine_openid,
- RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_DELIVER_SUCCESS),
- '',
- $data,
- $formId);
- }
+ RoutineTemplate::sendOrderPostage($order);
}else if($postageData['delivery_type'] == 'express'){//发货
- $data['keyword1']['value'] = $order['order_id'];
- $data['keyword2']['value'] = $order['delivery_name'];
- $data['keyword3']['value'] = $order['delivery_id'];
- $data['keyword4']['value'] = date('Y-m-d H:i:s',time());
- $data['keyword5']['value'] = '您的商品已经发货请注意查收';
- $formId = RoutineFormId::getFormIdOne($order['uid']);
- if($formId){
- RoutineFormId::delFormIdOne($formId);
- RoutineTemplateService::sendTemplate($routine_openid,
- RoutineTemplateService::setTemplateId(RoutineTemplateService::ORDER_POSTAGE_SUCCESS),
- '',
- $data,
- $formId);
- }
+ RoutineTemplate::sendOrderPostage($order,1);
}
}
+ /** 收货后发送模版消息
+ * @param $order
+ */
+ public static function orderTakeAfter($order)
+ {
+ if($order['is_channel']){//小程序
+ RoutineTemplate::sendOut('OREDER_TAKEVER',$order['uid'],[
+ 'keyword1'=>$order['order_id'],
+ 'keyword2'=>self::getDb('store_cart')->alias('a')->join('__STORE_PRODUCT__ P','a.product_id=p.id')->where('a.id','in',$order['cart_id'])->value('p.title'),
+ 'keyword3'=>$order['pay_price'],
+ 'keyword4'=>date('Y-m-d H:i:s',time()),
+ ]);
+ }else{
+ $openid = WechatUser::where('uid',$order['uid'])->value('openid');
+ $title='';
+ $cartInfo = self::getDb('StoreOrderCartInfo')->where('oid', $order['id'])->column('product_id') ?: [];
+ foreach ($cartInfo as $k => $productId) {
+ $store_name=self::getDb('store_product')->where('id',$productId)->value('store_name');
+ $title.=$store_name.',';
+ }
+ WechatTemplateService::sendTemplate($openid,WechatTemplateService::ORDER_TAKE_SUCCESS,[
+ 'first'=>'亲,您的订单已收货',
+ 'keyword1'=>$order['order_id'],
+ 'keyword2'=>'已收货',
+ 'keyword3'=>date('Y-m-d H:i:s',time()),
+ 'keyword4'=>$title,
+ 'remark'=>'感谢您的光临!'
+ ]);
+ }
+ }
+
+ /*
+ * 不退款发送模板消息
+ * @param int $id 订单id
+ * @param array $data 退款详情
+ * */
+ public static function refundNoPrieTemplate($id,$data)
+ {
+ $order=self::get($id);
+ if($order) return false;
+ //小程序模板消息
+ $cartInfo = self::getDb('StoreOrderCartInfo')->where('oid', $order['id'])->column('product_id') ?: [];
+ $title='';
+ foreach ($cartInfo as $k => $productId) {
+ $store_name=self::getDb('store_product')->where('id',$productId)->value('store_name');
+ $title.=$store_name.',';
+ }
+ if($order->is_channel){
+ RoutineTemplate::sendOut('ORDER_REFUND_FILE',$order->uid,[
+ 'keyword1'=>$order->order_id,
+ 'keyword2'=>$title,
+ 'keyword3'=>$order->pay_price,
+ 'keyword4'=>$data,
+ ]);
+ }else{
+ WechatTemplateService::sendTemplate(WechatUser::where(['uid'=>$order->uid])->value('openid'),WechatTemplateService::ORDER_REFUND_STATUS,[
+ 'first'=>'很抱歉您的订单退款失败,失败原因:'.$data,
+ 'keyword1'=>$order->order_id,
+ 'keyword2'=>$order->pay_price,
+ 'keyword3'=>date('Y-m-d H:i:s',time()),
+ 'remark'=>'给您带来的不便,请谅解!'
+ ]);
+ }
+ }
/**
* 获取订单总数
@@ -1052,27 +1079,6 @@ HTML;
return true;
}
- /** 收货后发送模版消息
- * @param $order
- */
- public static function orderTakeAfter($order)
- {
- if($order['is_channel']){//小程序
-
- }else{
-
- }
-// $openid = WechatUser::getOpenId($order['uid']);
-// RoutineTemplateService::sendTemplate($openid,RoutineTemplateService::ORDER_TAKE_SUCCESS,[
-// 'first'=>'亲,您的订单已成功签收,快去评价一下吧',
-// 'keyword1'=>$order['order_id'],
-// 'keyword2'=>'已收货',
-// 'keyword3'=>date('Y/m/d H:i',time()),
-// 'keyword4'=>implode(',',StoreOrderCartInfo::getProductNameList($order['id'])),
-// 'remark'=>'点击查看订单详情'
-// ],Url::build('My/order',['uni'=>$order['order_id']],true,true));
- }
-
public static function integralBack($id){
$order = self::get($id)->toArray();
if(!(float)bcsub($order['use_integral'],0,2) && !$order['back_integral']) return true;
diff --git a/application/admin/model/record/StoreStatistics.php b/application/admin/model/record/StoreStatistics.php
index be4bf00f..d7f0b417 100644
--- a/application/admin/model/record/StoreStatistics.php
+++ b/application/admin/model/record/StoreStatistics.php
@@ -10,7 +10,7 @@ namespace app\admin\model\record;
use traits\ModelTrait;
use basic\ModelBasic;
use service\ExportService;
-use app\wap\model\user\UserBill;
+use app\core\model\user\UserBill;
use app\admin\model\user\User;
use service\PHPExcelService;
class StoreStatistics extends ModelBasic
diff --git a/application/admin/model/routine/RoutineFormId.php b/application/admin/model/routine/RoutineFormId.php
index 9a72b78c..ff06e250 100644
--- a/application/admin/model/routine/RoutineFormId.php
+++ b/application/admin/model/routine/RoutineFormId.php
@@ -7,7 +7,7 @@ use traits\ModelTrait;
/**
* 表单ID表
* Class RoutineFormId
- * @package app\routine\model\routine
+ * @package app\admin\model\routine
*/
class RoutineFormId extends ModelBasic {
diff --git a/application/admin/model/store/StoreCategory.php b/application/admin/model/store/StoreCategory.php
index 7a4e13e2..1ae82c20 100644
--- a/application/admin/model/store/StoreCategory.php
+++ b/application/admin/model/store/StoreCategory.php
@@ -49,6 +49,8 @@ class StoreCategory extends ModelBasic
if($isAjax===true){
if(isset($where['order']) && $where['order']!=''){
$model=$model->order(self::setOrder($where['order']));
+ }else{
+ $model=$model->order('sort desc,id desc');
}
return $model;
}
@@ -78,7 +80,7 @@ class StoreCategory extends ModelBasic
public static function getTierList($model = null)
{
if($model === null) $model = new self();
- return UtilService::sortListTier($model->select()->toArray());
+ return UtilService::sortListTier($model->order('sort desc,id desc')->select()->toArray());
}
public static function delCategory($id){
diff --git a/application/admin/model/store/StoreProductAttrValue.php b/application/admin/model/store/StoreProductAttrValue.php
index f50877f1..9e92f88e 100644
--- a/application/admin/model/store/StoreProductAttrValue.php
+++ b/application/admin/model/store/StoreProductAttrValue.php
@@ -28,6 +28,14 @@ class StoreProductAttrValue extends ModelBasic
return self::uniqueId($data['product_id'].$data['suk'].uniqid(true));
}
+ /*
+ * 减少销量增加库存
+ * */
+ public static function incProductAttrStock($productId,$unique,$num)
+ {
+ return false !== self::where('product_id',$productId)->where('unique',$unique)->inc('stock',$num)->dec('sales',$num)->update();
+ }
+
public static function decProductAttrStock($productId,$unique,$num)
{
return false !== self::where('product_id',$productId)->where('unique',$unique)
diff --git a/application/admin/model/store/StoreProductReply.php b/application/admin/model/store/StoreProductReply.php
index c89ca7e2..012e9324 100644
--- a/application/admin/model/store/StoreProductReply.php
+++ b/application/admin/model/store/StoreProductReply.php
@@ -23,6 +23,51 @@ class StoreProductReply extends ModelBasic
{
return json_decode($value,true);
}
+ /*
+ * 设置where条件
+ * @param array $where
+ * @param string $alias
+ * @param object $model
+ * */
+ public static function valiWhere($where,$alias='',$model=null)
+ {
+ $model=is_null($model) ? new self() : $model;
+ if($alias){
+ $model=$model->alias($alias);
+ $alias.='.';
+ }
+ if(isset($where['title']) && $where['title']!='') $model=$model->where("{$alias}comment",'LIKE',"%$where[title]%");
+ if(isset($where['is_reply']) && $where['is_reply']!='') $model= $where['is_reply'] >= 0 ? $model->where("{$alias}is_reply",$where['is_reply']) : $model->where("{$alias}is_reply",'GT',0);
+ if(isset($where['producr_id']) && $where['producr_id']!=0) $model=$model->where('product_id',$where['producr_id']);
+ return $model->where("{$alias}is_del",0);
+ }
+
+ public static function getProductImaesList($where)
+ {
+ $list=self::valiWhere($where,'a')->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=count($list) ? $list->toArray() : [];
+ foreach ($list as &$item){
+ $item['store_name']=self::getSubstrUTf8($item['store_name'],10,'UTF-8','');
+ }
+
+ return $list;
+ }
+
+ public static function getProductReplyList($where)
+ {
+ $data=self::valiWhere($where,'a')->join("__STORE_PRODUCT__ p",'a.product_id=p.id')
+ ->join('__WECHAT_USER__ u','u.uid=a.uid')
+ ->order('a.add_time desc,a.is_reply asc')
+ ->field('a.*,u.nickname,u.headimgurl as avatar')
+ ->page((int)$where['message_page'],(int)$where['limit'])
+ ->select();
+ $data=count($data) ? $data->toArray() : [];
+ foreach ($data as &$item){
+ $item['time']=\service\UtilService::timeTran($item['add_time']);
+ }
+ $count=self::valiWhere($where,'a')->join('__WECHAT_USER__ u','u.uid=a.uid')->join("__STORE_PRODUCT__ p",'a.product_id=p.id')->count();
+ return ['list'=>$data,'count'=>$count];
+ }
/**
* @param $where
* @return array
diff --git a/application/admin/model/system/Express.php b/application/admin/model/system/Express.php
index 4efe2238..dfd77f4e 100644
--- a/application/admin/model/system/Express.php
+++ b/application/admin/model/system/Express.php
@@ -11,7 +11,7 @@ use traits\ModelTrait;
use basic\ModelBasic;
/**
- * Class SystemAdmin
+ * Class Express
* @package app\admin\model\system
*/
class Express extends ModelBasic
diff --git a/application/admin/model/system/SystemConfig.php b/application/admin/model/system/SystemConfig.php
index 09cc2cb3..a6d73287 100644
--- a/application/admin/model/system/SystemConfig.php
+++ b/application/admin/model/system/SystemConfig.php
@@ -157,7 +157,7 @@ class SystemConfig extends ModelBasic {
* */
public static function getAll($id){
$where['config_tab_id'] = $id;
- $where['status'] = 1;
+// $where['status'] = 1;
return self::where($where)->order('sort desc,id asc')->select();
}
diff --git a/application/admin/model/system/SystemGroupData.php b/application/admin/model/system/SystemGroupData.php
index 90873258..1bb74912 100644
--- a/application/admin/model/system/SystemGroupData.php
+++ b/application/admin/model/system/SystemGroupData.php
@@ -75,14 +75,12 @@ class SystemGroupData extends ModelBasic
$data = [];
$result = $model->select();
if(!$result) return $data;
- $result = $result->toArray();
foreach ($result as $key => $value) {
$data[$key]["id"] = $value["id"];
$fields = json_decode($value["value"],true);
foreach ($fields as $index => $field) {
- if($field['type'] === 'radio') {
- $data[$key][$index] = self::getGroupRadioValue($value['gid'],$field["value"]);
- }else $data[$key][$index] = $field["value"];
+// $data[$key][$index] = $field['type'] == 'upload' ? (isset($field["value"][0]) ? $field["value"][0]: ''):$field["value"];
+ $data[$key][$index] = $field["value"];
}
}
return $data;
@@ -113,32 +111,8 @@ class SystemGroupData extends ModelBasic
$data["id"] = $value["id"];
$fields = json_decode($value["value"],true);
foreach ($fields as $index => $field) {
- if($field['type'] === 'radio') {
- $data[$index] = self::getGroupRadioValue($value['gid'],$field["value"]);
- }else $data[$index] = $field["value"];
+ $data[$index] = $field["value"];
}
return $data;
}
-
- /**
- * TODO radio 根据值获取参数
- * @param $id
- * @param $value
- * @return mixed
- */
- public static function getGroupRadioValue($id,$value){
- $groupData = SystemGroup::getField($id);
- foreach ($groupData['fields'] as $key=>&$item){
- if($item['type'] == 'radio'){
- $params = explode("\n",$item["param"]);
- if(is_array($params) && !empty($params)){
- foreach ($params as $index => &$v) {
- $vl = explode('=>',$v);
- if(isset($vl[0]) && isset($vl[1]) && count($vl) && $vl[1] === $value) return $vl[0];
- }
- }
- }
- }
- return $value;
- }
}
\ No newline at end of file
diff --git a/application/admin/model/ump/StoreCouponIssue.php b/application/admin/model/ump/StoreCouponIssue.php
index 2b01ec81..09b4ef98 100644
--- a/application/admin/model/ump/StoreCouponIssue.php
+++ b/application/admin/model/ump/StoreCouponIssue.php
@@ -33,8 +33,8 @@ class StoreCouponIssue extends ModelBasic
return time();
}
- public static function setIssue($cid,$total_count = 0,$start_time = 0,$end_time = 0,$remain_count = 0,$status = 0)
+ public static function setIssue($cid,$total_count = 0,$start_time = 0,$end_time = 0,$remain_count = 0,$status = 0,$is_permanent=0)
{
- return self::set(compact('cid','start_time','end_time','total_count','remain_count','status'));
+ return self::set(compact('cid','start_time','end_time','total_count','remain_count','status','is_permanent'));
}
}
\ No newline at end of file
diff --git a/application/admin/model/user/User.php b/application/admin/model/user/User.php
index d7ec24a4..4db21684 100644
--- a/application/admin/model/user/User.php
+++ b/application/admin/model/user/User.php
@@ -6,13 +6,14 @@
*/
namespace app\admin\model\user;
use app\admin\model\order\StoreOrder;
+use app\admin\model\system\SystemUserLevel;
use traits\ModelTrait;
use app\admin\model\user\UserBill;
use basic\ModelBasic;
use app\admin\model\wechat\WechatUser;
use app\admin\model\store\StoreCouponUser;
use app\admin\model\user\UserExtract;
-use service\SystemConfigService;
+use app\core\util\SystemConfigService;
use think\Db;
/**
* 用户管理 model
@@ -115,6 +116,12 @@ class User extends ModelBasic
}else if($item['sex'] == 2){
$item['sex']='女';
}else $item['sex']='保密';
+ $item['vip_name']=false;
+ $levelinfo=UserLevel::where(['uid'=>$item['uid'],'is_del'=>0])->order('grade desc')->field(['level_id','is_forever','valid_time'])->find();
+ if($levelinfo){
+ if($levelinfo['is_forever']) $item['vip_name']=SystemUserLevel::where('id',$levelinfo['level_id'])->value('name');
+ else if(time() > $levelinfo['valid_time']) $item['vip_name']=SystemUserLevel::where('id',$levelinfo['level_id'])->value('name');
+ }
});//->toArray();
$count=self::setWherePage(self::setWhere($where),$where,['w.sex','w.province','w.city','u.status','u.is_promoter'],['u.nickname','u.uid'])->alias('u')->join('WechatUser w','u.uid=w.uid')->count();
return ['count'=>$count,'data'=>$list];
diff --git a/application/admin/model/user/UserExtract.php b/application/admin/model/user/UserExtract.php
index cafe2598..d1475e04 100644
--- a/application/admin/model/user/UserExtract.php
+++ b/application/admin/model/user/UserExtract.php
@@ -14,7 +14,7 @@ use app\admin\model\wechat\WechatUser;
use think\Url;
use traits\ModelTrait;
use basic\ModelBasic;
-use service\WechatTemplateService;
+use app\core\util\WechatTemplateService;
/**
* 用户提现管理 model
* Class User
diff --git a/application/admin/model/user/UserRecharge.php b/application/admin/model/user/UserRecharge.php
index 45cf73d4..596eb675 100644
--- a/application/admin/model/user/UserRecharge.php
+++ b/application/admin/model/user/UserRecharge.php
@@ -1,12 +1,18 @@
+ * @day: 2017/11/28
+ */
+
namespace app\admin\model\user;
+
use traits\ModelTrait;
use basic\ModelBasic;
-use app\admin\model\user\User;
/**
- * 提现记录
+ * 用户充值记录
* Class UserRecharge
* @package app\admin\model\user
*/
@@ -19,8 +25,9 @@ use app\admin\model\user\User;
$model = new self;
$model = $model->alias('A');
if($where['order_id'] != '') {
- $model = $model->where('A.order_id|B.nickname','like',"%$where[order_id]%");
+ $model = $model->whereOr('A.order_id','like',"%$where[order_id]%");
$model = $model->whereOr('A.id',(int)$where['order_id']);
+ $model = $model->whereOr('B.nickname','like',"%$where[order_id]%");
}
$model = $model->where('A.recharge_type','weixin');
$model = $model->where('A.paid',1);
diff --git a/application/admin/model/wechat/WechatQrcode.php b/application/admin/model/wechat/WechatQrcode.php
index c9fce08a..fa7527a2 100644
--- a/application/admin/model/wechat/WechatQrcode.php
+++ b/application/admin/model/wechat/WechatQrcode.php
@@ -10,7 +10,7 @@ namespace app\admin\model\wechat;
use traits\ModelTrait;
use basic\ModelBasic;
-use service\WechatService;
+use app\core\util\WechatService;
/**
* 获取二维码
diff --git a/application/admin/model/wechat/WechatReply.php b/application/admin/model/wechat/WechatReply.php
index 0ba06a37..7fd197e3 100644
--- a/application/admin/model/wechat/WechatReply.php
+++ b/application/admin/model/wechat/WechatReply.php
@@ -12,7 +12,7 @@ use traits\ModelTrait;
use basic\ModelBasic;
use service\HookService;
use service\UtilService;
-use service\WechatService;
+use app\core\util\WechatService;
use think\Url;
/**
@@ -30,7 +30,7 @@ class WechatReply extends ModelBasic
* @param $key
*/
public static function getDataByKey($key){
- $resdata = [];
+ $resdata = ['data'=>''];
$resdata = self::where('key',$key)->find();
$resdata['data'] = json_decode($resdata['data'],true);
return $resdata;
diff --git a/application/admin/model/wechat/WechatUser.php b/application/admin/model/wechat/WechatUser.php
index d81811d8..f99d3e58 100644
--- a/application/admin/model/wechat/WechatUser.php
+++ b/application/admin/model/wechat/WechatUser.php
@@ -12,14 +12,14 @@ use app\admin\model\order\StoreOrder;
use app\admin\model\user\User;
use app\admin\model\user\UserExtract;
use service\ExportService;
-use service\QrcodeService;
+use app\core\util\QrcodeService;
use think\Cache;
use think\Config;
use traits\ModelTrait;
use basic\ModelBasic;
-use service\WechatService;
+use app\core\util\WechatService;
use service\PHPExcelService;
-use service\SystemConfigService;
+use app\core\util\SystemConfigService;
/**
* 微信用户 model
diff --git a/application/admin/view/agent/agent_manage/index.php b/application/admin/view/agent/agent_manage/index.php
index 77c405bf..0d895270 100644
--- a/application/admin/view/agent/agent_manage/index.php
+++ b/application/admin/view/agent/agent_manage/index.php
@@ -387,7 +387,11 @@
{if condition="$vo['user_type'] eq 'routine'"}
暂无
{else/}
+ {if isset($vo.qr_code.url)}
+ {else}
+ 暂无
+ {/if}
{/if}
{$userinfo.number}