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 @@ - + +