diff --git a/app/Common/Helper.php b/app/Common/Helper.php index 9ddd24a..04d520c 100644 --- a/app/Common/Helper.php +++ b/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) { diff --git a/app/Http/Controllers/Admin/ArticleController.php b/app/Http/Controllers/Admin/ArticleController.php index beab04c..842a9c9 100644 --- a/app/Http/Controllers/Admin/ArticleController.php +++ b/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"]); diff --git a/app/Http/Controllers/Admin/BonusController.php b/app/Http/Controllers/Admin/BonusController.php index 9bf695e..c5fcd30 100644 --- a/app/Http/Controllers/Admin/BonusController.php +++ b/app/Http/Controllers/Admin/BonusController.php @@ -1,10 +1,10 @@ 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); } diff --git a/app/Http/Controllers/Admin/CategoryController.php b/app/Http/Controllers/Admin/CategoryController.php index 6c2fcb9..1fb50df 100644 --- a/app/Http/Controllers/Admin/CategoryController.php +++ b/app/Http/Controllers/Admin/CategoryController.php @@ -1,8 +1,8 @@ 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']); } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/FriendlinkController.php b/app/Http/Controllers/Admin/FriendlinkController.php index 01a770c..a5796ff 100644 --- a/app/Http/Controllers/Admin/FriendlinkController.php +++ b/app/Http/Controllers/Admin/FriendlinkController.php @@ -1,8 +1,11 @@ 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']); } -} +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/SlideController.php b/app/Http/Controllers/Admin/SlideController.php index fef4036..7440e47 100644 --- a/app/Http/Controllers/Admin/SlideController.php +++ b/app/Http/Controllers/Admin/SlideController.php @@ -1,8 +1,8 @@ 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']); } } \ No newline at end of file diff --git a/app/Http/Controllers/Api/OrderController.php b/app/Http/Controllers/Api/OrderController.php index 744c8ba..2c33638 100644 --- a/app/Http/Controllers/Api/OrderController.php +++ b/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) diff --git a/app/Http/Logic/ArctypeLogic.php b/app/Http/Logic/ArctypeLogic.php index be8f9eb..55a1fc1 100644 --- a/app/Http/Logic/ArctypeLogic.php +++ b/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);} diff --git a/app/Http/Logic/ArticleLogic.php b/app/Http/Logic/ArticleLogic.php index d91f0bf..7c46ffc 100644 --- a/app/Http/Logic/ArticleLogic.php +++ b/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);} diff --git a/app/Http/Logic/BonusLogic.php b/app/Http/Logic/BonusLogic.php index 25fcbc4..f615efd 100644 --- a/app/Http/Logic/BonusLogic.php +++ b/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; } diff --git a/app/Http/Logic/CartLogic.php b/app/Http/Logic/CartLogic.php index 1b74718..34c2f30 100644 --- a/app/Http/Logic/CartLogic.php +++ b/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; } diff --git a/app/Http/Logic/CollectGoodsLogic.php b/app/Http/Logic/CollectGoodsLogic.php index 788edac..2b542a3 100644 --- a/app/Http/Logic/CollectGoodsLogic.php +++ b/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; } diff --git a/app/Http/Logic/CommentLogic.php b/app/Http/Logic/CommentLogic.php index 0c891a4..4ee91ea 100644 --- a/app/Http/Logic/CommentLogic.php +++ b/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; } diff --git a/app/Http/Logic/FeedbackLogic.php b/app/Http/Logic/FeedbackLogic.php index 2111b72..bd2c421 100644 --- a/app/Http/Logic/FeedbackLogic.php +++ b/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);} diff --git a/app/Http/Logic/FriendlinkLogic.php b/app/Http/Logic/FriendlinkLogic.php index f522768..bf8fb03 100644 --- a/app/Http/Logic/FriendlinkLogic.php +++ b/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; } diff --git a/app/Http/Logic/GoodsBrandLogic.php b/app/Http/Logic/GoodsBrandLogic.php index 8df75c2..7f02bc1 100644 --- a/app/Http/Logic/GoodsBrandLogic.php +++ b/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; } diff --git a/app/Http/Logic/GoodsImgLogic.php b/app/Http/Logic/GoodsImgLogic.php index 543f053..dc0f09a 100644 --- a/app/Http/Logic/GoodsImgLogic.php +++ b/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());} diff --git a/app/Http/Logic/GoodsLogic.php b/app/Http/Logic/GoodsLogic.php index 9cad4f7..66c3fda 100644 --- a/app/Http/Logic/GoodsLogic.php +++ b/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);} diff --git a/app/Http/Logic/GoodsSearchwordLogic.php b/app/Http/Logic/GoodsSearchwordLogic.php index 0545bff..2a89503 100644 --- a/app/Http/Logic/GoodsSearchwordLogic.php +++ b/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);} diff --git a/app/Http/Logic/GoodsTypeLogic.php b/app/Http/Logic/GoodsTypeLogic.php index 428a2c7..7817224 100644 --- a/app/Http/Logic/GoodsTypeLogic.php +++ b/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);} diff --git a/app/Http/Logic/GuestbookLogic.php b/app/Http/Logic/GuestbookLogic.php index b63fc2e..a25289f 100644 --- a/app/Http/Logic/GuestbookLogic.php +++ b/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);} diff --git a/app/Http/Logic/KeywordLogic.php b/app/Http/Logic/KeywordLogic.php index 2f03558..72e9e96 100644 --- a/app/Http/Logic/KeywordLogic.php +++ b/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; } diff --git a/app/Http/Logic/KuaidiLogic.php b/app/Http/Logic/KuaidiLogic.php index 4b4ac40..777795d 100644 --- a/app/Http/Logic/KuaidiLogic.php +++ b/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; } diff --git a/app/Http/Logic/MenuLogic.php b/app/Http/Logic/MenuLogic.php index 34b5b36..9bf3f21 100644 --- a/app/Http/Logic/MenuLogic.php +++ b/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; } diff --git a/app/Http/Logic/OrderGoodsLogic.php b/app/Http/Logic/OrderGoodsLogic.php index e508f28..38b6b04 100644 --- a/app/Http/Logic/OrderGoodsLogic.php +++ b/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; } diff --git a/app/Http/Logic/OrderLogic.php b/app/Http/Logic/OrderLogic.php index da16a2c..1395c3a 100644 --- a/app/Http/Logic/OrderLogic.php +++ b/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'], //商品的总金额 diff --git a/app/Http/Logic/PageLogic.php b/app/Http/Logic/PageLogic.php index 400c34a..d4e21ba 100644 --- a/app/Http/Logic/PageLogic.php +++ b/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);} diff --git a/app/Http/Logic/PaymentLogic.php b/app/Http/Logic/PaymentLogic.php index 3d5b271..678d0af 100644 --- a/app/Http/Logic/PaymentLogic.php +++ b/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; } diff --git a/app/Http/Logic/RegionLogic.php b/app/Http/Logic/RegionLogic.php index 6f91c39..89bfdac 100644 --- a/app/Http/Logic/RegionLogic.php +++ b/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; } diff --git a/app/Http/Logic/SearchwordLogic.php b/app/Http/Logic/SearchwordLogic.php index a102a1b..5dd18dd 100644 --- a/app/Http/Logic/SearchwordLogic.php +++ b/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);} diff --git a/app/Http/Logic/SlideLogic.php b/app/Http/Logic/SlideLogic.php index 7994a2e..e4696c0 100644 --- a/app/Http/Logic/SlideLogic.php +++ b/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); diff --git a/app/Http/Logic/SmsLogLogic.php b/app/Http/Logic/SmsLogLogic.php index ea4f2b8..fec69c0 100644 --- a/app/Http/Logic/SmsLogLogic.php +++ b/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; } diff --git a/app/Http/Logic/SysconfigLogic.php b/app/Http/Logic/SysconfigLogic.php index 6e47236..e462f9e 100644 --- a/app/Http/Logic/SysconfigLogic.php +++ b/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; } diff --git a/app/Http/Logic/TagindexLogic.php b/app/Http/Logic/TagindexLogic.php index 180b068..2801018 100644 --- a/app/Http/Logic/TagindexLogic.php +++ b/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);} diff --git a/app/Http/Logic/TaglistLogic.php b/app/Http/Logic/TaglistLogic.php index 73dfb30..0c70e7d 100644 --- a/app/Http/Logic/TaglistLogic.php +++ b/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; } diff --git a/app/Http/Logic/TokenLogic.php b/app/Http/Logic/TokenLogic.php index c9ab768..58081be 100644 --- a/app/Http/Logic/TokenLogic.php +++ b/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; } diff --git a/app/Http/Logic/UserAddressLogic.php b/app/Http/Logic/UserAddressLogic.php index 9800d16..5280106 100644 --- a/app/Http/Logic/UserAddressLogic.php +++ b/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; } diff --git a/app/Http/Logic/UserBonusLogic.php b/app/Http/Logic/UserBonusLogic.php index 80325e7..047f5ee 100644 --- a/app/Http/Logic/UserBonusLogic.php +++ b/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) { diff --git a/app/Http/Logic/UserGoodsHistoryLogic.php b/app/Http/Logic/UserGoodsHistoryLogic.php index 1d229b9..5504c90 100644 --- a/app/Http/Logic/UserGoodsHistoryLogic.php +++ b/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; } diff --git a/app/Http/Logic/UserLogic.php b/app/Http/Logic/UserLogic.php index 84ee37e..2dbee0d 100644 --- a/app/Http/Logic/UserLogic.php +++ b/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);} diff --git a/app/Http/Logic/UserMessageLogic.php b/app/Http/Logic/UserMessageLogic.php index 335a37d..90dda93 100644 --- a/app/Http/Logic/UserMessageLogic.php +++ b/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; } diff --git a/app/Http/Logic/UserMoneyLogic.php b/app/Http/Logic/UserMoneyLogic.php index 84c020e..41cea9d 100644 --- a/app/Http/Logic/UserMoneyLogic.php +++ b/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; } diff --git a/app/Http/Logic/UserPointLogic.php b/app/Http/Logic/UserPointLogic.php index 28b535d..b6c3cbe 100644 --- a/app/Http/Logic/UserPointLogic.php +++ b/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; } diff --git a/app/Http/Logic/UserRechargeLogic.php b/app/Http/Logic/UserRechargeLogic.php index f798930..03f75e8 100644 --- a/app/Http/Logic/UserRechargeLogic.php +++ b/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);} diff --git a/app/Http/Logic/UserRoleLogic.php b/app/Http/Logic/UserRoleLogic.php index be7d4af..009d6bd 100644 --- a/app/Http/Logic/UserRoleLogic.php +++ b/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; } diff --git a/app/Http/Logic/UserWithdrawLogic.php b/app/Http/Logic/UserWithdrawLogic.php index 1e506d0..2900de3 100644 --- a/app/Http/Logic/UserWithdrawLogic.php +++ b/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; } diff --git a/app/Http/Logic/VerifyCodeLogic.php b/app/Http/Logic/VerifyCodeLogic.php index 5b9b59f..07b24fb 100644 --- a/app/Http/Logic/VerifyCodeLogic.php +++ b/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; } diff --git a/app/Http/Logic/WeixinMenuLogic.php b/app/Http/Logic/WeixinMenuLogic.php index 355ccda..b55dd8c 100644 --- a/app/Http/Logic/WeixinMenuLogic.php +++ b/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);} diff --git a/app/Http/Model/Slide.php b/app/Http/Model/Slide.php index a0c3248..38ede30 100644 --- a/app/Http/Model/Slide.php +++ b/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]; + } } \ No newline at end of file diff --git a/app/Http/Requests/FeedbackRequest.php b/app/Http/Requests/FeedbackRequest.php index 9b77e03..d7653c2 100644 --- a/app/Http/Requests/FeedbackRequest.php +++ b/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'], ]; diff --git a/app/Http/Requests/SlideRequest.php b/app/Http/Requests/SlideRequest.php index 93b5846..c571808 100644 --- a/app/Http/Requests/SlideRequest.php +++ b/app/Http/Requests/SlideRequest.php @@ -1,24 +1,104 @@ '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; + } } \ No newline at end of file diff --git a/public/css/admin.css b/public/css/admin.css index f4f9d2b..95a7185 100644 --- a/public/css/admin.css +++ b/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;} diff --git a/public/css/style.css b/public/css/style.css index 269c8f5..42ef295 100644 --- a/public/css/style.css +++ b/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;} diff --git a/public/images/off.png b/public/images/off.png new file mode 100644 index 0000000..939ab5a Binary files /dev/null and b/public/images/off.png differ diff --git a/public/images/on.png b/public/images/on.png new file mode 100644 index 0000000..f993864 Binary files /dev/null and b/public/images/on.png differ diff --git a/resources/views/admin/friendlink/edit.blade.php b/resources/views/admin/friendlink/edit.blade.php index 46ca39f..14d967d 100644 --- a/resources/views/admin/friendlink/edit.blade.php +++ b/resources/views/admin/friendlink/edit.blade.php @@ -9,11 +9,11 @@ 链接名称: - " class="required" style="width:30%" placeholder="在此输入关键词"> + 链接网址: - " style="width:60%" class="required"> (请用绝对地址) + (请用绝对地址)    diff --git a/resources/views/admin/slide/edit.blade.php b/resources/views/admin/slide/edit.blade.php index a641795..12cac9d 100644 --- a/resources/views/admin/slide/edit.blade.php +++ b/resources/views/admin/slide/edit.blade.php @@ -9,50 +9,50 @@ 标题: - + 链接网址: - (请用绝对地址) + (请用绝对地址) 跳转方式: - /> _blank   - /> _self + target) && $post->target==0){echo 'checked';} ?> /> _blank   + target) && $post->target==1){echo 'checked';} ?> /> _self 显示平台: - /> pc   - /> weixin   - /> app   - /> wap + type) && $post->type==0){echo 'checked';} ?> /> pc   + type) && $post->type==1){echo 'checked';} ?> /> weixin   + type) && $post->type==2){echo 'checked';} ?> /> app   + type) && $post->type==3){echo 'checked';} ?> /> wap 是否显示: - /> 是   - /> 否 + is_show) && $pos->is_show==0){echo 'checked';} ?> /> 是   + is_show) && $pos->is_show==1){echo 'checked';} ?> /> 否 排序: - + 所属的组: - + 图片: - " src="" width="120" height="80" id="picview"> + " src="pic)){echo $post->pic;} ?>" width="120" height="80" id="picview"> diff --git a/resources/views/home/index/index.blade.php b/resources/views/home/index/index.blade.php index 2ba0c0a..e898acb 100644 --- a/resources/views/home/index/index.blade.php +++ b/resources/views/home/index/index.blade.php @@ -94,8 +94,12 @@ var swiper = new Swiper('.swiper-container', { +
-

编辑推荐

+

编辑推荐工厂直达消费者,剔除品牌溢价夏凉/夏凉/夏凉/夏凉/夏凉/夏凉查看更多 >

-

热门商品

+

热门商品