|
|
@@ -12,25 +12,27 @@ use Illuminate\Http\Request as Req;
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
-class NoticeController extends Controller{
|
|
|
+class NoticeController extends Controller
|
|
|
+{
|
|
|
|
|
|
/**
|
|
|
* 活动公告
|
|
|
*/
|
|
|
- function Index(Req $req){
|
|
|
+ function Index(Req $req)
|
|
|
+ {
|
|
|
$request['title'] = isset($req->title) ? trim($req->title) : null;
|
|
|
$request['type'] = isset($req->type) ? trim($req->type) : null;
|
|
|
|
|
|
$dt = \App\Lib\DataTable\DataTable::init();
|
|
|
$dt->setDataSource('/admin/System/getArticle');
|
|
|
$dt->setLang('notice');
|
|
|
- $dt->addColsFields('id',array('width' => 50));
|
|
|
+ $dt->addColsFields('id', array('width' => 50));
|
|
|
$dt->addColsFields('title', array('templet' => '#title', 'sort' => false, 'width' => 120));
|
|
|
// $dt->addColsFields('content');
|
|
|
$dt->addColsFields('time');
|
|
|
$dt->addColsFields('type');
|
|
|
// $dt->addColsFields('typebind');
|
|
|
- $dt->addColsFields('sort',array('width' => 120));
|
|
|
+ $dt->addColsFields('sort', array('width' => 120));
|
|
|
$dt->addColsFields('status', array('templet' => '#closeTool', 'sort' => false, 'width' => 120));
|
|
|
$dt->enableCheckBox();
|
|
|
$arr[] = 'view';
|
|
|
@@ -45,67 +47,70 @@ class NoticeController extends Controller{
|
|
|
/**
|
|
|
* 查看
|
|
|
*/
|
|
|
- function view(Req $req){
|
|
|
+ function view(Req $req)
|
|
|
+ {
|
|
|
return $this->Edit($req);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 编辑
|
|
|
*/
|
|
|
- function Edit(Req $req){
|
|
|
+ function Edit(Req $req)
|
|
|
+ {
|
|
|
$id = $req->id;
|
|
|
if (intval($id) < 1) {
|
|
|
abort(404);
|
|
|
}
|
|
|
|
|
|
- $db = new \App\Models\Article;
|
|
|
- if (!$req->isMethod('post')) {
|
|
|
+ $db = new \App\Models\Article;
|
|
|
+ if (!$req->isMethod('post')) {
|
|
|
$data = $db->getDmsg($id, 1);
|
|
|
-
|
|
|
- if (!$data) {
|
|
|
- return responseToJson($data);
|
|
|
+
|
|
|
+ if (!$data) {
|
|
|
+ return responseToJson($data);
|
|
|
}
|
|
|
- $select = $data["type"];
|
|
|
- $child_id = $data["child_id"];
|
|
|
-
|
|
|
- return view('admin.systemSet/editNotice',['select'=>intval($select),'data' => $data,"child_id"=>$child_id]);
|
|
|
-
|
|
|
- } else {
|
|
|
- $data['child_id'] =$req->child_id;
|
|
|
- $data['title'] = $req->input('title');
|
|
|
- // $data['author'] = $req->input('author');
|
|
|
- $data['sort'] = $req->input('sort');
|
|
|
- $data['type'] = $req->input('type');
|
|
|
- $data['img'] = $req->input('img');
|
|
|
- $data['typebind'] = $req->input('typebind');
|
|
|
+ $select = $data["type"];
|
|
|
+ $child_id = $data["child_id"];
|
|
|
+
|
|
|
+ return view('admin.systemSet/editNotice', ['select' => intval($select), 'data' => $data, "child_id" => $child_id]);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $data['child_id'] = $req->child_id;
|
|
|
+ $data['title'] = $req->input('title');
|
|
|
+ // $data['author'] = $req->input('author');
|
|
|
+ $data['sort'] = $req->input('sort');
|
|
|
+ $data['type'] = $req->input('type');
|
|
|
+ $data['img'] = $req->input('img');
|
|
|
+ $data['typebind'] = $req->input('typebind');
|
|
|
$data['mobilecontent'] = $req->mobilecontent;
|
|
|
$data['mobileimg'] = $req->input('mobileimg');
|
|
|
- $data['content'] = $req->desc;
|
|
|
- $res = $db->updateMsg($data, $id);
|
|
|
- $log = array(
|
|
|
- session('adminInfo.admin_name'),
|
|
|
- $data['title']
|
|
|
- );
|
|
|
- OperationLog(session('adminInfo.admin_id'), 'edit_game', $log);
|
|
|
- return responseToJson($res);
|
|
|
- }
|
|
|
+ $data['content'] = $req->desc;
|
|
|
+ $res = $db->updateMsg($data, $id);
|
|
|
+ $log = array(
|
|
|
+ session('adminInfo.admin_name'),
|
|
|
+ $data['title']
|
|
|
+ );
|
|
|
+ OperationLog(session('adminInfo.admin_id'), 'edit_game', $log);
|
|
|
+ return responseToJson($res);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 新增公告
|
|
|
*/
|
|
|
- function addNotice(Req $req){
|
|
|
+ function addNotice(Req $req)
|
|
|
+ {
|
|
|
if (!$req->isMethod('post')) {
|
|
|
- return view('admin.systemSet/editNotice',['select'=>0,"child_id"=>0]);
|
|
|
- }else{
|
|
|
+ return view('admin.systemSet/editNotice', ['select' => 0, "child_id" => 0]);
|
|
|
+ } else {
|
|
|
$data['title'] = $req->input('title');
|
|
|
$data['img'] = $req->input('img');
|
|
|
$data['sort'] = $req->input('sort');
|
|
|
$data['typebind'] = $req->input('typebind');
|
|
|
$data['mobilecontent'] = $req->mobilecontent;
|
|
|
$data['mobileimg'] = $req->input('mobileimg');
|
|
|
- $data['type'] =$req->type;
|
|
|
- $data['child_id'] =$req->child_id;
|
|
|
+ $data['type'] = $req->type;
|
|
|
+ $data['child_id'] = $req->child_id;
|
|
|
$data['content'] = $req->desc;
|
|
|
$log = array(
|
|
|
session('adminInfo.admin_name'),
|
|
|
@@ -124,131 +129,137 @@ class NoticeController extends Controller{
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 批量删除
|
|
|
- * [delete description]
|
|
|
- * @return [type] [description]
|
|
|
- */
|
|
|
- function delete(Req $req) {
|
|
|
- $id = $req->input('id');
|
|
|
- if (empty($id)) {
|
|
|
- return responseToJson(-2001);
|
|
|
- }
|
|
|
- $ids = explode(',', $id);
|
|
|
- if (!is_array($ids) && intval($ids) < 0) {
|
|
|
- return responseToJson(-2002);
|
|
|
- }
|
|
|
- if (is_array($ids) && count($ids) > 0) {
|
|
|
- foreach ($ids as $k => $v) {
|
|
|
- if (intval($v) < 1) {
|
|
|
- unset($ids[$k]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- $rows = \App\Models\Article::whereIn('id', $ids)->delete();
|
|
|
- if (!$rows) {
|
|
|
- return responseToJson(-2003);
|
|
|
- }
|
|
|
- return responseToJson(1);
|
|
|
- }
|
|
|
-
|
|
|
- function __Edit(Req $req){
|
|
|
+ * 批量删除
|
|
|
+ * [delete description]
|
|
|
+ * @return [type] [description]
|
|
|
+ */
|
|
|
+ function delete(Req $req)
|
|
|
+ {
|
|
|
+ $id = $req->input('id');
|
|
|
+ if (empty($id)) {
|
|
|
+ return responseToJson(-2001);
|
|
|
+ }
|
|
|
+ $ids = explode(',', $id);
|
|
|
+ if (!is_array($ids) && intval($ids) < 0) {
|
|
|
+ return responseToJson(-2002);
|
|
|
+ }
|
|
|
+ if (is_array($ids) && count($ids) > 0) {
|
|
|
+ foreach ($ids as $k => $v) {
|
|
|
+ if (intval($v) < 1) {
|
|
|
+ unset($ids[$k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $rows = \App\Models\Article::whereIn('id', $ids)->delete();
|
|
|
+ if (!$rows) {
|
|
|
+ return responseToJson(-2003);
|
|
|
+ }
|
|
|
+ return responseToJson(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ function __Edit(Req $req)
|
|
|
+ {
|
|
|
$id = $req->id;
|
|
|
- if (intval($id) < 1) {
|
|
|
- abort(404);
|
|
|
+ if (intval($id) < 1) {
|
|
|
+ abort(404);
|
|
|
}
|
|
|
-
|
|
|
- $acticle_type = new ArticleType();
|
|
|
- $db = new \App\Models\Article;
|
|
|
- if (!$req->isMethod('post')) {
|
|
|
+
|
|
|
+ $acticle_type = new ArticleType();
|
|
|
+ $db = new \App\Models\Article;
|
|
|
+ if (!$req->isMethod('post')) {
|
|
|
$data = $db->getDmsg($id, 1);
|
|
|
-
|
|
|
- if (!$data) {
|
|
|
- return responseToJson($data);
|
|
|
+
|
|
|
+ if (!$data) {
|
|
|
+ return responseToJson($data);
|
|
|
}
|
|
|
- $datas = new \App\Models\LotteryMoney();
|
|
|
- $arr = $datas->getlist();
|
|
|
- $admin = \App\Model\TypeName::getAllType();
|
|
|
+ $datas = new \App\Models\LotteryMoney();
|
|
|
+ $arr = $datas->getlist();
|
|
|
+ $admin = \App\Model\TypeName::getAllType();
|
|
|
$selectdata = $acticle_type->type();
|
|
|
- $_selectdata = $this->getTree($selectdata);
|
|
|
- $select = $data["type"];
|
|
|
- $child_id = $data["child_id"];
|
|
|
+ $_selectdata = $this->getTree($selectdata);
|
|
|
+ $select = $data["type"];
|
|
|
+ $child_id = $data["child_id"];
|
|
|
//查出优惠活动的子类
|
|
|
- $show_hui = $this->getTree($selectdata,3);
|
|
|
- $show_hui = array_column($show_hui,"id");
|
|
|
- return view('admin.systemSet/editNotice', ['select'=>intval($select),'data' => $data,'show_hui'=>json_encode($show_hui),/*'admin'=>$admin,*/'list'=>1,'arr'=>$arr['data'],"child_id"=>$child_id,"selectdata"=>$_selectdata]);
|
|
|
-
|
|
|
- } else {
|
|
|
- $data['child_id'] =$req->child_id;
|
|
|
- $data['title'] = $req->input('title');
|
|
|
- $data['author'] = $req->input('author');
|
|
|
- $data['sort'] = $req->input('sort');
|
|
|
- $data['type'] = $req->input('type');
|
|
|
- $data['img'] = $req->input('img');
|
|
|
- $data['typebind'] = $req->input('typebind');
|
|
|
+ $show_hui = $this->getTree($selectdata, 3);
|
|
|
+ $show_hui = array_column($show_hui, "id");
|
|
|
+ return view('admin.systemSet/editNotice', ['select' => intval($select), 'data' => $data, 'show_hui' => json_encode($show_hui),/*'admin'=>$admin,*/
|
|
|
+ 'list' => 1, 'arr' => $arr['data'], "child_id" => $child_id, "selectdata" => $_selectdata]);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $data['child_id'] = $req->child_id;
|
|
|
+ $data['title'] = $req->input('title');
|
|
|
+ $data['author'] = $req->input('author');
|
|
|
+ $data['sort'] = $req->input('sort');
|
|
|
+ $data['type'] = $req->input('type');
|
|
|
+ $data['img'] = $req->input('img');
|
|
|
+ $data['typebind'] = $req->input('typebind');
|
|
|
$data['mobilecontent'] = $req->mobilecontent;
|
|
|
$data['mobileimg'] = $req->input('mobileimg');
|
|
|
- $data['content'] = $req->desc;
|
|
|
- $res = $db->updateMsg($data, $id);
|
|
|
- $log = array(
|
|
|
- session('adminInfo.admin_name'),
|
|
|
- $data['title']
|
|
|
- );
|
|
|
- OperationLog(session('adminInfo.admin_id'), 'edit_game', $log);
|
|
|
- return responseToJson($res);
|
|
|
- }
|
|
|
+ $data['content'] = $req->desc;
|
|
|
+ $res = $db->updateMsg($data, $id);
|
|
|
+ $log = array(
|
|
|
+ session('adminInfo.admin_name'),
|
|
|
+ $data['title']
|
|
|
+ );
|
|
|
+ OperationLog(session('adminInfo.admin_id'), 'edit_game', $log);
|
|
|
+ return responseToJson($res);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 批量删除
|
|
|
- * [delete description]
|
|
|
- * @return [type] [description]
|
|
|
- */
|
|
|
- function __delete(Req $req) {
|
|
|
- $id = $req->input('id');
|
|
|
- if (empty($id)) {
|
|
|
- return responseToJson(-2001); //id������
|
|
|
- }
|
|
|
- $ids = explode(',', $id);
|
|
|
- if (!is_array($ids) && intval($ids) < 0) {
|
|
|
- return responseToJson(-2002); //id����
|
|
|
- }
|
|
|
- if (is_array($ids) && count($ids) > 0) {
|
|
|
- foreach ($ids as $k => $v) {
|
|
|
- if (intval($v) < 1) {
|
|
|
- unset($ids[$k]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- $rows = \App\Models\Article::whereIn('id', $ids)->delete();
|
|
|
- if (!$rows) {
|
|
|
- return responseToJson(-2003); //id����
|
|
|
- }
|
|
|
- return responseToJson(1); //id����
|
|
|
- }
|
|
|
-
|
|
|
- function __addNotice(Req $req){
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ * [delete description]
|
|
|
+ * @return [type] [description]
|
|
|
+ */
|
|
|
+ function __delete(Req $req)
|
|
|
+ {
|
|
|
+ $id = $req->input('id');
|
|
|
+ if (empty($id)) {
|
|
|
+ return responseToJson(-2001); //id������
|
|
|
+ }
|
|
|
+ $ids = explode(',', $id);
|
|
|
+ if (!is_array($ids) && intval($ids) < 0) {
|
|
|
+ return responseToJson(-2002); //id����
|
|
|
+ }
|
|
|
+ if (is_array($ids) && count($ids) > 0) {
|
|
|
+ foreach ($ids as $k => $v) {
|
|
|
+ if (intval($v) < 1) {
|
|
|
+ unset($ids[$k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $rows = \App\Models\Article::whereIn('id', $ids)->delete();
|
|
|
+ if (!$rows) {
|
|
|
+ return responseToJson(-2003); //id����
|
|
|
+ }
|
|
|
+ return responseToJson(1); //id����
|
|
|
+ }
|
|
|
+
|
|
|
+ function __addNotice(Req $req)
|
|
|
+ {
|
|
|
$acticle_type = new ArticleType();
|
|
|
if (!$req->isMethod('post')) {
|
|
|
- $datas = new \App\Models\LotteryMoney();
|
|
|
- $arr = $datas->getlist();
|
|
|
+ $datas = new \App\Models\LotteryMoney();
|
|
|
+ $arr = $datas->getlist();
|
|
|
|
|
|
- // $admin = \App\Model\TypeName::getAllType();
|
|
|
+ // $admin = \App\Model\TypeName::getAllType();
|
|
|
$selectdata = $acticle_type->type();
|
|
|
|
|
|
//查出优惠活动的子类
|
|
|
- $show_hui = $this->getTree($selectdata,3);
|
|
|
- $show_hui = array_column($show_hui,"id");
|
|
|
+ $show_hui = $this->getTree($selectdata, 3);
|
|
|
+ $show_hui = array_column($show_hui, "id");
|
|
|
|
|
|
- return view('admin.systemSet/editNotice',['select'=>0,/*'admin'=>$admin,*/'show_hui'=>json_encode($show_hui),'arr'=>$arr['data'],"child_id"=>0,"selectdata" => $this->getTree($selectdata)]);
|
|
|
- }else{
|
|
|
+ return view('admin.systemSet/editNotice', ['select' => 0,/*'admin'=>$admin,*/
|
|
|
+ 'show_hui' => json_encode($show_hui), 'arr' => $arr['data'], "child_id" => 0, "selectdata" => $this->getTree($selectdata)]);
|
|
|
+ } else {
|
|
|
$data['title'] = $req->input('title');
|
|
|
$data['img'] = $req->input('img');
|
|
|
$data['sort'] = $req->input('sort');
|
|
|
$data['typebind'] = $req->input('typebind');
|
|
|
$data['mobilecontent'] = $req->mobilecontent;
|
|
|
$data['mobileimg'] = $req->input('mobileimg');
|
|
|
- $data['type'] =$req->type;
|
|
|
- $data['child_id'] =$req->child_id;
|
|
|
+ $data['type'] = $req->type;
|
|
|
+ $data['child_id'] = $req->child_id;
|
|
|
$data['content'] = $req->desc;
|
|
|
$log = array(
|
|
|
session('adminInfo.admin_name'),
|
|
|
@@ -266,7 +277,9 @@ class NoticeController extends Controller{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function __upImg(Req $req){
|
|
|
+ public function upImg(Req $req)
|
|
|
+ {
|
|
|
+
|
|
|
if (!$req->hasFile('file')) {
|
|
|
return responseToJson(-5050010022);
|
|
|
}
|
|
|
@@ -275,17 +288,19 @@ class NoticeController extends Controller{
|
|
|
if (!$img->isValid()) {
|
|
|
return responseToJson(-5050010122);
|
|
|
}
|
|
|
- if (file_exists(public_path('/home/img') . $img->getClientOriginalName())) {
|
|
|
+
|
|
|
+ if (file_exists(public_path('/home/img/' . date("Ym")) . $img->getClientOriginalName())) {
|
|
|
return responseToJson(-5050012122);
|
|
|
}
|
|
|
- $newPath = public_path('/home/img');
|
|
|
- $res = $img->move($newPath, $img->getClientOriginalName());
|
|
|
+ $path_now = '/upload/img/' . date("Ym");
|
|
|
+ $newPath = public_path($path_now);
|
|
|
+ $res = $img->move($newPath, $newFileName);
|
|
|
if ($res) {
|
|
|
$retarr = array(
|
|
|
'code' => 0,
|
|
|
'msg' => 'success',
|
|
|
'data' => array(
|
|
|
- 'src' => $res->getPathname(),
|
|
|
+ 'src' => $path_now . '/' . $newFileName,
|
|
|
'title' => $img->getClientOriginalName(),
|
|
|
)
|
|
|
);
|
|
|
@@ -314,7 +329,8 @@ class NoticeController extends Controller{
|
|
|
/**
|
|
|
* 关闭游戏接口
|
|
|
*/
|
|
|
- function __activeClose(Req $req) {
|
|
|
+ function __activeClose(Req $req)
|
|
|
+ {
|
|
|
$status = $req->has('status') ? $req->get('status') : '';
|
|
|
$active_id = $req->has('id') ? $req->get('id') : '';
|
|
|
|
|
|
@@ -335,7 +351,7 @@ class NoticeController extends Controller{
|
|
|
} else {
|
|
|
$data['status'] = '0';
|
|
|
}
|
|
|
- $res = $lottery->closeGame(["id"=>intval($active_id)],$data );
|
|
|
+ $res = $lottery->closeGame(["id" => intval($active_id)], $data);
|
|
|
return responseToJson($res);
|
|
|
}
|
|
|
}
|