all(),[ 'corpid' => 'required', 'name' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $name = $request->input('name'); $type = $request->input('type', 1); // 类型 1:渠道活码 2:群活码 $errCode = SourceQrcodeService::addSqgroup($corpid, $name, $type); return self::returnValue([], $errCode); } public function editSqgroup(Request $request) { $validator = \Validator::make($request->all(),[ 'id' => 'required|int', 'name' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $id = $request->input('id'); $name = $request->input('name'); $errCode = SourceQrcodeService::editSqgroup($id, $name); return self::returnValue([], $errCode); } public function editGroupSort(Request $request) { $validator = \Validator::make($request->all(),[ 'ids' => 'required|array', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $ids = $request->input('ids'); $errCode = SourceQrcodeService::editGroupSort($ids); return self::returnValue([], $errCode); } public function delSqGroup(Request $request) { $validator = \Validator::make($request->all(),[ 'id' => 'required|int', 'del_sqs' => 'nullable|int' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $id = $request->input('id'); $del_sqs = $request->input('del_sqs'); $errCode = SourceQrcodeService::delSqGroup($id, $del_sqs); return self::returnValue([], $errCode); } public function sqGroupList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'page' => 'required|int', 'page_size' => 'int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $page = $request->input('page', 1); $pagesize = $request->input('page_size', 20); $type = $request->input('type', 1); list($data, $total) = SourceQrcodeService::sqGroupList($corpid, $type, $page, $pagesize); return self::returnPageValue($data, $total, $pagesize, $page); } public function addSourceQrcode(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'name' => 'required', 'group_id' => 'nullable', 'user_json' => 'required', 'tag_list' => 'nullable', 'customer_prefix' => 'required', 'customer_prefix_type' => 'required', 'up_toplimit' => 'nullable|int', 'warn_user' => 'nullable', 'msg_data' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $name = $request->input('name'); $group_id = $request->input('group_id'); $user_json = $request->input('user_json'); $tag_list = $request->input('tag_list'); $customer_prefix = $request->input('customer_prefix'); $customer_prefix_type = $request->input('customer_prefix_type'); $up_toplimit = $request->input('up_toplimit'); $warn_user = $request->input('warn_user'); $msg_data = $request->input('msg_data'); list($code, $msg) = SourceQrcodeService::addSourceQrcode($corpid, $name, $group_id, $user_json, $tag_list, $customer_prefix, $customer_prefix_type, $up_toplimit, $warn_user, $msg_data); return self::returnValue(['msg' => $msg], $code); } public function editSourceQrcode(Request $request) { $validator = \Validator::make($request->all(),[ 'id' => 'required|int', 'name' => 'required', 'group_id' => 'nullable', 'user_json' => 'required', 'tag_list' => 'required', 'customer_prefix' => 'required', 'customer_prefix_type' => 'required', 'up_toplimit' => 'nullable|int', 'warn_user' => 'nullable', 'msg_data' => 'required' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $id = $request->input('id'); $name = $request->input('name'); $group_id = $request->input('group_id'); $user_json = $request->input('user_json'); $tag_list = $request->input('tag_list'); $customer_prefix = $request->input('customer_prefix'); $customer_prefix_type = $request->input('customer_prefix_type'); $up_toplimit = $request->input('up_toplimit'); $warn_user = $request->input('warn_user'); $msg_data = $request->input('msg_data'); list($code, $msg) = SourceQrcodeService::editSourceQrcode($id, $name, $group_id, $user_json, $tag_list, $customer_prefix, $customer_prefix_type, $up_toplimit, $warn_user, $msg_data); return self::returnValue(['msg' => $msg], $code); } public function sourceQrcodeList(Request $request) { $validator = \Validator::make($request->all(),[ 'corpid' => 'required', 'group_id' => 'nullable|int', 'name' => 'nullable', 'user_id' => 'nullable', 'page' => 'required|int', 'page_size' => 'int', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $corpid = $request->input('corpid'); $group_id = $request->input('group_id'); $name = $request->input('name'); $user_ids = $request->input('user_ids'); $page = $request->input('page', 1); $pagesize = $request->input('page_size', 20); list($data, $total) = SourceQrcodeService::sourceQrcodeList($corpid, $group_id, $name, $user_ids, $page, $pagesize); return self::returnPageValue($data, $total, $pagesize, $page); } public function delSourceQrcode(Request $request) { $validator = \Validator::make($request->all(),[ 'id' => 'required|int' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $id = $request->input('id'); list($code, $msg) = SourceQrcodeService::delSourceQrcode($id); return self::returnValue(['msg' => $msg], $code); } public function sourceQrcodeDetail(Request $request) { $validator = \Validator::make($request->all(),[ 'id' => 'required|int' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $id = $request->input('id'); $res = SourceQrcodeService::sourceQrcodeDetail($id); return self::returnValue($res); } public function customerList(Request $request) { $validator = \Validator::make($request->all(),[ 'sq_id' => 'required|int', 'name' => 'nullable', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $sq_id = $request->input('sq_id'); $name = $request->input('name'); $page = $request->input('page', 1); $pagesize = $request->input('page_size', 20); list($data, $total) = SourceQrcodeService::customerList($sq_id, $name, $page, $pagesize); return self::returnPageValue($data, $total, $pagesize, $page); } public function staffList(Request $request) { $validator = \Validator::make($request->all(),[ 'sq_id' => 'required|int' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $sq_id = $request->input('sq_id'); $data = SourceQrcodeService::staffList($sq_id); return self::returnValue($data); } /** * 数据分析概览 * @param Request $request * @return array */ public function dataView(Request $request) { $validator = \Validator::make($request->all(),[ 'id' => 'required|int' ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $id = $request->input('id'); $res = SourceQrcodeService::dataView($id); return self::returnValue($res); } /** * 数据分析趋势 * @param Request $request * @return array */ public function dataTrend(Request $request) { $validator = \Validator::make($request->all(),[ 'id' => 'required|int', 'st_date' => 'required|date', 'en_date' => 'required|date', ]); if ($validator->fails()) { return self::returnValue($validator->getMessageBag(), 1102); } $id = $request->input('id'); $stDate = $request->input('st_date'); $enDate = $request->input('en_date'); $res = SourceQrcodeService::dataTrend($id, $stDate, $enDate); return self::returnValue($res); } }