diff --git a/app/Http/Controllers/Admin/ArticleController.php b/app/Http/Controllers/Admin/ArticleController.php index 94b6ba7..bef5df3 100644 --- a/app/Http/Controllers/Admin/ArticleController.php +++ b/app/Http/Controllers/Admin/ArticleController.php @@ -3,6 +3,9 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Admin\CommonController; use DB; +use Illuminate\Http\Request; +use App\Http\Requests\ArticleRequest; +use Validator; class ArticleController extends CommonController { @@ -78,6 +81,16 @@ class ArticleController extends CommonController public function add() { + $validate = new ArticleRequest(); + $validator = Validator::make($_REQUEST, $validate->getSceneRules('add'), $validate->getSceneRulesMessages()); + + if ($validator->fails()) + { + //$validator->errors()->first(); + //$validator->errors()->all(); + error_jump('参数错误'); + } + $data = ''; if(!empty($_REQUEST["catid"])){$data['catid'] = $_REQUEST["catid"];}else{$data['catid'] = 0;} diff --git a/app/Http/Controllers/Admin/SlideController.php b/app/Http/Controllers/Admin/SlideController.php index c662594..4020aa8 100644 --- a/app/Http/Controllers/Admin/SlideController.php +++ b/app/Http/Controllers/Admin/SlideController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Admin\CommonController; use DB; +use App\Http\Model\Slide; class SlideController extends CommonController { @@ -13,8 +14,16 @@ class SlideController extends CommonController public function index() { - $data['posts'] = parent::pageList('slide', '', [['is_show', 'asc'], ['rank', 'desc']]); + $data['posts'] = parent::pageList('slide', '', [['is_show', 'asc'], ['listorder', 'asc']]); + if($data['posts']) + { + foreach($data['posts'] as $k=>$v) + { + $data['posts'][$k]->type_text = Slide::getTypeText(array('type'=>$v->type)); + } + } + return view('admin.slide.index', $data); } diff --git a/app/Http/Controllers/Admin/UserWithdrawController.php b/app/Http/Controllers/Admin/UserWithdrawController.php index ca27563..4049150 100644 --- a/app/Http/Controllers/Admin/UserWithdrawController.php +++ b/app/Http/Controllers/Admin/UserWithdrawController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Admin\CommonController; use DB; use App\Http\Model\UserWithdraw; +use App\Common\ReturnData; class UserWithdrawController extends CommonController { @@ -54,4 +55,34 @@ class UserWithdrawController extends CommonController error_jump('修改失败!'); } } + + public function changeStatus() + { + if(!empty($_POST["id"])){$id = $_POST["id"];unset($_POST["id"]);}else {$id="";exit;} + + unset($_POST["_token"]); + + if(!isset($_POST["type"])){return ReturnData::create(ReturnData::PARAMS_ERROR);} + + $user_withdraw = DB::table('user_withdraw')->where(['id'=>$id,'status'=>0])->first(); + if(!$user_withdraw){return ReturnData::create(ReturnData::PARAMS_ERROR);} + + //0拒绝,1成功 + if($_POST["type"]==0) + { + $data['status'] = 4; + + + } + elseif($_POST["type"]==1) + { + $data['status'] = 2; + } + + if(!isset($data)){$res = DB::table('user_withdraw')->where('id', $id)->update($data);} + + if(!isset($res)){return ReturnData::create(ReturnData::SYSTEM_FAIL);} + + return ReturnData::create(ReturnData::SUCCESS); + } } \ No newline at end of file diff --git a/app/Http/Controllers/Weixin/IndexController.php b/app/Http/Controllers/Weixin/IndexController.php index a338727..e561789 100644 --- a/app/Http/Controllers/Weixin/IndexController.php +++ b/app/Http/Controllers/Weixin/IndexController.php @@ -19,7 +19,7 @@ class IndexController extends CommonController } //首页 - public function index() + public function index(Request $request) { //分享到首页,把推荐id存下来 if(isset($_REQUEST['invite_code']) && !empty($_REQUEST['invite_code'])) diff --git a/app/Http/Model/Slide.php b/app/Http/Model/Slide.php index 68e04ee..f2cecad 100644 --- a/app/Http/Model/Slide.php +++ b/app/Http/Model/Slide.php @@ -80,4 +80,28 @@ class Slide extends Model return true; } + + //获取显示平台文字:0pc,1weixin,2app,3wap + public static function getTypeText($where) + { + $res = ''; + if($where['type'] === 0) + { + $res = 'pc'; + } + elseif($where['type'] === 1) + { + $res = 'weixin'; + } + elseif($where['type'] === 2) + { + $res = 'app'; + } + elseif($where['type'] === 3) + { + $res = 'wap'; + } + + return $res; + } } \ No newline at end of file diff --git a/app/Http/Requests/ArticleRequest.php b/app/Http/Requests/ArticleRequest.php new file mode 100644 index 0000000..4790317 --- /dev/null +++ b/app/Http/Requests/ArticleRequest.php @@ -0,0 +1,93 @@ + 'required|integer', + 'title' => 'required|max:150', + 'typeid' => 'required|integer', + 'click' => 'required|integer', + ]; + + //总的自定义错误信息 + protected $messages = [ + 'title.max' => '标题不能大于150个字', + 'title.required' => '必须填写标题', + 'typeid.required' => '类目ID必填', + 'typeid.integer' => '栏目ID必须为数字', + 'click.integer' => '点击必须为数字', + 'id.required' => 'ID必填', + 'id.integer' => 'ID必须为数字', + ]; + + //场景验证规则 + protected $scene = [ + 'add' => ['title','typeid','click'], + 'edit' => ['title','typeid'], + '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/resources/views/admin/UserWithdraw/index.blade.php b/resources/views/admin/UserWithdraw/index.blade.php index fb8d653..c8307d9 100644 --- a/resources/views/admin/UserWithdraw/index.blade.php +++ b/resources/views/admin/UserWithdraw/index.blade.php @@ -26,9 +26,39 @@ 账号:account;if($row->bank_name){echo '
银行名称:'.$row->bank_name;}if($row->bank_place){echo '
开户行:'.$row->bank_place;} ?> add_time); ?> status_text; ?> -成功 拒绝 +status==0){ ?>成功 拒绝 + + + @endsection \ No newline at end of file diff --git a/resources/views/admin/order/index.blade.php b/resources/views/admin/order/index.blade.php index 905cffd..5072dda 100644 --- a/resources/views/admin/order/index.blade.php +++ b/resources/views/admin/order/index.blade.php @@ -32,7 +32,7 @@
-
+
diff --git a/resources/views/admin/slide/add.blade.php b/resources/views/admin/slide/add.blade.php index a59a946..68d31ed 100644 --- a/resources/views/admin/slide/add.blade.php +++ b/resources/views/admin/slide/add.blade.php @@ -22,6 +22,15 @@  _self + + + + diff --git a/resources/views/admin/slide/edit.blade.php b/resources/views/admin/slide/edit.blade.php index d7e6216..a641795 100644 --- a/resources/views/admin/slide/edit.blade.php +++ b/resources/views/admin/slide/edit.blade.php @@ -22,6 +22,15 @@ /> _self + + + + diff --git a/resources/views/admin/slide/index.blade.php b/resources/views/admin/slide/index.blade.php index ca4e05e..3bf4f8d 100644 --- a/resources/views/admin/slide/index.blade.php +++ b/resources/views/admin/slide/index.blade.php @@ -6,19 +6,23 @@
订单编号SN-ID 支付信息
显示平台: +  pc   +  weixin   +  app   +  wap +
是否显示: @@ -32,13 +41,13 @@
排序: - +
所属的组: - +
显示平台: + /> pc   + /> weixin   + /> app   + /> wap +
是否显示: @@ -32,7 +41,7 @@
排序: - +
+ + + - + + diff --git a/routes/web.php b/routes/web.php index cc6b347..5a5574b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -365,6 +365,7 @@ Route::group(['prefix' => 'fladmin', 'namespace' => 'Admin', 'middleware' => ['w Route::get('/userwithdraw', 'UserWithdrawController@index')->name('admin_userwithdraw'); Route::get('/userwithdraw/edit', 'UserWithdrawController@edit')->name('admin_userwithdraw_edit'); Route::post('/userwithdraw/doedit', 'UserWithdrawController@doedit')->name('admin_userwithdraw_doedit'); + Route::post('/userwithdraw/change_status', 'UserWithdrawController@changeStatus')->name('admin_userwithdraw_change_status'); //管理员管理 Route::get('/admin', 'AdminController@index')->name('admin_admin'); Route::get('/admin/add', 'AdminController@add')->name('admin_admin_add');
ID 图片 标题 链接网址显示平台 排序 是否显示 管理
id; ?> " src="pic)){echo $row->pic;} ?>" width="90" height="60"> title; ?> url; ?>rank; ?>type_text; ?>listorder; ?> is_show==0){echo "是";}else{echo "";} ?> 修改 | 删除