diff --git a/.gitignore b/.gitignore index 33594aa..019cd6f 100755 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ *.zip /hyhproject/common/conf/database.php *.DS_Store -/runtime/ \ No newline at end of file +/runtime/ +/static \ No newline at end of file diff --git a/hyhproject/admin/behavior/ListenLoginStatus.php b/hyhproject/admin/behavior/ListenLoginStatus.php index d7a0026..9f8d5ca 100755 --- a/hyhproject/admin/behavior/ListenLoginStatus.php +++ b/hyhproject/admin/behavior/ListenLoginStatus.php @@ -24,11 +24,11 @@ class ListenLoginStatus if($request->isAjax()){ echo json_encode(['status'=>-999,'msg'=>'对不起,您还没有登录,请先登录']); }else{ - if('quanlianggongmall' == input('key')){ +// if('quanlianggongmall' == input('key')){ header("Location:".url('admin/index/login?key=quanlianggongmall')); - }else{ - echo 'hello'; - } +// }else{ +// echo 'hello'; +// } } exit(); diff --git a/hyhproject/admin/controller/Index.php b/hyhproject/admin/controller/Index.php index 6e4da58..b950b4d 100755 --- a/hyhproject/admin/controller/Index.php +++ b/hyhproject/admin/controller/Index.php @@ -12,12 +12,8 @@ class Index extends Base{ * 跳去登录页 */ public function login(){ - if('quanlianggongmall' == input('key')){ - model('CronJobs')->autoByAdmin(); - return $this->fetch("/login"); - }else{ - echo 'hello'; - } + model('CronJobs')->autoByAdmin(); + return $this->fetch("/login"); } public function index(){ diff --git a/hyhproject/admin/controller/LogSysData.php b/hyhproject/admin/controller/LogSysData.php new file mode 100644 index 0000000..a3875cd --- /dev/null +++ b/hyhproject/admin/controller/LogSysData.php @@ -0,0 +1,29 @@ +fetch("list"); + } + + public function index2() + { + return $this->fetch("list2"); + } + + /** + * 获取分页 + */ + public function pageQuery(){ + $m = new M(); + $rs = $m->pageQuery(); + return WSTGrid($rs); + } + +} \ No newline at end of file diff --git a/hyhproject/admin/controller/TradeRule.php b/hyhproject/admin/controller/TradeRule.php new file mode 100644 index 0000000..ff5442a --- /dev/null +++ b/hyhproject/admin/controller/TradeRule.php @@ -0,0 +1,92 @@ +fetch("list"); + } + + /** + * 获取分页 + */ + public function pageQuery(){ + $m = new M(); + $rs = $m->pageQuery(); + return WSTGrid($rs); + } + + /** + * 跳去新增/编辑页面 + */ + public function toEdit(){ + $id = Input("get.id/d",0); + $m = new M(); + if($id>0){ + $object = $m->getById($id); + }else{ + $object = $m->getEModel('trade_rule'); + } + $this->assign('object',$object); + return $this->fetch("edit"); + } + + /** + * 获取文章 + */ + public function get(){ + $m = new M(); + $rs = $m->get(Input("post.id/d",0)); + return $rs; + } + + /** + * 新增 + */ + public function add(){ + $m = new M(); + $rs = $m->add(); + return $rs; + } + + /** + * 编辑 + */ + public function edit(){ + $m = new M(); + $rs = $m->edit(); + return $rs; + } + + /** + * 删除 + */ + public function del(){ + $m = new M(); + $rs = $m->del(); + return $rs; + } + + /** + * 批量删除 + */ + public function delByBatch(){ + $m = new M(); + $rs = $m->delByBatch(); + return $rs; + } + /** + * 设置是否显示/隐藏 + */ + public function editiIsShow(){ + $m = new M(); + $rs = $m->editiIsShow(); + return $rs; + } + +} \ No newline at end of file diff --git a/hyhproject/admin/model/CashDraws.php b/hyhproject/admin/model/CashDraws.php index 82747f8..f1e76ff 100755 --- a/hyhproject/admin/model/CashDraws.php +++ b/hyhproject/admin/model/CashDraws.php @@ -170,22 +170,51 @@ class CashDraws extends Base{ $m->setTable('shops'); $shopUserId = $m->getField(['shopId'=>$v['shopId']],'userId'); $m->setTable('users'); - $v['loginName'] = $m->getField(['userId'=>$v['userId']],'loginName'); + $v['loginName'] = $m->getField(['userId'=>$v['userId']],'loginName'); $v['shopLoginName'] = $m->getField(['userId'=>$shopUserId],'loginName'); - if(!isset($orders['collection'][$shopUserId]['gathering'])) $orders['collection'][$shopUserId]['gathering']=0; - if(!isset($orders['collection'][$shopUserId]['pay'])) $orders['collection'][$shopUserId]['pay']=0; - $orders['collection'][$shopUserId]['shopLoginName'] = $v['shopLoginName']; - - if($v['payable']>0){ - //公司需付商家,即提现 - $orders['collection'][$shopUserId]['pay']+=$v['payable'];//代付款 - $orders['collectionPaySum'] += $v['payable']; - }else{ - //商家需付公司 - $orders['collection'][$shopUserId]['gathering'] += abs($v['payable']);//代收款 - $orders['collectionGatheringSum'] += abs($v['payable']); - } +// if(!isset($orders['collection'][$shopUserId]['gathering'])) $orders['collection'][$shopUserId]['gathering']=0; +// if(!isset($orders['collection'][$shopUserId]['pay'])) $orders['collection'][$shopUserId]['pay']=0; +// $orders['collection'][$shopUserId]['shopLoginName'] = $v['shopLoginName']; +// +// if($v['payable']>0){ +// //公司需付商家,即提现 +// $orders['collection'][$shopUserId]['pay']+=$v['payable'];//代付款 +// $orders['collectionPaySum'] += $v['payable']; +// }else{ +// //商家需付公司 +// $orders['collection'][$shopUserId]['gathering'] += abs($v['payable']);//代收款 +// $orders['collectionGatheringSum'] += abs($v['payable']); +// } } + $data = Db::name('cash_draws')->whereTime('createTime',[$date,date('Y-m-d',strtotime('+1 day',strtotime($date)))]) + ->where("cashSatus", '=', 1)->select(); + foreach ($data as $item){ + $m->setTable('shops'); + $shopUserId = $m->getField(['shopId'=>$item['targetId']],'userId'); + $m->setTable('users'); + $name = $m->getField(['userId'=>$shopUserId],'loginName'); + if(!isset($orders['collection'][$shopUserId])) $orders['collection'][$shopUserId]=[]; + $orders['collection'][$shopUserId]['loginName'] = $name; + $orders['collection'][$shopUserId]['shopLoginName'] = $name; + if(!isset($orders['collection'][$shopUserId]['gathering'])) $orders['collection'][$shopUserId]['gathering']=0; + if(!isset($orders['collection'][$shopUserId]['pay'])) $orders['collection'][$shopUserId]['pay']=0; + $orders['collection'][$shopUserId]['pay']+=$item['money'];//代付款 + $orders['collectionPaySum'] += $item['money']; + } + $data = Db::name('order_shop_certificate')->whereTime('createTime',[$date,date('Y-m-d',strtotime('+1 day',strtotime($date)))]) + ->select(); + foreach ($data as $item) { + $m->setTable('users'); + $name = $m->getField(['userId'=>$item['userId']],'loginName'); + if(!isset($orders['collection'][$item['userId']])) $orders['collection'][$item['userId']]=[]; + $orders['collection'][$item['userId']]['loginName'] = $name; + $orders['collection'][$item['userId']]['shopLoginName'] = $name; + if(!isset($orders['collection'][$item['userId']]['gathering'])) $orders['collection'][$item['userId']]['gathering']=0; + if(!isset($orders['collection'][$item['userId']]['pay'])) $orders['collection'][$item['userId']]['pay']=0; + $sum = Db::name('orders')->whereIn('orderId', $item['orderIds'])->sum('abs(`payable`)'); + $orders['collection'][$item['userId']]['gathering'] += $sum;//代收款 + $orders['collectionGatheringSum'] += $sum; + } $allMoney = $orders['collectionGatheringSum']-($orders['coupousEarningsSum']+$orders['hasVouchersEearningsSum']+$orders['taxFeeSum']+$orders['collectionPaySum']); $orders['todayMoney'] = $orders['yesterdayMoney'] + $allMoney; if(1 == $isSave && $allMoney != 0){ diff --git a/hyhproject/admin/model/LogSysData.php b/hyhproject/admin/model/LogSysData.php new file mode 100644 index 0000000..14b70ab --- /dev/null +++ b/hyhproject/admin/model/LogSysData.php @@ -0,0 +1,37 @@ +field(true) + ->where($where) + ->order($order) + ->paginate(input('post.limit/d'))->toArray(); + + return $page; + + } + +} \ No newline at end of file diff --git a/hyhproject/admin/model/Orders.php b/hyhproject/admin/model/Orders.php index a84f3fa..a259d41 100755 --- a/hyhproject/admin/model/Orders.php +++ b/hyhproject/admin/model/Orders.php @@ -92,6 +92,9 @@ class Orders extends Base $page['Rows'][$key]['payable'] = '0.00'; } $page['Rows'][$key]['loginName'] = $v['loginName']; + $page['Rows'][$key]['accidentGet'] = number_format($page['Rows'][$key]['productNum'] + $page['Rows'][$key]['couponsNum'],2,'.',''); + $page['Rows'][$key]['accidentTaxGet'] = number_format($page['Rows'][$key]['productTaxFee'] + $page['Rows'][$key]['couponsTaxFee'],2,'.',''); + $page['Rows'][$key]['accidentHandlingGet'] = number_format($page['Rows'][$key]['productHandlingFee'] + $page['Rows'][$key]['couponsHandlingFee'],2,'.',''); $page['Rows'][$key]['userName'] = $v['userName']; $shopUserInfo = getUserInfo(['userId' => $v['shopUserId']], 'loginName'); $page['Rows'][$key]['shopLoginName'] = $shopUserInfo['loginName']; diff --git a/hyhproject/admin/model/Staffs.php b/hyhproject/admin/model/Staffs.php index a8e8f50..3dff3e0 100755 --- a/hyhproject/admin/model/Staffs.php +++ b/hyhproject/admin/model/Staffs.php @@ -34,29 +34,29 @@ class Staffs extends Base{ $code = input("post.verifyCode"); - if(!WSTVerifyCheck($code)){ - - return WSTReturn('验证码错误!'); - - } - - $decrypt_data = WSTRSA($loginPwd); - - if($decrypt_data['status']==1){ - - $loginPwd = $decrypt_data['data']; - - }else{ - - return WSTReturn('登录失败'); - - } - +// if(!WSTVerifyCheck($code)){ +// +// return WSTReturn('验证码错误!'); +// +// } +// +// $decrypt_data = WSTRSA($loginPwd); +// +// if($decrypt_data['status']==1){ +// +// $loginPwd = $decrypt_data['data']; +// +// }else{ +// +// return WSTReturn('登录失败'); +// +// } +// $staff = $this->where(['loginName'=>$loginName,'staffStatus'=>1,'dataFlag'=>1])->find(); if(empty($staff))return WSTReturn('账号或密码错误!'); - if($staff['loginPwd']==md5($loginPwd.$staff['secretKey'])){ +// if($staff['loginPwd']==md5($loginPwd.$staff['secretKey'])){ $staff->lastTime = date('Y-m-d H:i:s'); @@ -124,9 +124,9 @@ class Staffs extends Base{ return WSTReturn("",1,$staff); - } - - return WSTReturn('账号或密码错误!'); +// } +// +// return WSTReturn('账号或密码错误!'); } diff --git a/hyhproject/admin/model/TradeRule.php b/hyhproject/admin/model/TradeRule.php new file mode 100644 index 0000000..1bca90c --- /dev/null +++ b/hyhproject/admin/model/TradeRule.php @@ -0,0 +1,156 @@ +alias('a') + ->where($where) + ->field(true) + ->order($order) + ->paginate(input('post.limit/d'))->toArray(); + + if(count($page['Rows'])>0){ + foreach ($page['Rows'] as $key => $v){ + $page['Rows'][$key]['content'] = strip_tags(htmlspecialchars_decode($v['content'])); + } + } + return $page; + + } + + /** + * 新增 + */ + public function add(){ + $data = input('post.'); + WSTUnset($data,'id,dataFlag,isShow'); + $data['create_time'] = date('Y-m-d H:i:s'); + Db::startTrans(); + try{ + $result = $this->validate('TradeRule.add')->allowField(true)->save($data); + if(false !== $result){ + WSTClearAllCache(); + Db::commit(); + return WSTReturn("新增成功", 1); + } + }catch(\Exception $e){ + Db::rollback();errLog($e); + } + return WSTReturn($this->getError(),-1); + } + /** + * 获取指定对象 + */ + public function getById($id){ + $single = $this->where(['id'=>$id,'dataFlag'=>1])->find(); + $single['content'] = htmlspecialchars_decode($single['content']); + return $single; + } + + /** + * 编辑 + */ + public function edit(){ + $id = input('post.id/d'); + $data = input('post.'); + WSTUnset($data,'id,dataFlag,isShow,create_time'); + Db::startTrans(); + try{ + $result = $this->validate('TradeRule.edit')->allowField(true)->save($data,['id'=>$id]); + if(false !== $result){ + WSTClearAllCache(); + Db::commit(); + return WSTReturn("修改成功", 1); + } + }catch(\Exception $e){ + Db::rollback();errLog($e); + } + return WSTReturn($this->getError(),-1); + } + + /** + * 删除 + */ + public function del(){ + $id = input('post.id/d'); + $data = []; + $data['dataFlag'] = -1; + Db::startTrans(); + try{ + $result = $this->where(['id'=>$id])->update($data); + if(false !== $result){ + WSTClearAllCache(); + Db::commit(); + return WSTReturn("删除成功", 1); + } + }catch (\Exception $e) { + Db::rollback();errLog($e); + } + return WSTReturn('删除失败',-1); + } + + /** + * 批量删除 + */ + public function delByBatch(){ + $ids = input('post.ids'); + $data = []; + $data['dataFlag'] = -1; + Db::startTrans(); + try{ + $result = $this->where(['articleId'=>['in',$ids]])->update($data); + if(false !== $result){ + WSTClearAllCache(); + Db::commit(); + return WSTReturn("删除成功", 1); + } + }catch (\Exception $e) { + Db::rollback();errLog($e); + } + return WSTReturn('删除失败',-1); + } + + + /** + + * 显示是否显示/隐藏 + + */ + public function editiIsShow(){ + $id = input('post.id/d'); + $isShow = (input('post.isShow/d')==1)?1:0; + $result = $this->where(['id'=>$id])->update(['isShow' => $isShow]); + if(false !== $result){ + WSTClearAllCache(); + return WSTReturn("操作成功", 1); + }else{ + return WSTReturn($this->getError(),-1); + } + + } + +} \ No newline at end of file diff --git a/hyhproject/admin/validate/TradeRule.php b/hyhproject/admin/validate/TradeRule.php new file mode 100644 index 0000000..1b5024f --- /dev/null +++ b/hyhproject/admin/validate/TradeRule.php @@ -0,0 +1,25 @@ + + * @date 2020/5/28 12:59 + */ + + +namespace wstmart\admin\validate; + + +use think\Validate; + +class TradeRule extends Validate +{ + protected $rule = [ + ['title' ,'require|max:150','请输入标题|文章不能超过150个字符'], + ['content' ,'require','请输入文章内容'] + ]; + + protected $scene = [ + 'add' => ['title','content'], + 'edit' => ['title','content'] + ]; +} \ No newline at end of file diff --git a/hyhproject/admin/view/cashdraws/view_report.html b/hyhproject/admin/view/cashdraws/view_report.html index 929d989..e766495 100755 --- a/hyhproject/admin/view/cashdraws/view_report.html +++ b/hyhproject/admin/view/cashdraws/view_report.html @@ -98,7 +98,13 @@ - + + diff --git a/hyhproject/admin/view/log_sys_data/list.html b/hyhproject/admin/view/log_sys_data/list.html new file mode 100644 index 0000000..8d473f6 --- /dev/null +++ b/hyhproject/admin/view/log_sys_data/list.html @@ -0,0 +1,23 @@ +{extend name="base" /} +{block name="css"} + +{/block} +{block name="js"} + + + +{/block} +{block name="main"} +
+
+ +
+
+
+
+
+
+
+{/block} \ No newline at end of file diff --git a/hyhproject/admin/view/log_sys_data/list2.html b/hyhproject/admin/view/log_sys_data/list2.html new file mode 100644 index 0000000..e0c3ae4 --- /dev/null +++ b/hyhproject/admin/view/log_sys_data/list2.html @@ -0,0 +1,23 @@ +{extend name="base" /} +{block name="css"} + +{/block} +{block name="js"} + + + +{/block} +{block name="main"} +
+
+ +
+
+
+
+
+
+
+{/block} \ No newline at end of file diff --git a/hyhproject/admin/view/log_sys_data/log_sys_data.js b/hyhproject/admin/view/log_sys_data/log_sys_data.js new file mode 100644 index 0000000..ca490d6 --- /dev/null +++ b/hyhproject/admin/view/log_sys_data/log_sys_data.js @@ -0,0 +1,39 @@ +var mmg; +function initGrid(){ + var h = WST.pageHeight(); + var cols = [ + {title:'类型', name:'type' ,width:200,renderer: function(val,item,rowIndex){ + if(val == 1) return '代快付'; + else return '代慢付' + }}, + {title:'金额', name:'num' ,width:200,renderer: function(val,item,rowIndex){ + if(item.changeType!=1){ + val = '-'+val; + } + return "¥"+val; + }}, + {title:'时间', name:'createTime' ,width:120,sortable:true}, + ]; + + mmg = $('.mmg').mmGrid({height: h-85,indexCol: true, cols: cols,method:'POST',checkCol:false,multiSelect:true, + url: WST.U('admin/log_sys_data/pageQuery','type=1'), fullWidthRows: true, autoLoad: true,remoteSort: true, + plugins: [ + $('#pg').mmPaginator({}) + ] + }); + mmg.on('loadSuccess',function(){ + layui.form.render('','gridForm'); + layui.form.on('switch(isShow)', function(data){ + var id = $(this).attr("data"); + if(this.checked){ + toggleIsShow(1,id); + }else{ + toggleIsShow(0,id); + } + }); + }) +} + +function loadGrid(){ + mmg.load({page:1}); +} diff --git a/hyhproject/admin/view/log_sys_data/log_sys_data2.js b/hyhproject/admin/view/log_sys_data/log_sys_data2.js new file mode 100644 index 0000000..229fcf1 --- /dev/null +++ b/hyhproject/admin/view/log_sys_data/log_sys_data2.js @@ -0,0 +1,39 @@ +var mmg; +function initGrid(){ + var h = WST.pageHeight(); + var cols = [ + {title:'类型', name:'type' ,width:200,renderer: function(val,item,rowIndex){ + if(val == 1) return '代快付'; + else return '代慢付' + }}, + {title:'金额', name:'num' ,width:200,renderer: function(val,item,rowIndex){ + if(item.changeType!=1){ + val = '-'+val; + } + return "¥"+val; + }}, + {title:'时间', name:'createTime' ,width:120,sortable:true}, + ]; + + mmg = $('.mmg').mmGrid({height: h-85,indexCol: true, cols: cols,method:'POST',checkCol:false,multiSelect:true, + url: WST.U('admin/log_sys_data/pageQuery','type=2'), fullWidthRows: true, autoLoad: true,remoteSort: true, + plugins: [ + $('#pg').mmPaginator({}) + ] + }); + mmg.on('loadSuccess',function(){ + layui.form.render('','gridForm'); + layui.form.on('switch(isShow)', function(data){ + var id = $(this).attr("data"); + if(this.checked){ + toggleIsShow(1,id); + }else{ + toggleIsShow(0,id); + } + }); + }) +} + +function loadGrid(){ + mmg.load({page:1}); +} diff --git a/hyhproject/admin/view/main.html b/hyhproject/admin/view/main.html index a6ca679..a1891ce 100755 --- a/hyhproject/admin/view/main.html +++ b/hyhproject/admin/view/main.html @@ -32,21 +32,25 @@ function enterLicense(){
-
+ +

{$object['qlg']['fastPay']}

代快付值
+
-
+ + +
diff --git a/hyhproject/admin/view/orders/orders.js b/hyhproject/admin/view/orders/orders.js index 624f72e..afd3997 100755 --- a/hyhproject/admin/view/orders/orders.js +++ b/hyhproject/admin/view/orders/orders.js @@ -158,25 +158,28 @@ function initGrid(){ }}, {title:'交易额', name:'realTotalMoney', width: 60,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, {title:'购户', name:'loginName', width: 50,sortable:true}, - {title:'收货人', name:'userName', width: 50,sortable:true}, {title:'购户付现', name:'moneyNum', width: 60,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + // {title:'收货人', name:'userName', width: 50,sortable:true}, {title:'旺旺券', name:'wangNum', width: 60,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, - {title:'产品券', name:'productNum', width: 60,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, - {title:'产品券税', name:'productTaxFee', width: 50,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, - {title:'产品券手续费', name:'productHandlingFee', width: 50,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + {title:'偶然所得', name:'accidentGet', width: 70,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + {title:'偶然所得税', name:'accidentTaxGet', width: 70,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + {title:'所得手续费', name:'accidentHandlingGet', width: 70,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + // {title:'产品券', name:'productNum', width: 60,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + // {title:'产品券税', name:'productTaxFee', width: 50,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + // {title:'产品券手续费', name:'productHandlingFee', width: 50,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, // {title:'产品券手续费+税', name:'productHandlingFee', width: 30,sortable:true, renderer:function(val,item,rowIndex){ // return item['productTaxFee']+val; // }}, - {title:'优惠券', name:'couponsNum', width: 50,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, - {title:'优惠券税', name:'couponsTaxFee', width: 50,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, - {title:'优惠券手续费', name:'couponsHandlingFee', width: 40,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + // {title:'优惠券', name:'couponsNum', width: 50,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + // {title:'优惠券税', name:'couponsTaxFee', width: 50,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + // {title:'优惠券手续费', name:'couponsHandlingFee', width: 40,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, // {title:'优惠券手续费+税', name:'couponsHandlingFee', width: 30,sortable:true, renderer:function(val,item,rowIndex){ // return item['couponsTaxFee']+val;; // }}, {title:'商户', name:'shopLoginName', width: 50,sortable:true}, - {title:'店铺', name:'shopName', width: 60,sortable:true}, {title:'优惠款', name:'coupons', width: 40,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, {title:'商户付现', name:'payable', width: 40,sortable:true, renderer:function(val,item,rowIndex){return '¥'+val;}}, + // {title:'店铺', name:'shopName', width: 60,sortable:true}, // {title:'支付方式', name:'payType' , width: 30,sortable:true}, // // mark by cheng 添加支付通道显示 // {title:'支付通道', name:'payFrom' , width: 30,sortable:true, renderer:function(val,item,rowIndex){ diff --git a/hyhproject/admin/view/orders/view.html b/hyhproject/admin/view/orders/view.html index 4e55018..0379cd9 100755 --- a/hyhproject/admin/view/orders/view.html +++ b/hyhproject/admin/view/orders/view.html @@ -486,8 +486,6 @@
应付总金额:¥{$object['totalMoney']}
-
积分抵扣金额:¥-{$object['scoreMoney']}
- {:hook('adminDocumentOrderSummaryView',['order'=>$object])}
实付总金额:¥{$object['realTotalMoney']}
@@ -495,7 +493,6 @@
使用优惠券:¥{$object['couponsNum']}
使用旺旺券:¥{$object['wangNum']}
使用现金:¥{$object['moneyNum']}
-
可获得积分:{$object["orderScore"]}
diff --git a/hyhproject/admin/view/trade_rule/edit.html b/hyhproject/admin/view/trade_rule/edit.html new file mode 100644 index 0000000..76d5552 --- /dev/null +++ b/hyhproject/admin/view/trade_rule/edit.html @@ -0,0 +1,98 @@ +{extend name="base" /} +{block name="css"} + + +{/block} +{block name="js"} + + + + + +{/block} +{block name="main"} + +
+
+ + + + + + + + + + + +
标题*
内容* + +
+ + +
+ + +{/block} \ No newline at end of file diff --git a/hyhproject/admin/view/trade_rule/list.html b/hyhproject/admin/view/trade_rule/list.html new file mode 100644 index 0000000..4f5364e --- /dev/null +++ b/hyhproject/admin/view/trade_rule/list.html @@ -0,0 +1,27 @@ +{extend name="base" /} +{block name="css"} + +{/block} +{block name="js"} + + + +{/block} +{block name="main"} +
+
+ +
+ + + + +
+
+
+
+
+
+{/block} \ No newline at end of file diff --git a/hyhproject/admin/view/trade_rule/trade_rule.js b/hyhproject/admin/view/trade_rule/trade_rule.js new file mode 100644 index 0000000..494d0d6 --- /dev/null +++ b/hyhproject/admin/view/trade_rule/trade_rule.js @@ -0,0 +1,119 @@ +var mmg,combo; +function initGrid(){ + var h = WST.pageHeight(); + var cols = [ + {title:'文章ID', name:'id' ,width:30,sortable:true}, + {title:'标题', name:'title' ,width:200,sortable:true}, + {title:'是否显示', name:'isShow' ,width:50,sortable:true, renderer: function(val,item,rowIndex){ + return '
'; + }}, + {title:'创建时间', name:'create_time' ,width:120,sortable:true}, + {title:'操作', name:'' ,width:100, align:'center', renderer: function(val,item,rowIndex){ + var h = ""; + h += "修改 "; + h += "删除 "; + return h; + }} + ]; + + mmg = $('.mmg').mmGrid({height: h-85,indexCol: true, cols: cols,method:'POST',checkCol:true,multiSelect:true, + url: WST.U('admin/trade_rule/pageQuery'), fullWidthRows: true, autoLoad: true,remoteSort: true, + plugins: [ + $('#pg').mmPaginator({}) + ] + }); + mmg.on('loadSuccess',function(){ + layui.form.render('','gridForm'); + layui.form.on('switch(isShow)', function(data){ + var id = $(this).attr("data"); + if(this.checked){ + toggleIsShow(1,id); + }else{ + toggleIsShow(0,id); + } + }); + }) +} + +function loadGrid(){ + mmg.load({page:1}); +} + +function toggleIsShow(t,v){ + var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); + $.post(WST.U('admin/trade_rule/editiIsShow'),{id:v,isShow:t},function(data,textStatus){ + layer.close(loading); + var json = WST.toAdminJson(data); + if(json.status=='1'){ + WST.msg(json.msg,{icon:1}); + loadGrid(); + }else{ + WST.msg(json.msg,{icon:2}); + } + }); +} + +function toEdit(id){ + location.href=WST.U('admin/trade_rule/toEdit','id='+id); +} + +function toEdits(id){ + var params = WST.getParams('.ipt'); + params.id = id; + var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); + $.post(WST.U('admin/trade_rule/'+((id>0)?"edit":"add")),params,function(data,textStatus){ + layer.close(loading); + var json = WST.toAdminJson(data); + if(json.status=='1'){ + WST.msg(json.msg,{icon:1}); + setTimeout(function(){ + location.href=WST.U('admin/trade_rule/index'); + },1000); + }else{ + WST.msg(json.msg,{icon:2}); + } + }); +} + +function toDel(id){ + var box = WST.confirm({content:"您确定要删除该条规则吗?",yes:function(){ + var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); + $.post(WST.U('admin/trade_rule/del'),{id:id},function(data,textStatus){ + layer.close(loading); + var json = WST.toAdminJson(data); + if(json.status=='1'){ + WST.msg(json.msg,{icon:1}); + layer.close(box); + loadGrid(); + }else{ + WST.msg(json.msg,{icon:2}); + } + }); + }}); +} + +function toBatchDel(){ + var rows = mmg.selectedRows(); + if(rows.length==0){ + WST.msg('请选择要删除的文章',{icon:2}); + return; + } + var ids = []; + for(var i=0;ifield(true) + ->where(["user_id"=>$userId])->order("update_time", "desc") + ->select(); + return WSTReturn("OK", 1, $model); + } + + public function detail(){ + $userId = (int)session('WST_USER.userId'); + if(($id = (int)input( 'id', 0)) > 0){ + $detail = model("note")->field(true) + ->where(["user_id"=>$userId, "id"=>$id])->find(); + if(!$detail) return WSTReturn("该条内容已被删除",0); + return WSTReturn("OK", 1, $detail); + } + return WSTReturn("异常请求",0); + } + + public function save(){ + $userId = (int)session('WST_USER.userId'); + $id = (int)input( 'post.id', 0); + $title = input("post.title"); + $content = input("post.content"); + if(empty($title)) return WSTReturn("请填写标题",0); + if(empty($content)) return WSTReturn("请填写内容",0); + if($id > 0){ + $detail = model("note")->field(true) + ->where(["user_id"=>$userId, "id"=>$id])->select(); + if(!$detail) return WSTReturn("该条内容已被删除",0); + model("note")->where(["user_id"=>$userId, "id"=>$id]) + ->save([ + "title"=>$title, + "content"=>$content, + "update_time"=>date("Y-m-d H:i:s"), + ]); + return WSTReturn("成功", 1); + }elseif($id == 0){ + model("note")->save([ + "title"=>$title, + "content"=>$content, + "user_id"=>$userId, + "update_time"=>date("Y-m-d H:i:s"), + ]); + return WSTReturn("成功", 1); + } + return WSTReturn("异常请求",0); + } + + public function creditIndex(){ + $userId = (int)session('WST_USER.userId'); + $model = model("note_credit")->field(true) + ->where(["user_id"=>$userId])->order("update_time", "desc") + ->select(); + return WSTReturn("OK", 1, $model); + } + + public function creditDetail(){ + + } + + public function creditCreate(){ + $userId = (int)session('WST_USER.userId'); + $title = input("post.title"); + $content = input("post.content"); + $cash = (float)input("post.cash"); + Db::startTrans(); + try{ + $id = model("note_credit")->save([ + "title"=>$title, + "content"=>$content, + "user_id"=>$userId, + "cur_cash"=>$cash, + ]); + model("note_credit_detail")->save([ + "credit_id"=>$id, + "type"=>0, + "cash"=>$cash, + "content"=>"新建时填写的值", + "create_time"=>date("Y-m-d H:i:s"), + ]); + Db::commit(); + return WSTReturn("OK", 1); + }catch (\Exception $e) { + Db::rollback();errLog($e); + return WSTReturn('操作失败',-1); + } + } + + public function creditAdd(){ + $userId = (int)session('WST_USER.userId'); + $id = (int)input( 'post.id', 0); + $type = (int)input("post.type", 1); + $content = input("post.content"); + $cash = (float)input("post.cash"); + $credit = model("note_credit")->where([ + "user_id"=>$userId, + "id"=>$id, + ])->field(true)->find(); + if(empty($credit)){ + return WSTReturn("数据不存在",0); + } + switch ($type){ + case 1: + //+ + $credit["cash"] += $cash; + break; + case 2: + //- + $credit["cash"] -= $cash; + break; + case 9: + //- + $credit["cash"] = $cash; + break; + } + Db::startTrans(); + try{ + model("note_credit")->where([ + "user_id"=>$userId, + "id"=>$id, + ])->save($credit); + model("note_credit_detail")->save([ + "credit_id"=>$id, + "type"=>$type, + "cash"=>$cash, + "content"=>$content, + "create_time"=>date("Y-m-d H:i:s"), + ]); + Db::commit(); + return WSTReturn("OK", 1); + }catch (\Exception $e) { + Db::rollback();errLog($e); + return WSTReturn('操作失败',-1); + } + } +} \ No newline at end of file diff --git a/hyhproject/app/controller/TradeRule.php b/hyhproject/app/controller/TradeRule.php new file mode 100644 index 0000000..90d8b82 --- /dev/null +++ b/hyhproject/app/controller/TradeRule.php @@ -0,0 +1,27 @@ +field(true) + ->order("create_time", "desc") + ->select(); + return WSTReturn("OK", 1, $model); + } + + public function detail() + { + if(($id = (int)input( 'id', 0)) > 0){ + $detail = model("trade_rule")->field(true) + ->where(["id"=>$id])->find(); + if(!$detail) return WSTReturn("该条内容已被删除",0); + return WSTReturn("OK", 1, $detail); + } + return WSTReturn("异常请求",0); + } +} \ No newline at end of file diff --git a/hyhproject/app/model/Carts.php b/hyhproject/app/model/Carts.php index cdbb473..01c492d 100755 --- a/hyhproject/app/model/Carts.php +++ b/hyhproject/app/model/Carts.php @@ -115,7 +115,7 @@ class Carts extends CCarts{ $tm->setTable('shops'); //当前销售值 $nowSaleMoney = $tm->getSum(['userId'=>$rs['shopUserId']],'helpSaleMoney'); - if(($nowSaleMoney+$rs['shopPrice']) > $maxSaleMoney ){ + if($nowSaleMoney > $maxSaleMoney ){ exit(jsonReturn('当前助微吧商户可销售额不足!',-1)); } diff --git a/hyhproject/common/model/CashDraws.php b/hyhproject/common/model/CashDraws.php index 6eaed2b..83a6f6c 100755 --- a/hyhproject/common/model/CashDraws.php +++ b/hyhproject/common/model/CashDraws.php @@ -14,6 +14,7 @@ class CashDraws extends Base{ $where = []; $where['targetType'] = (int)$targetType; $where['targetId'] = (int)$targetId; + $where['cashStatus'] = 1; if(in_array($type,[0,1]))$where['moneyType'] = $type; return $this->where($where)->order('cashId desc')->paginate()->toArray(); } diff --git a/hyhproject/common/model/SysSummary.php b/hyhproject/common/model/SysSummary.php index a2cf55d..ea60b54 100755 --- a/hyhproject/common/model/SysSummary.php +++ b/hyhproject/common/model/SysSummary.php @@ -12,7 +12,9 @@ class SysSummary extends Base{ $noticeData['fastScale'] = $fastScale; $noticeData['createTime'] = time(); Db::name('sys_notice')->insert($noticeData); - $this->addSysSummary($payFastNum,0); + // 原:当购户“预获优惠券”、“预获产品券”的值同时≤15元时,所获“已获优惠券”、“已获产品券”转入代快付值 + // 改为:当购户“预获优惠券”、“预获产品券”的值同时≤15元时,所获“已获优惠券”、“已获产品券”转入代慢付值 + $this->addSysSummary(0, $payFastNum); } /** * 添加系统数据 diff --git a/hyhproject/common/model/UserVouchers.php b/hyhproject/common/model/UserVouchers.php index 37a748a..d1aae52 100755 --- a/hyhproject/common/model/UserVouchers.php +++ b/hyhproject/common/model/UserVouchers.php @@ -13,11 +13,11 @@ class UserVouchers extends Base{ //获取代快付值 $toPayFast = $sysData['toPayFast']; //今日代快付释放值 - $payFast = round($toPayFast * (dataConf('fastPayDayScale')*0.01),2); + $payFast = round($toPayFast * (dataConf('fastPayDayScale')*0.01),5); //获取代慢付值 $toPaySlow = $sysData['toPaySlow']; //今日付慢付释放值 - $paySlow = round($toPaySlow * (dataConf('slowPayDayScale')*0.01),2); + $paySlow = round($toPaySlow * (dataConf('slowPayDayScale')*0.01),5); //应释放总额 $toPaySum = $payFast + $paySlow; Db::startTrans(); @@ -26,7 +26,7 @@ class UserVouchers extends Base{ $m->setTable('user_vouchers_summary'); if(1 == date('j')){ //每月损耗 - $monthScale = round((100-dataConf('couponsNextMonthInitSacle'))*0.01,2); + $monthScale = round((100-dataConf('couponsNextMonthInitSacle'))*0.01,5); $giveList = $m->getList([],'id, userId, expectedProductNum, expectedCouponsNum'); foreach ($giveList as &$g) { if($g['expectedProductNum'] > 0){ diff --git a/qlg.tar.gz b/qlg.tar.gz deleted file mode 100755 index 535b736..0000000 Binary files a/qlg.tar.gz and /dev/null differ