Browse Source

logic

master
ZLW-PC\Administrator 6 years ago
parent
commit
7f44eec943
  1. 22
      app/Common/Helper.php
  2. 7
      app/Http/Controllers/Admin/ArticleController.php
  3. 31
      app/Http/Controllers/Admin/BonusController.php
  4. 4
      app/Http/Controllers/Admin/CategoryController.php
  5. 110
      app/Http/Controllers/Admin/FeedbackController.php
  6. 104
      app/Http/Controllers/Admin/FriendlinkController.php
  7. 102
      app/Http/Controllers/Admin/SlideController.php
  8. 2
      app/Http/Controllers/Api/OrderController.php
  9. 5
      app/Http/Logic/ArctypeLogic.php
  10. 6
      app/Http/Logic/ArticleLogic.php
  11. 4
      app/Http/Logic/BonusLogic.php
  12. 12
      app/Http/Logic/CartLogic.php
  13. 12
      app/Http/Logic/CollectGoodsLogic.php
  14. 12
      app/Http/Logic/CommentLogic.php
  15. 13
      app/Http/Logic/FeedbackLogic.php
  16. 12
      app/Http/Logic/FriendlinkLogic.php
  17. 12
      app/Http/Logic/GoodsBrandLogic.php
  18. 13
      app/Http/Logic/GoodsImgLogic.php
  19. 21
      app/Http/Logic/GoodsLogic.php
  20. 13
      app/Http/Logic/GoodsSearchwordLogic.php
  21. 13
      app/Http/Logic/GoodsTypeLogic.php
  22. 13
      app/Http/Logic/GuestbookLogic.php
  23. 12
      app/Http/Logic/KeywordLogic.php
  24. 12
      app/Http/Logic/KuaidiLogic.php
  25. 12
      app/Http/Logic/MenuLogic.php
  26. 12
      app/Http/Logic/OrderGoodsLogic.php
  27. 16
      app/Http/Logic/OrderLogic.php
  28. 14
      app/Http/Logic/PageLogic.php
  29. 12
      app/Http/Logic/PaymentLogic.php
  30. 12
      app/Http/Logic/RegionLogic.php
  31. 13
      app/Http/Logic/SearchwordLogic.php
  32. 6
      app/Http/Logic/SlideLogic.php
  33. 12
      app/Http/Logic/SmsLogLogic.php
  34. 12
      app/Http/Logic/SysconfigLogic.php
  35. 13
      app/Http/Logic/TagindexLogic.php
  36. 12
      app/Http/Logic/TaglistLogic.php
  37. 12
      app/Http/Logic/TokenLogic.php
  38. 12
      app/Http/Logic/UserAddressLogic.php
  39. 15
      app/Http/Logic/UserBonusLogic.php
  40. 12
      app/Http/Logic/UserGoodsHistoryLogic.php
  41. 6
      app/Http/Logic/UserLogic.php
  42. 12
      app/Http/Logic/UserMessageLogic.php
  43. 12
      app/Http/Logic/UserMoneyLogic.php
  44. 12
      app/Http/Logic/UserPointLogic.php
  45. 15
      app/Http/Logic/UserRechargeLogic.php
  46. 12
      app/Http/Logic/UserRoleLogic.php
  47. 4
      app/Http/Logic/UserWithdrawLogic.php
  48. 12
      app/Http/Logic/VerifyCodeLogic.php
  49. 13
      app/Http/Logic/WeixinMenuLogic.php
  50. 14
      app/Http/Model/Slide.php
  51. 2
      app/Http/Requests/FeedbackRequest.php
  52. 112
      app/Http/Requests/SlideRequest.php
  53. 4
      public/css/admin.css
  54. 2
      public/css/style.css
  55. BIN
      public/images/off.png
  56. BIN
      public/images/on.png
  57. 4
      resources/views/admin/friendlink/edit.blade.php
  58. 26
      resources/views/admin/slide/edit.blade.php
  59. 8
      resources/views/home/index/index.blade.php

22
app/Common/Helper.php

@ -165,6 +165,28 @@ class Helper
return $result;
}
/**
* 取得随机字符串
*
* @param int $length 生成随机数的长度
* @param int $numeric 是否只产生数字随机数 1是0否
* @return string
*/
public static function getRandomString($length, $numeric = 0)
{
$seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
$seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed));
$hash = '';
$max = strlen($seed) - 1;
for($i = 0; $i < $length; $i++)
{
$hash .= $seed{mt_rand(0, $max)};
}
return $hash;
}
//生成二维码
public static function qrcode($url,$size=150)
{

7
app/Http/Controllers/Admin/ArticleController.php

@ -89,9 +89,7 @@ class ArticleController extends CommonController
$litpic="";if(!empty($_POST["litpic"])){$litpic = $_POST["litpic"];}else{$_POST['litpic']="";} //缩略图
if(empty($_POST["description"])){if(!empty($_POST["body"])){$_POST['description']=cut_str($_POST["body"]);}} //description
$content="";if(!empty($_POST["body"])){$content = $_POST["body"];}
$_POST['pubdate'] = time();//更新时间
$_POST['addtime'] = time();//添加时间
$_POST['user_id'] = $_SESSION['admin_user_info']['id']; // 发布者id
$_POST['user_id'] = $_SESSION['admin_user_info']['id']; // 发布者id
//关键词
if(!empty($_POST["keywords"]))
@ -160,8 +158,7 @@ class ArticleController extends CommonController
$litpic="";if(!empty($_POST["litpic"])){$litpic = $_POST["litpic"];}else{$_POST['litpic']="";} //缩略图
if(empty($_POST["description"])){if(!empty($_POST["body"])){$_POST['description']=cut_str($_POST["body"]);}} //description
$content="";if(!empty($_POST["body"])){$content = $_POST["body"];}
$_POST['pubdate'] = time();//更新时间
if(!empty($_POST["keywords"]))
{
$_POST['keywords']=str_replace("",",",$_POST["keywords"]);

31
app/Http/Controllers/Admin/BonusController.php

@ -1,10 +1,10 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use App\Http\Model\Bonus;
use App\Common\Helper;
use Illuminate\Http\Request;
use App\Http\Model\Bonus;
use App\Http\Logic\BonusLogic;
class BonusController extends CommonController
{
@ -13,18 +13,37 @@ class BonusController extends CommonController
parent::__construct();
}
public function getLogic()
{
return logic('Bonus');
}
public function index()
{
$data['posts'] = parent::pageList('bonus', '', [['status', 'asc']]);
$res = '';
$where = function ($query) use ($res) {
if(isset($_REQUEST["keyword"]))
{
$query->where('name', 'like', '%'.$_REQUEST['keyword'].'%');
}
if(isset($_REQUEST["id"]))
{
$query->where('typeid', $_REQUEST["id"]);
}
};
if($data['posts'])
$posts = $this->getLogic()->getPaginate($where, array('status', 'asc'));
if($posts)
{
foreach($data['posts'] as $k=>$v)
foreach($posts as $k=>$v)
{
}
}
$data['posts'] = $posts;
return view('admin.bonus.index', $data);
}

4
app/Http/Controllers/Admin/CategoryController.php

@ -1,8 +1,8 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use App\Common\ReturnData;
use Illuminate\Http\Request;
class CategoryController extends CommonController
{

110
app/Http/Controllers/Admin/FeedbackController.php

@ -1,8 +1,11 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;
use App\Http\Logic\FeedbackLogic;
use App\Http\Model\Feedback;
class FeedbackController extends CommonController
{
@ -11,10 +14,38 @@ class FeedbackController extends CommonController
parent::__construct();
}
public function getLogic()
{
return new FeedbackLogic();
}
public function index()
{
$data['posts'] = parent::pageList('feedback');
$res = '';
$where = function ($query) use ($res) {
if(isset($_REQUEST["keyword"]))
{
$query->where('title', 'like', '%'.$_REQUEST['keyword'].'%');
}
if(isset($_REQUEST["user_id"]))
{
$query->where('user_id', $_REQUEST["user_id"]);
}
if(isset($_REQUEST["type"]))
{
$query->where('type', $_REQUEST["type"]);
}
if(isset($_REQUEST["mobile"]))
{
$query->where('mobile', $_REQUEST["mobile"]);
}
};
$posts = $this->getLogic()->getPaginate($where, array('id', 'desc'));
$data['posts'] = $posts;
return view('admin.feedback.index', $data);
}
@ -23,60 +54,61 @@ class FeedbackController extends CommonController
return view('admin.feedback.add');
}
public function doadd()
public function doadd(Request $request)
{
if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
unset($_POST["_token"]);
if(DB::table('feedback')->insert(array_filter($_POST)))
if(Helper::isPostRequest())
{
success_jump('添加成功!', route('admin_feedback'));
$res = $this->getLogic()->add($_POST);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump($res['msg'], route('admin_feedback'));
}
error_jump($res['msg']);
}
else
{
error_jump('添加失败!请修改后重新添加');
}
}
public function edit()
public function edit(Request $request)
{
if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";}
if(preg_match('/[0-9]*/',$id)){}else{exit;}
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
$data['id'] = $id;
$data['post'] = object_to_array(DB::table('feedback')->where('id', $id)->first(), 1);
$data['id'] = $where['id'] = $id;
$data['post'] = $this->getLogic()->getOne($where);
return view('admin.feedback.edit', $data);
}
public function doedit()
public function doedit(Request $request)
{
if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else{$id="";exit;}
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
unset($_POST["_token"]);
if(DB::table('feedback')->where('id', $id)->update($_POST))
if(Helper::isPostRequest())
{
success_jump('修改成功!', route('admin_slide'));
$where['id'] = $id;
$res = $this->getLogic()->edit($_POST, $where);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump($res['msg'], route('admin_feedback'));
}
error_jump($res['msg']);
}
else
{
error_jump('修改失败!');
}
}
public function del()
public function del(Request $request)
{
if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');}
if(DB::table('feedback')->whereIn("id", explode(',', $id))->delete())
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
$where['id'] = $id;
$res = $this->getLogic()->del($where);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump('删除成功');
success_jump($res['msg']);
}
else
{
error_jump('删除失败!请重新提交');
}
error_jump($res['msg']);
}
}

104
app/Http/Controllers/Admin/FriendlinkController.php

@ -1,8 +1,11 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;
use App\Http\Logic\FriendlinkLogic;
use App\Http\Model\Friendlink;
class FriendlinkController extends CommonController
{
@ -11,70 +14,91 @@ class FriendlinkController extends CommonController
parent::__construct();
}
public function index()
public function getLogic()
{
$posts = parent::pageList('friendlink');
$data['posts'] = $posts;
return new FriendlinkLogic();
}
public function index(Request $request)
{
$res = '';
$where = function ($query) use ($res) {
if(isset($_REQUEST["keyword"]))
{
$query->where('webname', 'like', '%'.$_REQUEST['keyword'].'%');
}
if(isset($_REQUEST["group_id"]))
{
$query->where('group_id', $_REQUEST["group_id"]);
}
};
return view('admin.friendlink.index', $data);
$posts = $this->getLogic()->getPaginate($where, array('listorder', 'asc'));
$data['posts'] = $posts;
return view('admin.friendlink.index', $data);
}
public function add()
public function add(Request $request)
{
return view('admin.friendlink.add');
}
public function doadd()
public function doadd(Request $request)
{
unset($_POST["_token"]);
if(DB::table('friendlink')->insert($_POST))
if(Helper::isPostRequest())
{
success_jump('添加成功!', route('admin_friendlink'));
$res = $this->getLogic()->add($_POST);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump($res['msg'], route('admin_friendlink'));
}
error_jump($res['msg']);
}
else
{
error_jump('添加失败!请修改后重新添加');
}
}
public function edit()
public function edit(Request $request)
{
if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";}
if(preg_match('/[0-9]*/',$id)){}else{exit;}
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
$data['id'] = $id;
$data['post'] = object_to_array(DB::table('friendlink')->where('id', $id)->first(), 1);
$data['id'] = $where['id'] = $id;
$data['post'] = $this->getLogic()->getOne($where);
return view('admin.friendlink.edit', $data);
}
public function doedit()
public function doedit(Request $request)
{
if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;}
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
unset($_POST["_token"]);
if(DB::table('friendlink')->where('id', $id)->update($_POST))
if(Helper::isPostRequest())
{
success_jump('修改成功!', route('admin_friendlink'));
$where['id'] = $id;
$res = $this->getLogic()->edit($_POST, $where);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump($res['msg'], route('admin_friendlink'));
}
error_jump($res['msg']);
}
else
{
error_jump('修改失败!');
}
}
public function del()
public function del(Request $request)
{
if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');}
if(DB::table('friendlink')->whereIn("id", explode(',', $id))->delete())
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
$where['id'] = $id;
$res = $this->getLogic()->del($where);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump('删除成功');
success_jump($res['msg']);
}
else
{
error_jump('删除失败!请重新提交');
}
error_jump($res['msg']);
}
}
}

102
app/Http/Controllers/Admin/SlideController.php

@ -1,8 +1,8 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use App\Common\ReturnData;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;
use App\Http\Logic\SlideLogic;
use App\Http\Model\Slide;
@ -19,74 +19,96 @@ class SlideController extends CommonController
return new SlideLogic();
}
public function index()
public function index(Request $request)
{
$where = '';
$posts = $this->getLogic()->getPaginate($where, array('id', 'desc'));
$res = '';
$where = function ($query) use ($res) {
if(isset($_REQUEST["keyword"]))
{
$query->where('title', 'like', '%'.$_REQUEST['keyword'].'%');
}
if(isset($_REQUEST["group_id"]))
{
$query->where('group_id', $_REQUEST["group_id"]);
}
if(isset($_REQUEST["is_show"]))
{
$query->where('is_show', $_REQUEST["is_show"]);
}
if(isset($_REQUEST["type"]))
{
$query->where('type', $_REQUEST["type"]);
}
};
$posts = $this->getLogic()->getPaginate($where, array('listorder', 'asc'));
$data['posts'] = $posts;
return view('admin.slide.index', $data);
}
public function add()
public function add(Request $request)
{
return view('admin.slide.add');
}
public function doadd()
public function doadd(Request $request)
{
if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
unset($_POST["_token"]);
if(DB::table('slide')->insert(array_filter($_POST)))
if(Helper::isPostRequest())
{
success_jump('添加成功!', route('admin_slide'));
$res = $this->getLogic()->add($_POST);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump($res['msg'], route('admin_slide'));
}
error_jump($res['msg']);
}
else
{
error_jump('添加失败!请修改后重新添加');
}
}
public function edit()
public function edit(Request $request)
{
if(!empty($_GET["id"])){$id = $_GET["id"];}else{$id="";}
if(preg_match('/[0-9]*/',$id)){}else{exit;}
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
$data['id'] = $id;
$data['post'] = object_to_array(DB::table('slide')->where('id', $id)->first(), 1);
$data['id'] = $where['id'] = $id;
$data['post'] = $this->getLogic()->getOne($where);
return view('admin.slide.edit', $data);
}
public function doedit()
public function doedit(Request $request)
{
if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else{$id="";exit;}
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
if(isset($_POST['editorValue'])){unset($_POST['editorValue']);}
unset($_POST["_token"]);
if(DB::table('slide')->where('id', $id)->update($_POST))
if(Helper::isPostRequest())
{
success_jump('修改成功!', route('admin_slide'));
$where['id'] = $id;
$res = $this->getLogic()->edit($_POST, $where);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump($res['msg'], route('admin_slide'));
}
error_jump($res['msg']);
}
else
{
error_jump('修改失败!');
}
}
public function del()
public function del(Request $request)
{
if(!empty($_GET["id"])){$id = $_GET["id"];}else{error_jump('删除失败!请重新提交');}
if(DB::table('slide')->whereIn("id", explode(',', $id))->delete())
if(!checkIsNumber($request->input('id',null))){error_jump('参数错误');}
$id = $request->input('id');
$where['id'] = $id;
$res = $this->getLogic()->del($where);
if($res['code'] == ReturnData::SUCCESS)
{
success_jump('删除成功');
success_jump($res['msg']);
}
else
{
error_jump('删除失败!请重新提交');
}
error_jump($res['msg']);
}
}

2
app/Http/Controllers/Api/OrderController.php

@ -18,7 +18,7 @@ class OrderController extends CommonController
public function getLogic()
{
return logic('Order');
return new OrderLogic();
}
public function orderList(Request $request)

5
app/Http/Logic/ArctypeLogic.php

@ -61,13 +61,13 @@ class ArctypeLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -91,6 +91,7 @@ class ArctypeLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['addtime'] = time();//添加时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

6
app/Http/Logic/ArticleLogic.php

@ -63,13 +63,13 @@ class ArticleLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -96,6 +96,7 @@ class ArticleLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['addtime'] = $data['pubdate'] = time();//添加、更新时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}
@ -110,6 +111,7 @@ class ArticleLogic extends BaseLogic
$validator = $this->getValidate($data, 'edit');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['pubdate'] = time();//更新时间
$res = $this->getModel()->edit($data,$where);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

4
app/Http/Logic/BonusLogic.php

@ -62,13 +62,13 @@ class BonusLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/CartLogic.php

@ -68,6 +68,14 @@ class CartLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -76,13 +84,13 @@ class CartLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/CollectGoodsLogic.php

@ -48,6 +48,14 @@ class CollectGoodsLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -56,13 +64,13 @@ class CollectGoodsLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/CommentLogic.php

@ -48,6 +48,14 @@ class CommentLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -56,13 +64,13 @@ class CommentLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

13
app/Http/Logic/FeedbackLogic.php

@ -45,6 +45,14 @@ class FeedBackLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class FeedBackLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -83,6 +91,7 @@ class FeedBackLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['add_time'] = time();
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

12
app/Http/Logic/FriendlinkLogic.php

@ -45,6 +45,14 @@ class FriendlinkLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class FriendlinkLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/GoodsBrandLogic.php

@ -45,6 +45,14 @@ class GoodsBrandLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class GoodsBrandLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

13
app/Http/Logic/GoodsImgLogic.php

@ -45,6 +45,14 @@ class GoodsImgLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class GoodsImgLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -80,6 +88,7 @@ class GoodsImgLogic extends BaseLogic
{
if(empty($data)){return ReturnData::create(ReturnData::PARAMS_ERROR);}
$data['add_time'] = time();//添加、更新时间
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}

21
app/Http/Logic/GoodsLogic.php

@ -50,6 +50,14 @@ class GoodsLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -58,15 +66,15 @@ class GoodsLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
if($res['count'] > 0)
if($res)
{
foreach($res['list'] as $k=>$v)
foreach($res as $k=>$v)
{
$res['list'][$k] = $this->getDataView($v);
$res[$k] = $this->getDataView($v);
$res['list'][$k]->price = $this->getModel()->get_goods_final_price($v); //商品最终价格
$res['list'][$k]->is_promote_goods = $this->getModel()->bargain_price($v->promote_price,$v->promote_start_date,$v->promote_end_date); //is_promote_goods等于0,说明不是促销商品
$res['list'][$k]->goods_detail_url = route('weixin_goods_detail',array('id'=>$v->id));
$res[$k]->price = $this->getModel()->get_goods_final_price($v); //商品最终价格
$res[$k]->is_promote_goods = $this->getModel()->bargain_price($v->promote_price,$v->promote_start_date,$v->promote_end_date); //is_promote_goods等于0,说明不是促销商品
$res[$k]->goods_detail_url = route('weixin_goods_detail',array('id'=>$v->id));
}
}
@ -104,6 +112,7 @@ class GoodsLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['add_time'] = $data['pubdate'] = time();//添加、更新时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

13
app/Http/Logic/GoodsSearchwordLogic.php

@ -45,6 +45,14 @@ class GoodsSearchwordLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class GoodsSearchwordLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -83,6 +91,7 @@ class GoodsSearchwordLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['add_time'] = time();//添加时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

13
app/Http/Logic/GoodsTypeLogic.php

@ -45,6 +45,14 @@ class GoodsTypeLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class GoodsTypeLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -83,6 +91,7 @@ class GoodsTypeLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['addtime'] = time();//添加、更新时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

13
app/Http/Logic/GuestbookLogic.php

@ -45,6 +45,14 @@ class GuestbookLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class GuestbookLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -83,6 +91,7 @@ class GuestbookLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['addtime'] = time();//添加时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

12
app/Http/Logic/KeywordLogic.php

@ -45,6 +45,14 @@ class KeywordLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class KeywordLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/KuaidiLogic.php

@ -45,6 +45,14 @@ class KuaidiLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class KuaidiLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/MenuLogic.php

@ -45,6 +45,14 @@ class MenuLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class MenuLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/OrderGoodsLogic.php

@ -45,6 +45,14 @@ class OrderGoodsLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class OrderGoodsLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

16
app/Http/Logic/OrderLogic.php

@ -57,6 +57,14 @@ class OrderLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -65,13 +73,13 @@ class OrderLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -165,10 +173,12 @@ class OrderLogic extends BaseLogic
$pay_status = 1; //已付款
}
$time = time();
//构造订单字段
$order_info = array(
'order_sn' => date('YmdHis').rand(1000,9999),
'add_time' => time(),
'add_time' => $time,
'updated_at' => $time,
'pay_status' => $pay_status,
'user_id' => $data['user_id'],
'goods_amount' => $order_goods['total_price'], //商品的总金额

14
app/Http/Logic/PageLogic.php

@ -45,6 +45,14 @@ class PageLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class PageLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -83,6 +91,7 @@ class PageLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['pubdate'] = time();//添加时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}
@ -97,6 +106,7 @@ class PageLogic extends BaseLogic
$validator = $this->getValidate($data, 'edit');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['pubdate'] = time();//更新时间
$res = $this->getModel()->edit($data,$where);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

12
app/Http/Logic/PaymentLogic.php

@ -45,6 +45,14 @@ class PaymentLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class PaymentLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/RegionLogic.php

@ -45,6 +45,14 @@ class RegionLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class RegionLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

13
app/Http/Logic/SearchwordLogic.php

@ -45,6 +45,14 @@ class SearchwordLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class SearchwordLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -83,6 +91,7 @@ class SearchwordLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['pubdate'] = time();//添加时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

6
app/Http/Logic/SlideLogic.php

@ -61,13 +61,13 @@ class SlideLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -105,7 +105,7 @@ class SlideLogic extends BaseLogic
$validator = $this->getValidate($data, 'edit');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$res = $this->getModel()->edit($data,$where);
$res = $this->getModel()->edit($data, $where);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}
return ReturnData::create(ReturnData::FAIL);

12
app/Http/Logic/SmsLogLogic.php

@ -45,6 +45,14 @@ class SmsLogLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class SmsLogLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/SysconfigLogic.php

@ -45,6 +45,14 @@ class SysconfigLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class SysconfigLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

13
app/Http/Logic/TagindexLogic.php

@ -45,6 +45,14 @@ class TagindexLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class TagindexLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -83,6 +91,7 @@ class TagindexLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['pubdate'] = time();//添加时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

12
app/Http/Logic/TaglistLogic.php

@ -45,6 +45,14 @@ class TaglistLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class TaglistLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/TokenLogic.php

@ -45,6 +45,14 @@ class TokenLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class TokenLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/UserAddressLogic.php

@ -47,6 +47,14 @@ class UserAddressLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -55,13 +63,13 @@ class UserAddressLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

15
app/Http/Logic/UserBonusLogic.php

@ -46,6 +46,14 @@ class UserBonusLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -54,13 +62,13 @@ class UserBonusLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -85,7 +93,7 @@ class UserBonusLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['get_time'] = time();
$data['get_time'] = time(); //优惠券获取时间
$bonus = model('Bonus')->getOne(['id'=>$data['bonus_id']]);
if(!$bonus){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'亲,您来晚了啦,已被抢光了');}
@ -93,7 +101,6 @@ class UserBonusLogic extends BaseLogic
if($this->getModel()->getOne(['bonus_id'=>$data['bonus_id'],'user_id'=>$data['user_id']])){return ReturnData::create(ReturnData::PARAMS_ERROR,null,'亲,您已获取!');}
$data['get_time'] = time(); //优惠券获取时间
$res = $this->getModel()->add($data,$type);
if($res)
{

12
app/Http/Logic/UserGoodsHistoryLogic.php

@ -48,6 +48,14 @@ class UserGoodsHistoryLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -56,13 +64,13 @@ class UserGoodsHistoryLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

6
app/Http/Logic/UserLogic.php

@ -67,13 +67,13 @@ class UserLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -101,6 +101,7 @@ class UserLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['add_time'] = $data['updated_at'] = time();//添加、更新时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}
@ -116,7 +117,6 @@ class UserLogic extends BaseLogic
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['updated_at'] =time();
$res = $this->getModel()->edit($data,$where);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

12
app/Http/Logic/UserMessageLogic.php

@ -45,6 +45,14 @@ class UserMessageLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class UserMessageLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/UserMoneyLogic.php

@ -46,6 +46,14 @@ class UserMoneyLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -54,13 +62,13 @@ class UserMoneyLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/UserPointLogic.php

@ -46,6 +46,14 @@ class UserPointLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -54,13 +62,13 @@ class UserPointLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

15
app/Http/Logic/UserRechargeLogic.php

@ -46,6 +46,14 @@ class UserRechargeLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -54,13 +62,13 @@ class UserRechargeLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -82,7 +90,7 @@ class UserRechargeLogic extends BaseLogic
if(empty($data)){return ReturnData::create(ReturnData::PARAMS_ERROR);}
$data['recharge_sn'] = date('YmdHis').rand(1000,9999);
$data['created_at'] = time();
$data['created_at'] = $data['updated_at'] = time();
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
@ -101,6 +109,7 @@ class UserRechargeLogic extends BaseLogic
$validator = $this->getValidate($data, 'edit');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['updated_at'] = time();
$res = $this->getModel()->edit($data,$where);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

12
app/Http/Logic/UserRoleLogic.php

@ -45,6 +45,14 @@ class UserRoleLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class UserRoleLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

4
app/Http/Logic/UserWithdrawLogic.php

@ -64,13 +64,13 @@ class UserWithdrawLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

12
app/Http/Logic/VerifyCodeLogic.php

@ -45,6 +45,14 @@ class VerifyCodeLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class VerifyCodeLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}

13
app/Http/Logic/WeixinMenuLogic.php

@ -45,6 +45,14 @@ class WeixinMenuLogic extends BaseLogic
{
$res = $this->getModel()->getPaginate($where, $order, $field, $limit);
if($res->count() > 0)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
}
return $res;
}
@ -53,13 +61,13 @@ class WeixinMenuLogic extends BaseLogic
{
$res = $this->getModel()->getAll($where, $order, $field, $limit);
/* if($res)
if($res)
{
foreach($res as $k=>$v)
{
$res[$k] = $this->getDataView($v);
}
} */
}
return $res;
}
@ -83,6 +91,7 @@ class WeixinMenuLogic extends BaseLogic
$validator = $this->getValidate($data, 'add');
if ($validator->fails()){return ReturnData::create(ReturnData::PARAMS_ERROR, null, $validator->errors()->first());}
$data['addtime'] = time(); //添加时间
$res = $this->getModel()->add($data,$type);
if($res){return ReturnData::create(ReturnData::SUCCESS,$res);}

14
app/Http/Model/Slide.php

@ -170,4 +170,18 @@ class Slide extends BaseModel
$arr = array(0 => 'pc', 1 => 'weixin', 2 => 'app', 3 => 'wap');
return $arr[$data->type];
}
//是否显示,默认0显示
public function getIsShowAttr($data)
{
$arr = array(0 => '显示', 1 => '隐藏');
return $arr[$data->is_show];
}
//跳转方式,0_blank,1_self,2_parent,3_top,4framename
public function getTargetAttr($data)
{
$arr = array(0 => '_blank', 1 => '_self', 2 => '_parent', 3 => '_top', 4 => 'framename');
return $arr[$data->target];
}
}

2
app/Http/Requests/FeedbackRequest.php

@ -30,7 +30,7 @@ class FeedbackRequest extends BaseRequest
//场景验证规则
protected $scene = [
'add' => ['content', 'add_time', 'title', 'user_id', 'mobile', 'type'],
'add' => ['content', 'title', 'mobile', 'type'],
'edit' => ['content', 'title', 'mobile', 'type'],
'del' => ['id'],
];

112
app/Http/Requests/SlideRequest.php

@ -1,24 +1,104 @@
<?php
namespace app\common\validate;
namespace App\Http\Requests;
use think\Validate;
class Slide extends Validate
class SlideRequest extends BaseRequest
{
// 验证规则
protected $rule = [
['id', 'require|number','ID必填|ID必须是数字'],
['title', 'require|max:150','标题必填|标题不能超过150个字符'],
['url', 'max:100','跳转链接不能超过100个字符'],
['target', 'number', '跳转方式必须是数字'],
['group_id', 'number', '分组ID必须是数字'],
['rank', 'number','排序必须是数字'],
['pic', 'max:100','图片地址不能超过100个字符'],
['is_show', 'in:0,1','是否显示,默认0显示'],
//总的验证规则
protected $rules = [
'id' => 'required|integer',
'title' => 'required|max:150',
'url' => 'max:100',
'target' => 'integer|between:0,5',
'group_id' => 'integer',
'listorder' => 'integer',
'pic' => 'required|max:100',
'is_show' => 'integer|between:0,2',
'type' => 'integer|between:0,5'
];
//总的自定义错误信息
protected $messages = [
'id.required' => 'ID必填',
'id.integer' => 'ID必须为数字',
'title.required' => '标题必填',
'title.max' => '标题不能超过150个字符',
'url.max' => 'url不能超过100个字符',
'target.integer' => 'target必须为数字',
'target.between' => '跳转方式,0_blank,1_self,2_parent,3_top,4framename',
'group_id.integer' => '分组ID必须是数字',
'listorder.integer' => '排序必须是数字',
'pic.required' => '图片',
'pic.max' => '图片地址不能超过100个字符',
'is_show.integer' => '是否显示必须为数字',
'is_show.between' => '是否显示,默认0显示',
'type.integer' => '类型必须为数字',
'type.between' => '类型0pc,1weixin,2app,3wap',
];
//场景验证规则
protected $scene = [
'add' => ['title', 'url', 'target', 'group_id', 'rank', 'pic', 'is_show'],
'del' => ['id'],
'add' => ['title', 'url', 'target', 'group_id', 'listorder', 'pic', 'is_show', 'type'],
'edit' => ['title', 'url', 'target', 'group_id', 'listorder', 'pic', 'is_show', 'type'],
'del' => ['id'],
];
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true; //修改为true
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return $this->rules;
}
/**
* 获取被定义验证规则的错误消息.
*
* @return array
*/
public function messages()
{
return $this->messages;
}
//获取场景验证规则
public function getSceneRules($name, $fields = null)
{
$res = array();
if(!isset($this->scene[$name]))
{
return false;
}
$scene = $this->scene[$name];
if($fields != null && is_array($fields))
{
$scene = $fields;
}
foreach($scene as $k=>$v)
{
if(isset($this->rules[$v])){$res[$v] = $this->rules[$v];}
}
return $res;
}
//获取场景验证规则自定义错误信息
public function getSceneRulesMessages()
{
return $this->messages;
}
}

4
public/css/admin.css

@ -44,8 +44,8 @@ input[type="text"],input[type="password"]{padding:4px 5px;vertical-align:middle;
.menu ul{padding:0;}
.menu ul li{background-color:#f2f2f2;border:solid 1px #E5E5E5;border-bottom:0;}
.menu ul li a{padding-left:20px;color:#444;display:block;height:45px;line-height:45px;position:relative;font-size:16px;}
.menu ul li .inactive{background:url(/images/off.png) no-repeat 90% center;}
.menu ul li .active{background:url(/images/on.png) no-repeat 90% center;color:#01aef0;}
.menu ul li .inactive{/* background:url(../images/off.png) no-repeat 90% center; */}
.menu ul li .active{/* background:url(../images/on.png) no-repeat 90% center; */color:#01aef0;}
.menu ul li ul{display:none;padding:0;}
.menu ul li ul li{border-left:0;border-right:0;background-color:#fafafa;border-color:#eee;}
.menu ul li ul li ul{display:none;padding:0;}

2
public/css/style.css

@ -1,6 +1,6 @@
body,h1,h2,h3,h4,h5,h6,p,ul,ol,dl,dd,form,input,textarea,select,button{margin:0;padding:0;}em,i{font-style:normal;}
li,ul{list-style:none;}ul{zoom:1;}img{border:none;border:0;margin:0;padding:0;vertical-align:top;}.cl{clear:both;}.fl,.mfl{float:left;}.fr,.mfr{float:right;}.m-auto{margin:0 auto;}
body{font-size:14px;color:#313131;font-family:arial,'Hiragino Sans GB',"Microsoft YaHei","Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,Verdana,tahoma,simsun,sans-serif;}.yaheis a,.yahei{font-family:Microsoft YaHei,"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,Verdana,tahoma,simsun,sans-serif;}
body{font-size:14px;color:#313131;font-family:"Microsoft Yahei","微软雅黑",Verdana,arial,'Hiragino Sans GB',"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,tahoma,simsun,sans-serif;}.yaheis a,.yahei{font-family:Microsoft YaHei,"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,Verdana,tahoma,simsun,sans-serif;}
a{color:#313131;text-decoration:none;}a:hover{text-decoration:none;color:#22ac38;}.clear{zoom:1;}.clear:after,.imglist2:after{content:"";display:block;clear:both;}
.mt10{margin-top:10px;}.mb10{margin-bottom:10px;}.zcs a,.zc{color:#c39;}.reds a,.red{color:#22ac38;}.blues a,.blue{color:#0078b6;}.grey,.greys a{color:#999;}.chs a:hover{color:#22ac38;}

BIN
public/images/off.png

Binary file not shown.

After

Width: 28  |  Height: 19  |  Size: 280 B

BIN
public/images/on.png

Binary file not shown.

After

Width: 28  |  Height: 19  |  Size: 215 B

4
resources/views/admin/friendlink/edit.blade.php

@ -9,11 +9,11 @@
<tbody>
<tr>
<td>链接名称:</td>
<td><input name="webname" type="text" id="webname" value="<?php echo $post["webname"]; ?>" class="required" style="width:30%" placeholder="在此输入关键词"><input style="display:none;" name="id" type="text" id="id" value="<?php echo $id; ?>"></td>
<td><input name="webname" type="text" id="webname" value="<?php echo $post->webname; ?>" class="required" style="width:30%" placeholder="在此输入关键词"><input style="display:none;" name="id" type="text" id="id" value="<?php echo $id; ?>"></td>
</tr>
<tr>
<td>链接网址:</td>
<td><input name="url" type="text" id="rpurl" value="<?php echo $post["url"]; ?>" style="width:60%" class="required"> (请用绝对地址)</td>
<td><input name="url" type="text" id="rpurl" value="<?php echo $post->url; ?>" style="width:60%" class="required"> (请用绝对地址)</td>
</tr>
<tr>
<td colspan="2"><button type="submit" class="btn btn-success" value="Submit">保存(Submit)</button>&nbsp;&nbsp;<button type="reset" class="btn btn-default" value="Reset">重置(Reset)</button></td>

26
resources/views/admin/slide/edit.blade.php

@ -9,50 +9,50 @@
<tbody>
<tr>
<td align="right">标题:</td>
<td><input name="title" type="text" id="title" value="<?php echo $post['title']; ?>" class="required" style="width:30%" placeholder="在此输入关键词"><input style="display:none;" name="id" type="text" id="id" value="<?php echo $id; ?>"></td>
<td><input name="title" type="text" id="title" value="<?php echo $post->title; ?>" class="required" style="width:30%" placeholder="在此输入关键词"><input style="display:none;" name="id" type="text" id="id" value="<?php echo $id; ?>"></td>
</tr>
<tr>
<td align="right">链接网址:</td>
<td><input name="url" type="text" id="url" value="<?php echo $post['url']; ?>" style="width:60%" class="required"> (请用绝对地址)</td>
<td><input name="url" type="text" id="url" value="<?php echo $post->url; ?>" style="width:60%" class="required"> (请用绝对地址)</td>
</tr>
<tr>
<td align="right">跳转方式:</td>
<td>
<input type="radio" value='0' name="target" <?php if(isset($post['target']) && $post['target']==0){echo 'checked';} ?> />&nbsp;_blank&nbsp;&nbsp;
<input type="radio" value='1' name="target" <?php if(isset($post['target']) && $post['target']==1){echo 'checked';} ?> />&nbsp;_self
<input type="radio" value='0' name="target" <?php if(isset($post->target) && $post->target==0){echo 'checked';} ?> />&nbsp;_blank&nbsp;&nbsp;
<input type="radio" value='1' name="target" <?php if(isset($post->target) && $post->target==1){echo 'checked';} ?> />&nbsp;_self
</td>
</tr>
<tr>
<td align="right">显示平台:</td>
<td>
<input type="radio" value='0' name="type" <?php if(isset($post['type']) && $post['type']==0){echo 'checked';} ?> />&nbsp;pc&nbsp;&nbsp;
<input type="radio" value='1' name="type" <?php if(isset($post['type']) && $post['type']==1){echo 'checked';} ?> />&nbsp;weixin&nbsp;&nbsp;
<input type="radio" value='2' name="type" <?php if(isset($post['type']) && $post['type']==2){echo 'checked';} ?> />&nbsp;app&nbsp;&nbsp;
<input type="radio" value='3' name="type" <?php if(isset($post['type']) && $post['type']==3){echo 'checked';} ?> />&nbsp;wap
<input type="radio" value='0' name="type" <?php if(isset($post->type) && $post->type==0){echo 'checked';} ?> />&nbsp;pc&nbsp;&nbsp;
<input type="radio" value='1' name="type" <?php if(isset($post->type) && $post->type==1){echo 'checked';} ?> />&nbsp;weixin&nbsp;&nbsp;
<input type="radio" value='2' name="type" <?php if(isset($post->type) && $post->type==2){echo 'checked';} ?> />&nbsp;app&nbsp;&nbsp;
<input type="radio" value='3' name="type" <?php if(isset($post->type) && $post->type==3){echo 'checked';} ?> />&nbsp;wap
</td>
</tr>
<tr>
<td align="right">是否显示:</td>
<td>
<input type="radio" value='0' name="is_show" <?php if(isset($post['is_show']) && $post['is_show']==0){echo 'checked';} ?> />&nbsp;是&nbsp;&nbsp;
<input type="radio" value='1' name="is_show" <?php if(isset($post['is_show']) && $post['is_show']==1){echo 'checked';} ?> />&nbsp;否
<input type="radio" value='0' name="is_show" <?php if(isset($pos->is_show) && $pos->is_show==0){echo 'checked';} ?> />&nbsp;是&nbsp;&nbsp;
<input type="radio" value='1' name="is_show" <?php if(isset($pos->is_show) && $pos->is_show==1){echo 'checked';} ?> />&nbsp;否
</td>
</tr>
<tr>
<td align="right">排序:</td>
<td>
<input name="listorder" type="text" id="listorder" value="<?php echo $post['listorder']; ?>" size="3" />
<input name="listorder" type="text" id="listorder" value="<?php echo $post->listorder; ?>" size="3" />
</td>
</tr>
<tr>
<td align="right">所属的组:</td>
<td>
<input name="group_id" type="text" id="group_id" value="<?php echo $post['group_id']; ?>" size="3" />
<input name="group_id" type="text" id="group_id" value="<?php echo $post->group_id; ?>" size="3" />
</td>
</tr>
<tr>
<td style="vertical-align:middle;" align="right">图片:</td>
<td style="vertical-align:middle;"><button type="button" onclick="upImage();">选择图片</button> <input name="pic" type="text" id="pic" value="<?php echo $post['pic']; ?>" style="width:40%"> <img style="margin-left:20px;<?php if(empty($post["pic"]) || !imgmatch($post["pic"])){ echo "display:none;"; } ?>" src="<?php if(imgmatch($post["pic"])){echo $post["pic"];} ?>" width="120" height="80" id="picview"></td>
<td style="vertical-align:middle;"><button type="button" onclick="upImage();">选择图片</button> <input name="pic" type="text" id="pic" value="<?php echo $post->pic; ?>" style="width:40%"> <img style="margin-left:20px;<?php if(empty($post->pic) || !imgmatch($post->pic)){ echo "display:none;"; } ?>" src="<?php if(imgmatch($post->pic)){echo $post->pic;} ?>" width="120" height="80" id="picview"></td>
</tr>
<!-- 配置文件 --><script type="text/javascript" src="/other/flueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 --><script type="text/javascript" src="/other/flueditor/ueditor.all.js"></script>

8
resources/views/home/index/index.blade.php

@ -94,8 +94,12 @@ var swiper = new Swiper('.swiper-container', {
</li>
</ul></div>
<style>
.index-tit span a{font-size:14px;color:#666;font-weight:400;}
.index-tit .spilt{margin:0 12px;font-size:14px;font-weight:400;}
</style>
<div class="box">
<p style="font-weight:bold;font-size:24px;color:#333;margin-top:30px;margin-bottom:20px;">编辑推荐</p>
<p class="index-tit" style="font-weight:bold;font-size:28px;color:#333;margin-top:30px;margin-bottom:20px;">编辑推荐<small style="margin-left:20px;font-size:14px;color:#666;font-weight:400;">工厂直达消费者,剔除品牌溢价</small><span style="float:right;"><a href="">夏凉</a><b class="spilt">/</b><a href="">夏凉</a><b class="spilt">/</b><a href="">夏凉</a><b class="spilt">/</b><a href="">夏凉</a><b class="spilt">/</b><a href="">夏凉</a><b class="spilt">/</b><a href="">夏凉</a><a style="margin-left:20px;" href="">查看更多 ></a></span></p>
<ul class="pul">
<?php if($tjlist){foreach($tjlist as $k=>$v){ ?>
<li><a href="<?php echo route('home_goods',array('id'=>$v['id'])); ?>" target="_blank"><img src="<?php echo $v['litpic']; ?>" alt="<?php echo $v['title']; ?>">
@ -109,7 +113,7 @@ var swiper = new Swiper('.swiper-container', {
</ul></div>
<div class="box">
<p style="font-weight:bold;font-size:24px;color:#333;margin-top:30px;margin-bottom:20px;">热门商品</p>
<p style="font-weight:bold;font-size:28px;color:#333;margin-top:30px;margin-bottom:20px;">热门商品</p>
<ul class="pul" id="goods_list">
<?php if($list){foreach($list as $k=>$v){ ?>
<li><a href="<?php echo route('home_goods',array('id'=>$v['id'])); ?>" target="_blank"><img src="<?php echo $v['litpic']; ?>" alt="<?php echo $v['title']; ?>">

Loading…
Cancel
Save