YNICTE/FO/Controllers/OpenController.cs

152 lines
5.8 KiB
C#
Raw Normal View History

2020-10-12 14:39:23 +09:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NP.Model;
using System.Security.Claims;
using System.Collections;
namespace NP.FO.Controllers
{
public class OpenController : FOOpenBaseController
{
public int Menus()
{
base.ResetMenu();
var s = base.GetGnbTop(1);
return 1;
}
public int Popups()
{
base.ResetPopup();
var p = base.GetPOPUPS;
var p2 = base.GetPOPUP;
return 1;
}
public int Banners()
{
base.ResetBanner();
var p = base.GetBANNERS;
var p2 = base.GetBANNER;
var p3 = base.GetBANNERCROOM;
return 1;
}
public ActionResult CertPrint(int userno = 0, int authtype = 0, int randkey = 0)
{
var jobkey = Dao.Get<String>("common.authkey", new Hashtable() { { "authtype", authtype }, { "userno", userno }, { "randkey", randkey } }).FirstOrDefault();
if (string.IsNullOrEmpty(jobkey))
{
return View("NoAuth");
}
VMMy vm = new VMMy() { };
ViewBag.TestCode = TestCode;
vm.Lect = Dao.Get<Lect>("lect.lects.my", new System.Collections.Hashtable() { { "lectno", GetLong(jobkey) } }).Where(w => w.iscomplete == 1).FirstOrDefault() ?? new Lect() { };
if (vm.Lect.pcgcode == TestCode)
{
vm.CMInnings = Dao.Get<CMInning>("cm.cminnings", new System.Collections.Hashtable() { { "cmno", vm.Lect.cmno } });
}
return View(vm);
}
public ActionResult KFCFLOGIN(String userid, int remotekey)
{
if (string.IsNullOrEmpty(userid))
{
return View("NoAuth");
}
var user = Dao.Get<Users>("users.remotelogin", new Hashtable() { { "userid", userid.Trim() }, { "remotekey", remotekey } }).FirstOrDefault();
if (user == null)
{
return View("NoAuth");
}
var u = GoLogin(userid.Trim(), "rhksflwkfhrmdls999");
return Redirect("/");
}
public ActionResult KFCFLOGINAUTH(String userid)
{
if ((string.IsNullOrEmpty(userid) || (GetConfig("ssonoauth")??"")!="Y") && GetUserIP() != "1.214.45.218")
2020-10-12 14:39:23 +09:00
{
return View("NoAuth");
}
else
{
var user = Dao.Get<Users>("users.remoteloginnoauth", userid.Trim()).FirstOrDefault();
if (user == null)
{
return View("NoAuth");
}
else if (Request.Url.Host.Split('.').First().ToUpper() == MainSubDomain.ToUpper())
{
return Redirect(GetConfig("fronturl").ToLower().Replace(MainSubDomain.ToLower(), (user.subdomain??"x").ToLower()) + Request.Url.AbsolutePath + "?userid=" + userid);
}
else if (Request.Url.Host.Split('.').First().ToUpper() != (user.subdomain??"").ToUpper())
{
return Redirect(GetConfig("fronturl").ToLower().Replace(MainSubDomain.ToLower(), Request.Url.Host.Split('.').First().ToLower()) + "/Account/Index");
}
else
{
var u = GoLogin(userid.Trim(), "rhksflwkfhrmdls999");
return Redirect("/My/Index");
}
}
}
public ActionResult ViewQuestion(int authtype=0, int authkey=0, int qno=0)
{
//관리자에서 보려는 인증키확인
if (authtype > 0 && authkey > 0 && qno > 0)
{
var ct = Dao.Get<Data>("common.authkey.check"+ authtype, new System.Collections.Hashtable() { { "authkey", authkey }, { "qno", qno } }).FirstOrDefault();
if (ct != null)
{
ViewBag.q = Dao.Get<Question>("cm.questions", new Hashtable() { { "qno", qno } }).FirstOrDefault();
if (ViewBag.q != null)
{
ViewBag.qi = Dao.Get<QuestionItem>("cm.questionitems", new Hashtable() { { "qno", qno } });
return View();
}
}
}
return View("NoAuth");
}
public String Popup()
{
return "ok";
}
public String CheckJoin(String brno)
{
//db 사업자번호에 "-"가 들어 갔을까? 추가확인/코딩 필요
brno = brno.Replace("-", "").Replace(" ", "");
if (string.IsNullOrEmpty(brno) || brno.Length != 10)
{
return "6";
}
try
{
var assigns = Dao.Get<Assign>("users.assigns2", new Hashtable() { {"brno",brno },{"status", 1}, { "orderby", "a.asname" } });
switch (assigns.Count())
{
case 0:
return "3";
case 1:
return assigns.First().isjoin == 1 ? "1" : "2";
default:
return "5";
}
}
catch (Exception ex)
{
SetError("사업자회원/비회원체크API" + ex.Message);
return "4";
//오류 어쩌지?
}
}
2021-06-09 10:10:57 +09:00
public ActionResult PlayOpen(long lectno, long cmino)
{
ViewBag.lectno = lectno;
ViewBag.cmino = cmino;
return View();
}
2020-10-12 14:39:23 +09:00
}
}