2758 lines
116 KiB
C#
2758 lines
116 KiB
C#
using Microsoft.AspNetCore.Http;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Threading.Tasks;
|
||
using Newtonsoft.Json;
|
||
using Newtonsoft.Json.Linq;
|
||
using Microsoft.AspNetCore.Cors;
|
||
using Dapper;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.Web;
|
||
using System.Text;
|
||
using System.Net;
|
||
using System.Net.Http;
|
||
using System.Net.Http.Headers;
|
||
using Dapper.Contrib.Extensions;
|
||
using System.IO;
|
||
using System.IO.Compression;
|
||
using System.Threading;
|
||
using System.Dynamic;
|
||
using NPOI;
|
||
using NPOI.HPSF;
|
||
using NPOI.HSSF;
|
||
using NPOI.HSSF.UserModel;
|
||
using NPOI.XSSF;
|
||
using NPOI.XSSF.UserModel;
|
||
using NPOI.POIFS;
|
||
using NPOI.Util;
|
||
using Microsoft.Extensions.Configuration;
|
||
using System.Security.Policy;
|
||
using NPOI.SS.Formula.Functions;
|
||
using static DbTableClass;
|
||
using System.Runtime.InteropServices.ObjectiveC;
|
||
using static System.Net.WebRequestMethods;
|
||
using System.Diagnostics.Eventing.Reader;
|
||
using static Journeys_WantHome.Controllers.AuthApiController;
|
||
using SixLabors.ImageSharp.Memory;
|
||
using Org.BouncyCastle.Utilities;
|
||
using Org.BouncyCastle.Bcpg.OpenPgp;
|
||
using NPOI.OpenXmlFormats.Dml.Chart;
|
||
using System.Collections;
|
||
using System.Formats.Asn1;
|
||
using Org.BouncyCastle.Ocsp;
|
||
using System.Drawing;
|
||
using System.Drawing.Imaging;
|
||
|
||
|
||
namespace Journeys_WantHome.Controllers
|
||
{
|
||
[Route("Api")]
|
||
|
||
public class ApiController : ControllerBase
|
||
{
|
||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||
|
||
DbConn dbConn = new DbConn();
|
||
SqlConnection conn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:SQLConnectionString"));
|
||
SqlConnection elabConn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:ElabConnectionString"));
|
||
SqlConnection prmConn = new SqlConnection(GlobalClass.appsettings("ConnectionStrings:DBConnectionString"));
|
||
|
||
public ApiController(IHttpContextAccessor httpContextAccessor)
|
||
{
|
||
this._httpContextAccessor = httpContextAccessor;
|
||
}
|
||
|
||
[Route("instagramData")]
|
||
public ActionResult InstagramPostData(IFormCollection obj) {
|
||
igDataResult ret = new igDataResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string method = obj["method"].ToString();
|
||
string instagram_uid = obj["instagram_uid"].ToString();
|
||
|
||
if (method == "post")
|
||
{
|
||
ret.list = conn.Query<instagramDetail>("select * from instagramDetail where instagramDetail_type='post' and instagram_uid = @instagram_uid", new { instagram_uid = instagram_uid }).ToList();
|
||
}
|
||
else {
|
||
ret.list = conn.Query<instagramDetail>("select * from instagramDetail where instagramDetail_type='reels' and instagram_uid = @instagram_uid", new { instagram_uid = instagram_uid }).ToList();
|
||
}
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("instagramList")]
|
||
public ActionResult InstagramList(IFormCollection obj) {
|
||
igRankListResult ret = new igRankListResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
ret.list = conn.Query<instagramKolView>("select top 15 * from instagramKolView where instagram_revoke = 'N' order by instagram_fansNum desc ").ToList();
|
||
ret.ret = "yes";
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("igUpdateData")]
|
||
public ActionResult IgUpdateData(IFormCollection obj) {
|
||
normalResult ret = new normalResult();
|
||
|
||
string json_data = obj["json_data"].ToString();
|
||
//json_data = json_data.Replace("\uFEFF", "").Replace("False","false");
|
||
if (json_data == "") {
|
||
ret.ret = "no";
|
||
ret.err_code = "0001";
|
||
ret.message = "json_data沒有資料";
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
dynamic igObject;
|
||
|
||
try {
|
||
igObject = JsonConvert.DeserializeObject(json_data);
|
||
} catch (Exception e)
|
||
{
|
||
updateLog successLog = new updateLog();
|
||
successLog.updateLog_text = "此Instagram 資料更新失敗 " + e.Message;
|
||
successLog.updateLog_kolMedia_uid = "";
|
||
successLog.updateLog_kolMedia_accountName = "";
|
||
successLog.updateLog_kolMedia_displayName = "";
|
||
successLog.updateLog_kol_uid = "";
|
||
successLog.updateLog_type = "Instagram";
|
||
successLog.updateLog_result = "failed";
|
||
successLog.updateLog_uid = "";
|
||
|
||
conn.Insert(successLog);
|
||
|
||
ret.ret = "no";
|
||
ret.err_code = "0002";
|
||
ret.message = "json parse error : " + e.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string kolMedia_uid = igObject.kolMedia_uid;
|
||
string kol_uid = igObject.kol_uid;
|
||
|
||
kolMedia objMedia = conn.QueryFirstOrDefault<kolMedia>("select * from kolMedia where kolMedia_uid = @kolMedia_uid", new { kolMedia_uid = kolMedia_uid });
|
||
|
||
if (objMedia == null)
|
||
{
|
||
updateLog successLog = new updateLog();
|
||
successLog.updateLog_text = "此Instagram (" + kolMedia_uid + ") 資料更新失敗,無此kolMedia_uid資料";
|
||
successLog.updateLog_kolMedia_uid = kolMedia_uid;
|
||
successLog.updateLog_kolMedia_accountName = "";
|
||
successLog.updateLog_kolMedia_displayName = "kol_uid = " + kol_uid;
|
||
successLog.updateLog_kol_uid = kol_uid;
|
||
successLog.updateLog_type = "Instagram";
|
||
successLog.updateLog_result = "failed";
|
||
successLog.updateLog_uid = "";
|
||
|
||
conn.Insert(successLog);
|
||
|
||
ret.ret = "no";
|
||
ret.err_code = "0001";
|
||
ret.message = "無此kolMedia_uid資料! // " + json_data;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Instagram', '開始執行igUpdateData,執行對象kolMedia_uid=" + kolMedia_uid + "')", new { kolMedia_uid = kolMedia_uid });
|
||
|
||
try
|
||
{
|
||
objMedia.kolMedia_fansNum = (int)igObject.fans_count;
|
||
string pic_url = igObject.ig_pic;
|
||
instagram igClass = new instagram();
|
||
List<instagramDetail> igList = new List<instagramDetail>();
|
||
|
||
string kolIgFileName = "igKol_" + DateTime.Now.ToString("yyyyMMdd") + "_" + GlobalClass.CreateRandomCode(16) + ".jpg";
|
||
//string newFileName = "uid_" + GlobalClass.CreateRandomCode(16) + Path.GetExtension(originFileName);
|
||
string fullPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images/instagram/" + kolIgFileName);
|
||
|
||
WebRequest wreq = WebRequest.Create(pic_url);
|
||
|
||
HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse();
|
||
Stream s = wresp.GetResponseStream();
|
||
System.Drawing.Image img;
|
||
img = System.Drawing.Image.FromStream(s);
|
||
img.Save(fullPath, ImageFormat.Jpeg);
|
||
MemoryStream ms = new MemoryStream();
|
||
img.Save(ms, ImageFormat.Jpeg);
|
||
img.Dispose();
|
||
|
||
|
||
|
||
igClass.instagram_uid = "ig_" + GlobalClass.CreateRandomCode(16);
|
||
igClass.instagram_name = igObject.ig_fullname;
|
||
igClass.kolMedia_uid = kolMedia_uid;
|
||
igClass.kol_uid = kol_uid;
|
||
igClass.instagram_pic = kolIgFileName;
|
||
igClass.instagram_fansNum = (int)igObject.fans_count;
|
||
igClass.instagram_followNum = (int)igObject.following_count;
|
||
|
||
int postLikeNum = 0;
|
||
int postCommentNum = 0;
|
||
int reelViewCount = 0;
|
||
|
||
foreach (var igObj in igObject.posts) {
|
||
|
||
string postIgFileName = "igPost_" + kol_uid + "_" + DateTime.Now.ToString("yyyyMMdd") + "_" + GlobalClass.CreateRandomCode(16) + ".jpg";
|
||
//string newFileName = "uid_" + GlobalClass.CreateRandomCode(16) + Path.GetExtension(originFileName);
|
||
string postfullPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images/instagram/" + postIgFileName);
|
||
string post_img_url = igObj.url;
|
||
WebRequest iwreq = WebRequest.Create(post_img_url);
|
||
|
||
HttpWebResponse iwresp = (HttpWebResponse)iwreq.GetResponse();
|
||
Stream s1 = iwresp.GetResponseStream();
|
||
System.Drawing.Image img1;
|
||
img1 = System.Drawing.Image.FromStream(s1);
|
||
img1.Save(postfullPath, ImageFormat.Jpeg);
|
||
MemoryStream ms1 = new MemoryStream();
|
||
img1.Save(ms1, ImageFormat.Jpeg);
|
||
img1.Dispose();
|
||
|
||
postLikeNum += (int)igObj.likes;
|
||
postCommentNum += (int)igObj.comments;
|
||
|
||
instagramDetail newIg = new instagramDetail();
|
||
newIg.instagram_uid = igClass.instagram_uid;
|
||
newIg.instagramDetail_type = "post";
|
||
newIg.instagramDetail_title = igObj.title;
|
||
newIg.instagramDetail_photo = postIgFileName;
|
||
newIg.instagramDetail_shortcode = igObj.shortcode;
|
||
newIg.instagramDetail_date = igObj.date;
|
||
newIg.instagramDetail_likeNum = (int)igObj.likes;
|
||
newIg.instagramDetail_commentNum = (int)igObj.comments;
|
||
|
||
if ((Boolean)igObj.is_pinned)
|
||
{
|
||
newIg.instagramDetail_ispinned = "Y";
|
||
}
|
||
else
|
||
{
|
||
newIg.instagramDetail_ispinned = "N";
|
||
}
|
||
|
||
igList.Add(newIg);
|
||
}
|
||
|
||
int reelsCount = 0;
|
||
foreach (var igObj in igObject.reels)
|
||
{
|
||
string postIgFileName = "igReels_" + kol_uid + "_" + DateTime.Now.ToString("yyyyMMdd") + "_" + GlobalClass.CreateRandomCode(16) + ".jpg";
|
||
//string newFileName = "uid_" + GlobalClass.CreateRandomCode(16) + Path.GetExtension(originFileName);
|
||
string postfullPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images/instagram/" + postIgFileName);
|
||
string post_img_url = igObj.url;
|
||
WebRequest iwreq = WebRequest.Create(post_img_url);
|
||
|
||
HttpWebResponse iwresp = (HttpWebResponse)iwreq.GetResponse();
|
||
Stream s1 = iwresp.GetResponseStream();
|
||
System.Drawing.Image img1;
|
||
img1 = System.Drawing.Image.FromStream(s1);
|
||
img1.Save(postfullPath, ImageFormat.Jpeg);
|
||
MemoryStream ms1 = new MemoryStream();
|
||
img1.Save(ms1, ImageFormat.Jpeg);
|
||
img1.Dispose();
|
||
|
||
|
||
reelViewCount += (int)igObj.video_view_count;
|
||
reelsCount++;
|
||
|
||
instagramDetail newIg = new instagramDetail();
|
||
newIg.instagram_uid = igClass.instagram_uid;
|
||
newIg.instagramDetail_type = "reels";
|
||
newIg.instagramDetail_title = igObj.title;
|
||
newIg.instagramDetail_photo = postIgFileName;
|
||
newIg.instagramDetail_shortcode = igObj.shortcode;
|
||
newIg.instagramDetail_date = igObj.date;
|
||
newIg.instagramDetail_likeNum = (int)igObj.likes;
|
||
newIg.instagramDetail_commentNum = (int)igObj.comments;
|
||
newIg.instagramDetail_viewNum = (int)igObj.video_view_count;
|
||
|
||
if ((Boolean)igObj.is_pinned)
|
||
{
|
||
newIg.instagramDetail_ispinned = "Y";
|
||
}
|
||
else
|
||
{
|
||
newIg.instagramDetail_ispinned = "N";
|
||
}
|
||
|
||
igList.Add(newIg);
|
||
}
|
||
|
||
if (postLikeNum < 0)
|
||
{
|
||
igClass.instagram_postActive = -1;
|
||
}
|
||
else {
|
||
igClass.instagram_postActive = (double)(postLikeNum + postCommentNum) / (double)igClass.instagram_fansNum;
|
||
}
|
||
|
||
if (reelsCount > 0)
|
||
{
|
||
igClass.instagram_reelsActive = (double)reelViewCount / (double)reelsCount;
|
||
}
|
||
else {
|
||
igClass.instagram_reelsActive = -1;
|
||
}
|
||
|
||
igClass.instagram_revoke = "N";
|
||
|
||
conn.Execute("update instagram set instagram_revoke = 'Y' where kol_uid = @kol_uid and kolMedia_uid = @kolMedia_uid", new { kol_uid = kol_uid, kolMedia_uid = kolMedia_uid });
|
||
|
||
|
||
conn.Update(objMedia);
|
||
conn.Insert(igList);
|
||
conn.Insert(igClass);
|
||
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Instagram', '執行完成,執行對象kolMedia_uid=" + kolMedia_uid + "')");
|
||
|
||
updateLog successLog = new updateLog();
|
||
successLog.updateLog_text = "此Instagram (" + igClass.instagram_name + ") 資料更新成功";
|
||
successLog.updateLog_kolMedia_uid = kolMedia_uid;
|
||
successLog.updateLog_kolMedia_accountName = "";
|
||
successLog.updateLog_kolMedia_displayName = igClass.instagram_name;
|
||
successLog.updateLog_kol_uid = kol_uid;
|
||
successLog.updateLog_type = "Instagram";
|
||
successLog.updateLog_result = "success";
|
||
successLog.updateLog_uid = "";
|
||
|
||
conn.Insert(successLog);
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
catch (Exception ex) {
|
||
|
||
updateLog successLog = new updateLog();
|
||
successLog.updateLog_text = "此Instagram (" + kolMedia_uid + ") 資料更新失敗 " + ex.Message;
|
||
successLog.updateLog_kolMedia_uid = kolMedia_uid;
|
||
successLog.updateLog_kolMedia_accountName = "";
|
||
successLog.updateLog_kolMedia_displayName = "kol_uid = " + kol_uid;
|
||
successLog.updateLog_kol_uid = kol_uid;
|
||
successLog.updateLog_type = "Instagram";
|
||
successLog.updateLog_result = "failed";
|
||
successLog.updateLog_uid = "";
|
||
|
||
conn.Insert(successLog);
|
||
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "資料更新錯誤 : " + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("igUpdateList")]
|
||
public ActionResult IgUpdateList(IFormCollection obj)
|
||
{
|
||
fbUpdateListResult ret = new fbUpdateListResult();
|
||
|
||
//撈出FB頻道清單
|
||
List<kolMedia> kolMedias = conn.Query<kolMedia>("select A.* from kolMedia A, kol B where A.kol_uid = B.kol_uid and A.option_uid = 'media' and A.optionItem_uid = 'media002' order by A.kolMedia_sn desc ").ToList();
|
||
|
||
foreach (kolMedia media in kolMedias)
|
||
{
|
||
string overDate = DateTime.Now.AddDays(int.Parse(GlobalClass.appsettings("UpdateByDay")) * -1).ToString("yyyy/MM/dd HH:mm:ss");
|
||
|
||
updateLog objLog = conn.QueryFirstOrDefault<updateLog>("select * from updateLog where updateLog_type = 'Instagram' and updateLog_result = 'success' and updateLog_kol_uid = @kol_uid and updateLog_kolMedia_uid = @kolMedia_uid and updateLog_updateTime >= @overDate ", new { kol_uid = media.kol_uid, kolMedia_uid = media.kolMedia_uid, overDate = overDate });
|
||
|
||
if (objLog == null)
|
||
{
|
||
fbClass objNew = new fbClass();
|
||
objNew.kolMedia_accountName = media.kolMedia_accountName;
|
||
objNew.kolMedia_uid = media.kolMedia_uid;
|
||
objNew.kolMedia_url = media.kolMedia_url;
|
||
objNew.kol_uid = media.kol_uid;
|
||
objNew.optionItem_uid = media.optionItem_uid;
|
||
ret.list.Add(objNew);
|
||
}
|
||
|
||
}
|
||
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Instagram', 'Server撈取清單')");
|
||
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("facebookData")]
|
||
public ActionResult FacebookData(IFormCollection obj)
|
||
{
|
||
facebookDataResult ret = new facebookDataResult();
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string facebook_uid = obj["facebook_uid"].ToString();
|
||
|
||
ret.list = conn.Query<facebookDetail>("select * from facebookDetail where facebook_uid = @facebook_uid", new { facebook_uid = facebook_uid }).ToList();
|
||
ret.ret = "yes";
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("facebookList")]
|
||
public ActionResult FacebookList() {
|
||
fbRankListResult ret = new fbRankListResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
ret.list = conn.Query<facebookKolView>("select top 15 * from facebookKolView where facebook_revoke = 'N' order by facebook_fansNum desc ").ToList();
|
||
ret.ret = "yes";
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[HttpGet]
|
||
[Route("fbUpdateData")]
|
||
public ActionResult FbUpdateData(string kol_uid, string kolMedia_uid, string fb_title, string fans_num, string json_data) {
|
||
normalResult ret = new normalResult();
|
||
|
||
kolMedia objMedia = conn.QueryFirstOrDefault<kolMedia>("select * from kolMedia where kolMedia_uid = @kolMedia_uid", new { kolMedia_uid = kolMedia_uid });
|
||
|
||
if (objMedia == null)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0001";
|
||
ret.message = "無此kolMedia_uid資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Facebook', '開始執行fbUpdateData,執行對象kolMedia_uid=" + kolMedia_uid + "')", new { kolMedia_uid = kolMedia_uid });
|
||
|
||
try
|
||
{
|
||
int intFansNum = 0;
|
||
|
||
fans_num = fans_num.Replace(",", "").Trim();
|
||
|
||
if (fans_num.IndexOf("萬") >= 0)
|
||
{
|
||
fans_num = fans_num.Replace("萬", "");
|
||
|
||
double fans_numf = double.Parse(fans_num);
|
||
|
||
fans_num = (fans_numf * 10000).ToString();
|
||
}
|
||
|
||
|
||
|
||
try
|
||
{
|
||
intFansNum = int.Parse(fans_num);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Facebook', '執行fbUpdateData facebookArray Json化發生錯誤,執行對象kolMedia_uid=" + kolMedia_uid + ", 錯誤訊息:" + ex.Message.Replace("'", "").Replace("\"", "") + "')", new { kolMedia_uid = kolMedia_uid, msg = ex.Message });
|
||
|
||
|
||
updateLog failedLog = new updateLog();
|
||
failedLog.updateLog_text = "此Facebook (" + fb_title + ") 資料更新失敗 (" + ex.Message + ")";
|
||
failedLog.updateLog_kolMedia_uid = kolMedia_uid;
|
||
failedLog.updateLog_kolMedia_accountName = "";
|
||
failedLog.updateLog_kolMedia_displayName = fb_title;
|
||
failedLog.updateLog_kol_uid = kol_uid;
|
||
failedLog.updateLog_type = "Facebook";
|
||
failedLog.updateLog_result = "failed";
|
||
failedLog.updateLog_uid = "";
|
||
|
||
conn.Insert(failedLog);
|
||
|
||
ret.ret = "no";
|
||
ret.err_code = "0002";
|
||
ret.message = ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
dynamic facebookArray;
|
||
|
||
try
|
||
{
|
||
facebookArray = JsonConvert.DeserializeObject(json_data);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Facebook', '執行fbUpdateData facebookArray Json化發生錯誤,執行對象kolMedia_uid=" + kolMedia_uid + ", 錯誤訊息:" + ex.Message.Replace("'", "").Replace("\"", "") + "')", new { kolMedia_uid = kolMedia_uid, msg = ex.Message });
|
||
|
||
updateLog failedLog = new updateLog();
|
||
failedLog.updateLog_text = "此Facebook (" + fb_title + ") 資料更新失敗 (" + ex.Message + ")";
|
||
failedLog.updateLog_kolMedia_uid = kolMedia_uid;
|
||
failedLog.updateLog_kolMedia_accountName = "";
|
||
failedLog.updateLog_kolMedia_displayName = fb_title;
|
||
failedLog.updateLog_kol_uid = kol_uid;
|
||
failedLog.updateLog_type = "Facebook";
|
||
failedLog.updateLog_result = "failed";
|
||
failedLog.updateLog_uid = "";
|
||
|
||
conn.Insert(failedLog);
|
||
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "json_data error : " + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
objMedia.kolMedia_fansNum = intFansNum;
|
||
|
||
int totalLikeNum = 0;
|
||
int totalMsgNum = 0;
|
||
int totalShareNum = 0;
|
||
int totalCount = 0;
|
||
List<facebookDetail> fbList = new List<facebookDetail>();
|
||
facebook fb = new facebook();
|
||
fb.facebook_uid = "fb_" + GlobalClass.CreateRandomCode(24);
|
||
fb.facebook_fansNum = intFansNum;
|
||
fb.facebook_name = fb_title;
|
||
fb.kol_uid = kol_uid;
|
||
fb.kolMedia_uid = kolMedia_uid;
|
||
|
||
foreach (var fbObj in facebookArray)
|
||
{
|
||
string like_num = fbObj.like_num;
|
||
string msg_num = fbObj.like_num;
|
||
string share_num = fbObj.share_num;
|
||
like_num = like_num.Replace(",", "");
|
||
msg_num = msg_num.Replace(",", "");
|
||
share_num = share_num.Replace(",", "");
|
||
|
||
totalLikeNum += int.Parse(like_num);
|
||
totalMsgNum += int.Parse(msg_num);
|
||
totalShareNum += int.Parse(share_num);
|
||
totalCount += totalLikeNum + totalMsgNum + totalShareNum;
|
||
|
||
facebookDetail item = new facebookDetail();
|
||
item.facebook_uid = fb.facebook_uid;
|
||
item.facebookDetail_publishedAt = (string)fbObj.fb_date;
|
||
item.facebookDetail_likeCount = int.Parse(like_num);
|
||
item.facebookDetail_msgCount = int.Parse(msg_num);
|
||
item.facebookDetail_shareCount = int.Parse(share_num);
|
||
|
||
fbList.Add(item);
|
||
}
|
||
|
||
double actionNum = (double)totalCount / (double)intFansNum;
|
||
fb.facebook_active = actionNum;
|
||
fb.facebook_5_likesNum = totalLikeNum;
|
||
fb.facebook_5_msgNum = totalMsgNum;
|
||
fb.facebook_5_shareNum = totalShareNum;
|
||
fb.facebook_revoke = "N";
|
||
|
||
conn.Execute("update facebook set facebook_revoke = 'Y' where kol_uid = @kol_uid and kolMedia_uid = @kolMedia_uid", new { kol_uid = kol_uid, kolMedia_uid = kolMedia_uid });
|
||
|
||
|
||
conn.Update(objMedia);
|
||
conn.Insert(fbList);
|
||
conn.Insert(fb);
|
||
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Facebook', '執行完成,執行對象kolMedia_uid=@kolMedia_uid')", new { kolMedia_uid = kolMedia_uid });
|
||
|
||
updateLog successLog = new updateLog();
|
||
successLog.updateLog_text = "此Facebook (" + fb_title + ") 資料更新成功";
|
||
successLog.updateLog_kolMedia_uid = kolMedia_uid;
|
||
successLog.updateLog_kolMedia_accountName = "";
|
||
successLog.updateLog_kolMedia_displayName = fb_title;
|
||
successLog.updateLog_kol_uid = kol_uid;
|
||
successLog.updateLog_type = "Facebook";
|
||
successLog.updateLog_result = "success";
|
||
successLog.updateLog_uid = "";
|
||
|
||
conn.Insert(successLog);
|
||
|
||
ret.ret = "yes";
|
||
}
|
||
catch (Exception ex) {
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Facebook', '執行fbUpdateData facebookArray Json化發生錯誤,執行對象kolMedia_uid=" + kolMedia_uid + ", 錯誤訊息:" + ex.Message.Replace("'", "").Replace("\"", "") + "')", new { kolMedia_uid = kolMedia_uid, msg = ex.Message });
|
||
|
||
updateLog failedLog = new updateLog();
|
||
failedLog.updateLog_text = "此Facebook (" + fb_title + ") 資料更新失敗 (" + ex.Message + ")";
|
||
failedLog.updateLog_kolMedia_uid = kolMedia_uid;
|
||
failedLog.updateLog_kolMedia_accountName = "";
|
||
failedLog.updateLog_kolMedia_displayName = fb_title;
|
||
failedLog.updateLog_kol_uid = kol_uid;
|
||
failedLog.updateLog_type = "Facebook";
|
||
failedLog.updateLog_result = "failed";
|
||
failedLog.updateLog_uid = "";
|
||
|
||
conn.Insert(failedLog);
|
||
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "json_data error : " + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("fbUpdateList")]
|
||
public ActionResult FbUpdateList(IFormCollection obj) {
|
||
fbUpdateListResult ret = new fbUpdateListResult();
|
||
|
||
//撈出FB頻道清單
|
||
List<kolMedia> kolMedias = conn.Query<kolMedia>("select A.* from kolMedia A, kol B where A.kol_uid = B.kol_uid and A.option_uid = 'media' and A.optionItem_uid = 'media001' ").ToList();
|
||
|
||
foreach (kolMedia media in kolMedias) {
|
||
string overDate = DateTime.Now.AddDays(int.Parse(GlobalClass.appsettings("UpdateByDay")) * -1).ToString("yyyy/MM/dd HH:mm:ss");
|
||
|
||
updateLog objLog = conn.QueryFirstOrDefault<updateLog>("select * from updateLog where updateLog_type = 'Facebook' and updateLog_result = 'success' and updateLog_kol_uid = @kol_uid and updateLog_kolMedia_uid = @kolMedia_uid and updateLog_updateTime >= @overDate ", new { kol_uid = media.kol_uid, kolMedia_uid = media.kolMedia_uid, overDate = overDate });
|
||
|
||
if (objLog == null) {
|
||
fbClass objNew = new fbClass();
|
||
objNew.kolMedia_accountName = media.kolMedia_accountName;
|
||
objNew.kolMedia_uid = media.kolMedia_uid;
|
||
objNew.kolMedia_url = media.kolMedia_url;
|
||
objNew.kol_uid = media.kol_uid;
|
||
objNew.optionItem_uid = media.optionItem_uid;
|
||
ret.list.Add(objNew);
|
||
}
|
||
|
||
}
|
||
|
||
conn.Execute("insert into schedule (schedule_type, schedule_log) values ('Facebook', 'Server撈取清單')");
|
||
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("youtubeData")]
|
||
public ActionResult YoutubeData(IFormCollection obj) {
|
||
youtubeDataResult ret = new youtubeDataResult();
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string youtube_uid = obj["youtube_uid"].ToString();
|
||
|
||
if (youtube_uid == "") {
|
||
ret.ret = "no";
|
||
ret.err_code = "00001";
|
||
ret.message = "無 youtube_uid !";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
youtube objData = conn.QueryFirstOrDefault<youtube>("select * from youtube where youtube_revoke = 'N' and youtube_uid = @youtube_uid", new { youtube_uid = youtube_uid });
|
||
|
||
if (objData == null) {
|
||
ret.ret = "no";
|
||
ret.err_code = "00002";
|
||
ret.message = "無此 youtube_uid 資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
ret.data = new youtubeDetailClass(objData);
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("youtubeList")]
|
||
public ActionResult YoutubeList(IFormCollection obj) {
|
||
youtubeListResult ret = new youtubeListResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<youtube> youtubes = conn.Query<youtube>("select top 15 * from youtube where youtube_revoke = 'N' order by youtube_subscriberCount desc").ToList();
|
||
|
||
foreach (youtube objItem in youtubes) {
|
||
youtubeDetailClass detail = new youtubeDetailClass(objItem);
|
||
|
||
ret.youtubeList.Add(detail);
|
||
}
|
||
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("projectKolViewList")]
|
||
public ActionResult ProjectKolViewList(IFormCollection obj) {
|
||
projectKolViewResult ret = new projectKolViewResult();
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string project_uid = obj["project_uid"].ToString();
|
||
|
||
project objProj = conn.QueryFirstOrDefault<project>("select * from project where project_uid = @project_uid", new { project_uid = project_uid });
|
||
|
||
if (objProj != null)
|
||
{
|
||
ret.ret = "yes";
|
||
ret.detail = new projectKolView(objProj);
|
||
}
|
||
else {
|
||
ret.ret = "no";
|
||
ret.err_code = "00001";
|
||
ret.message = "無此project_uid資料!";
|
||
|
||
}
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("kolProjectViewList")]
|
||
public ActionResult KolProjectViewList(IFormCollection obj) {
|
||
kolProjectViewResult ret = new kolProjectViewResult();
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string project_uid = obj["project_uid"].ToString();
|
||
|
||
List<kolProjectView> kolProjectViews = conn.Query<kolProjectView>("select * from kolProjectView where project_uid = @project_uid order by kol_uid, optionItem_order", new { project_uid = project_uid }).ToList();
|
||
|
||
foreach (kolProjectView objView in kolProjectViews)
|
||
{
|
||
ret.detail.Add(new kolProjectViewDetail(objView));
|
||
}
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[HttpGet]
|
||
[Route("fileService")]
|
||
public ActionResult FileService(string uid) {
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
return Content("尚未登入!", "application/json;charset=utf-8");
|
||
}
|
||
|
||
kolfiles kolfile = conn.QueryFirstOrDefault<kolfiles>("select * from kolfiles where file_uid = @file_uid", new { file_uid = uid });
|
||
|
||
if (kolfile == null)
|
||
{
|
||
return Content("無此檔案!", "application/json;charset=utf-8");
|
||
|
||
}
|
||
|
||
|
||
|
||
//for testing purpose
|
||
string fullPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot" + kolfile.file_path);
|
||
string fileName = System.Net.WebUtility.UrlEncode(kolfile.file_originName);
|
||
// Add Content-Disposition Header
|
||
string contentDisposition = $"attachment; filename={fileName}";
|
||
Response.Headers.Add(Microsoft.Net.Http.Headers.HeaderNames.ContentDisposition, contentDisposition);
|
||
|
||
// 讀取檔案內容
|
||
byte[] fileBytes = System.IO.File.ReadAllBytes(fullPath);
|
||
|
||
return File(fileBytes, kolfile.file_mimeType);
|
||
}
|
||
|
||
[Route("kolProjectList")]
|
||
public ActionResult KolProjectList(IFormCollection obj) {
|
||
kolProjectListResult ret = new kolProjectListResult();
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string kol_uid = obj["kol_uid"].ToString();
|
||
|
||
List<kolProject> kolProjects = conn.Query<kolProject>("select A.* from kolProject A, project B where A.project_uid = B.project_uid and A.kol_uid = @kol_uid order by A.kolProject_modifydate desc", new { kol_uid = kol_uid }).ToList();
|
||
|
||
foreach (kolProject item in kolProjects)
|
||
{
|
||
kolProjectDetail objItem = new kolProjectDetail(item.kolProject_uid);
|
||
ret.datas.Add(objItem);
|
||
}
|
||
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("kolProjectAddEditDelGet")]
|
||
public ActionResult KolProjectAddEditDelGet(IFormCollection obj) {
|
||
kolProjectResult ret = new kolProjectResult();
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string method = obj["method"].ToString();
|
||
string project_uid = obj["project_uid"].ToString();
|
||
string kol_uid = obj["kol_uid"].ToString();
|
||
string kolProject_uid = obj["kolProject_uid"].ToString();
|
||
string cooperateTypeStr = obj["cooperateTypeStr"].ToString().TrimEnd(',');
|
||
string kolProjectPriceArrayJson = obj["kolProjectPriceArrayJson"].ToString().TrimEnd(',');
|
||
string kolProject_isExec = obj["kolProject_isExec"].ToString();
|
||
string kolProject_noExecReason = obj["kolProject_noExecReason"].ToString();
|
||
string kolProjectEvaluateStr = obj["kolProjectEvaluateStr"].ToString().TrimEnd(',');
|
||
string kolProjectLinkArrayJson = obj["kolProjectLinkArrayJson"].ToString().TrimEnd(',');
|
||
string kolProjectImageArrayJson = obj["kolProjectImageArrayJson"].ToString().TrimEnd(',');
|
||
string kolProjectFileArrayJson = obj["kolProjectFileArrayJson"].ToString().TrimEnd(',');
|
||
string kolProject_memo = obj["kolProject_memo"].ToString();
|
||
|
||
if (method == "del") {
|
||
kolProject kp = conn.QueryFirstOrDefault<kolProject>("select * from kolProject where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
|
||
if (kp == null)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "10009";
|
||
ret.message = "無此kolProject_uid資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
conn.Execute("delete kolCooperateType where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectEvaluate where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectPrice where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectLink where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectImage where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectFile where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProject where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
if (method == "get") {
|
||
|
||
|
||
kolProject kp = conn.QueryFirstOrDefault<kolProject>("select * from kolProject where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
|
||
if (kp == null) {
|
||
ret.ret = "no";
|
||
ret.err_code = "10009";
|
||
ret.message = "無此kolProject_uid資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
ret.data = new kolProjectDetail(kp.kolProject_uid);
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
|
||
}
|
||
|
||
if (method == "edit") {
|
||
kolProject kp = conn.QueryFirstOrDefault<kolProject>("select * from kolProject where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
|
||
if (kp == null) {
|
||
ret.ret = "no";
|
||
ret.err_code = "10009";
|
||
ret.message = "無此kolProject_uid資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
kp.kol_uid = kol_uid;
|
||
kp.project_uid = project_uid;
|
||
kp.kolProject_isExec = kolProject_isExec;
|
||
kp.kolProject_noExecReason = kolProject_noExecReason;
|
||
kp.kolProject_memo = kolProject_memo;
|
||
kp.user_uid = token.user_id;
|
||
kp.user_name = token.user_name;
|
||
kp.kolProject_modifydate = DateTime.Now;
|
||
|
||
string[] cooperateTypeArr = cooperateTypeStr.Split(',');
|
||
string[] kolProjectEvaluateArr = kolProjectEvaluateStr.Split(',');
|
||
|
||
List<kolCooperateType> kolCooperateTypes = new List<kolCooperateType>();
|
||
List<kolProjectEvaluate> kolProjectEvaluates = new List<kolProjectEvaluate>();
|
||
|
||
foreach (string cooperate in cooperateTypeArr)
|
||
{
|
||
kolCooperateType kct = new kolCooperateType();
|
||
kct.kolCooperateType_uid = "kct_" + GlobalClass.CreateRandomCode(16);
|
||
kct.project_uid = project_uid;
|
||
kct.kol_uid = kol_uid;
|
||
kct.option_uid = "cooperateType";
|
||
kct.optionItem_uid = cooperate;
|
||
kct.kolProject_uid = kolProject_uid;
|
||
|
||
kolCooperateTypes.Add(kct);
|
||
}
|
||
|
||
foreach (string evaluate in kolProjectEvaluateArr)
|
||
{
|
||
if (evaluate != "")
|
||
{
|
||
kolProjectEvaluate kpe = new kolProjectEvaluate();
|
||
kpe.kol_uid = kol_uid;
|
||
kpe.project_uid = project_uid;
|
||
kpe.kolProject_uid = kolProject_uid;
|
||
kpe.kolProjectEvaluate_text = evaluate;
|
||
|
||
kolProjectEvaluates.Add(kpe);
|
||
}
|
||
}
|
||
|
||
dynamic kolProjectPriceJsonObj;
|
||
|
||
try
|
||
{
|
||
kolProjectPriceJsonObj = JsonConvert.DeserializeObject(kolProjectPriceArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "kolProjectPrice json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolProjectPrice> kolProjectPrices = new List<kolProjectPrice>();
|
||
|
||
foreach (dynamic item in kolProjectPriceJsonObj)
|
||
{
|
||
kolProjectPrice kpp = new kolProjectPrice();
|
||
kpp.kolProjectPrice_uid = "kpp_" + GlobalClass.CreateRandomCode(16);
|
||
kpp.kolProject_uid = kolProject_uid;
|
||
kpp.optionItem_uid = item.optionItem_uid;
|
||
kpp.mediaItem_uid = item.mediaItem_uid;
|
||
kpp.kolProjectPrice_other = item.kolProjectPrice_other;
|
||
kpp.kolProjectPrice_num = item.kolProjectPrice_num;
|
||
kpp.kolProjectPrice_cost = item.kolProjectPrice_cost;
|
||
kpp.kolProjectPrice_date = item.kolProjectPrice_date;
|
||
kpp.kolProjectPrice_createdate = DateTime.Now;
|
||
kpp.kolProjectPrice_modifydate = DateTime.Now;
|
||
|
||
kolProjectPrices.Add(kpp);
|
||
}
|
||
|
||
dynamic kolProjectLinkJsonObj;
|
||
|
||
try
|
||
{
|
||
kolProjectLinkJsonObj = JsonConvert.DeserializeObject(kolProjectLinkArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "kolProjectPrice json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolProjectLink> kolProjectLinks = new List<kolProjectLink>();
|
||
|
||
foreach (dynamic item in kolProjectLinkJsonObj)
|
||
{
|
||
kolProjectLink kpl = new kolProjectLink();
|
||
kpl.kolProjectLink_uid = "kpl_" + GlobalClass.CreateRandomCode(16);
|
||
kpl.kolProject_uid = kolProject_uid;
|
||
kpl.kolProjectLink_url = item.kolProjectLink_url;
|
||
kpl.kolProjectLink_text = item.kolProjectLink_text;
|
||
kpl.kolProjectLink_createdate = DateTime.Now;
|
||
|
||
kolProjectLinks.Add(kpl);
|
||
}
|
||
|
||
dynamic kolProjectFileJsonObj;
|
||
|
||
try {
|
||
kolProjectFileJsonObj = JsonConvert.DeserializeObject(kolProjectFileArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "kolProjectFile json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolProjectFile> kolProjectFiles = new List<kolProjectFile>();
|
||
|
||
foreach (dynamic item in kolProjectFileJsonObj)
|
||
{
|
||
kolProjectFile kpf = new kolProjectFile();
|
||
kpf.kolProjectFile_uid = "kpf_" + GlobalClass.CreateRandomCode(16);
|
||
kpf.kolProject_uid = kolProject_uid;
|
||
kpf.file_uid = item.file_uid;
|
||
kpf.kolProjectFile_path = item.kolProjectFile_path;
|
||
kpf.kolProjectFile_originFileName = item.kolProjectFile_originFileName;
|
||
kpf.kolProjectFile_createdate = DateTime.Now;
|
||
|
||
kolProjectFiles.Add(kpf);
|
||
}
|
||
|
||
dynamic kolProjectImageJsonObj;
|
||
|
||
try
|
||
{
|
||
kolProjectImageJsonObj = JsonConvert.DeserializeObject(kolProjectImageArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "kolProjectImage json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolProjectImage> kolProjectImages = new List<kolProjectImage>();
|
||
|
||
foreach (dynamic item in kolProjectImageJsonObj)
|
||
{
|
||
kolProjectImage kpi = new kolProjectImage();
|
||
kpi.kolProjectImage_uid = "kpi_" + GlobalClass.CreateRandomCode(16);
|
||
kpi.kolProjectImage_photo = item.kolProjectImage_photo;
|
||
kpi.kolProjectImage_desc = item.kolProjectImage_desc;
|
||
kpi.kolProject_uid = kolProject_uid;
|
||
kpi.kolProjectImage_createdate = DateTime.Now;
|
||
|
||
kolProjectImages.Add(kpi);
|
||
}
|
||
|
||
conn.Update(kp);
|
||
|
||
conn.Execute("delete kolCooperateType where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectEvaluate where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectPrice where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectLink where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectImage where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
conn.Execute("delete kolProjectFile where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid });
|
||
|
||
|
||
conn.Insert(kolCooperateTypes);
|
||
conn.Insert(kolProjectEvaluates);
|
||
conn.Insert(kolProjectPrices);
|
||
conn.Insert(kolProjectLinks);
|
||
conn.Insert(kolProjectImages);
|
||
conn.Insert(kolProjectFiles);
|
||
|
||
|
||
ret.data.kolProject = kp;
|
||
ret.data.kolProjectEvaluates = kolProjectEvaluates;
|
||
ret.data.kolProjectPrices = conn.Query<kolProjectPriceDetail>("select * from kolProjectPriceDetail where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid }).ToList();
|
||
ret.data.kolProjectLinks = kolProjectLinks;
|
||
ret.data.kolProjectImages = kolProjectImages;
|
||
ret.data.kolCooperateTypes = kolCooperateTypes;
|
||
ret.data.kolProjectFiles = kolProjectFiles;
|
||
ret.data.project = conn.QueryFirst<project>("select * from project where project_uid = @project_uid ", new { project_uid = kp.project_uid });
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
if (method == "add") {
|
||
kolProject_uid = "kp_" + GlobalClass.CreateRandomCode(16);
|
||
|
||
kolProject kp = new kolProject();
|
||
|
||
kp.kolProject_uid = kolProject_uid;
|
||
kp.kol_uid = kol_uid;
|
||
kp.project_uid = project_uid;
|
||
kp.kolProject_isExec = kolProject_isExec;
|
||
kp.kolProject_noExecReason = kolProject_noExecReason;
|
||
kp.kolProject_memo = kolProject_memo;
|
||
kp.user_uid = token.user_id;
|
||
kp.user_name = token.user_name;
|
||
kp.kolProject_createdate = DateTime.Now;
|
||
kp.kolProject_modifydate = DateTime.Now;
|
||
|
||
string[] cooperateTypeArr = cooperateTypeStr.Split(',');
|
||
string[] kolProjectEvaluateArr = kolProjectEvaluateStr.Split(',');
|
||
|
||
List<kolCooperateType> kolCooperateTypes = new List<kolCooperateType>();
|
||
List<kolProjectEvaluate> kolProjectEvaluates = new List<kolProjectEvaluate>();
|
||
|
||
foreach (string cooperate in cooperateTypeArr)
|
||
{
|
||
kolCooperateType kct = new kolCooperateType();
|
||
kct.kolCooperateType_uid = "kct_" + GlobalClass.CreateRandomCode(16);
|
||
kct.project_uid = project_uid;
|
||
kct.kol_uid = kol_uid;
|
||
kct.option_uid = "cooperateType";
|
||
kct.optionItem_uid = cooperate;
|
||
kct.kolProject_uid = kolProject_uid;
|
||
|
||
kolCooperateTypes.Add(kct);
|
||
}
|
||
|
||
foreach (string evaluate in kolProjectEvaluateArr)
|
||
{
|
||
if (evaluate != "") {
|
||
kolProjectEvaluate kpe = new kolProjectEvaluate();
|
||
kpe.kol_uid = kol_uid;
|
||
kpe.project_uid = project_uid;
|
||
kpe.kolProject_uid = kolProject_uid;
|
||
kpe.kolProjectEvaluate_text = evaluate;
|
||
|
||
kolProjectEvaluates.Add(kpe);
|
||
}
|
||
}
|
||
|
||
dynamic kolProjectFileJsonObj;
|
||
|
||
try
|
||
{
|
||
kolProjectFileJsonObj = JsonConvert.DeserializeObject(kolProjectFileArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "kolProjectFile json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolProjectFile> kolProjectFiles = new List<kolProjectFile>();
|
||
|
||
foreach (dynamic item in kolProjectFileJsonObj)
|
||
{
|
||
kolProjectFile kpf = new kolProjectFile();
|
||
kpf.kolProjectFile_uid = "kpf_" + GlobalClass.CreateRandomCode(16);
|
||
kpf.kolProject_uid = kolProject_uid;
|
||
kpf.file_uid = item.file_uid;
|
||
kpf.kolProjectFile_path = item.kolProjectFile_path;
|
||
kpf.kolProjectFile_originFileName = item.kolProjectFile_originFileName;
|
||
kpf.kolProjectFile_createdate = DateTime.Now;
|
||
|
||
kolProjectFiles.Add(kpf);
|
||
}
|
||
|
||
dynamic kolProjectPriceJsonObj;
|
||
|
||
try
|
||
{
|
||
kolProjectPriceJsonObj = JsonConvert.DeserializeObject(kolProjectPriceArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "kolProjectPrice json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolProjectPrice> kolProjectPrices = new List<kolProjectPrice>();
|
||
|
||
foreach (dynamic item in kolProjectPriceJsonObj) {
|
||
kolProjectPrice kpp = new kolProjectPrice();
|
||
kpp.kolProjectPrice_uid = "kpp_" + GlobalClass.CreateRandomCode(16);
|
||
kpp.kolProject_uid = kolProject_uid;
|
||
kpp.optionItem_uid = item.optionItem_uid;
|
||
kpp.mediaItem_uid = item.mediaItem_uid;
|
||
kpp.kolProjectPrice_other = item.kolProjectPrice_other;
|
||
kpp.kolProjectPrice_num = item.kolProjectPrice_num;
|
||
kpp.kolProjectPrice_cost = item.kolProjectPrice_cost;
|
||
kpp.kolProjectPrice_date = item.kolProjectPrice_date;
|
||
kpp.kolProjectPrice_createdate = DateTime.Now;
|
||
kpp.kolProjectPrice_modifydate = DateTime.Now;
|
||
|
||
kolProjectPrices.Add(kpp);
|
||
}
|
||
|
||
dynamic kolProjectLinkJsonObj;
|
||
|
||
try
|
||
{
|
||
kolProjectLinkJsonObj = JsonConvert.DeserializeObject(kolProjectLinkArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "kolProjectPrice json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolProjectLink> kolProjectLinks = new List<kolProjectLink>();
|
||
|
||
foreach (dynamic item in kolProjectLinkJsonObj) {
|
||
kolProjectLink kpl = new kolProjectLink();
|
||
kpl.kolProjectLink_uid = "kpl_" + GlobalClass.CreateRandomCode(16);
|
||
kpl.kolProject_uid = kolProject_uid;
|
||
kpl.kolProjectLink_url = item.kolProjectLink_url;
|
||
kpl.kolProjectLink_text = item.kolProjectLink_text;
|
||
kpl.kolProjectLink_createdate = DateTime.Now;
|
||
|
||
kolProjectLinks.Add(kpl);
|
||
}
|
||
|
||
dynamic kolProjectImageJsonObj;
|
||
|
||
try
|
||
{
|
||
kolProjectImageJsonObj = JsonConvert.DeserializeObject(kolProjectImageArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "kolProjectImage json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolProjectImage> kolProjectImages = new List<kolProjectImage>();
|
||
|
||
foreach (dynamic item in kolProjectImageJsonObj) {
|
||
kolProjectImage kpi = new kolProjectImage();
|
||
kpi.kolProjectImage_uid = "kpi_" + GlobalClass.CreateRandomCode(16);
|
||
kpi.kolProjectImage_photo = item.kolProjectImage_photo;
|
||
kpi.kolProjectImage_desc = item.kolProjectImage_desc;
|
||
kpi.kolProject_uid = kolProject_uid;
|
||
kpi.kolProjectImage_createdate = DateTime.Now;
|
||
|
||
kolProjectImages.Add(kpi);
|
||
}
|
||
|
||
conn.Insert(kp);
|
||
conn.Insert(kolCooperateTypes);
|
||
conn.Insert(kolProjectEvaluates);
|
||
conn.Insert(kolProjectPrices);
|
||
conn.Insert(kolProjectLinks);
|
||
conn.Insert(kolProjectImages);
|
||
conn.Insert(kolProjectFiles);
|
||
|
||
|
||
ret.data.kolProject = kp;
|
||
ret.data.kolProjectEvaluates = kolProjectEvaluates;
|
||
ret.data.kolProjectPrices = conn.Query<kolProjectPriceDetail>("select * from kolProjectPriceDetail where kolProject_uid = @kolProject_uid", new { kolProject_uid = kolProject_uid }).ToList();
|
||
ret.data.kolProjectLinks = kolProjectLinks;
|
||
ret.data.kolProjectImages = kolProjectImages;
|
||
ret.data.kolCooperateTypes = kolCooperateTypes;
|
||
ret.data.kolProjectFiles = kolProjectFiles;
|
||
ret.data.project = conn.QueryFirst<project>("select * from project where project_uid = @project_uid ", new { project_uid = kp.project_uid });
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("mediaSpecList")]
|
||
public ActionResult MediaSpecList(IFormCollection obj) {
|
||
mediaSpecListResult ret = new mediaSpecListResult();
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string optionItem_uid = obj["optionItem_uid"].ToString();
|
||
|
||
ret.mediaSpecList = conn.Query<mediaItem>("select * from mediaItem where mediaItem_ishide = 'N' and optionItem_uid = @optionItem_uid order by mediaItem_order", new { optionItem_uid = optionItem_uid }).ToList();
|
||
|
||
ret.ret = "yes";
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("fileUpload")]
|
||
[RequestFormLimits(MultipartBodyLengthLimit = int.MaxValue)]
|
||
[RequestSizeLimit(int.MaxValue)]
|
||
public ActionResult FileUpload([FromForm(Name = "uploadFile")] IFormFile file) {
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
List<errFile> files = new List<errFile>();
|
||
|
||
errFile newFile = new errFile();
|
||
newFile.name = "";
|
||
newFile.size = 0;
|
||
newFile.error = "尚未登入";
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
return Content(JsonConvert.SerializeObject(files), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
string originFileName = file.FileName;
|
||
string newFileName = "uid_" + GlobalClass.CreateRandomCode(16) + Path.GetExtension(originFileName);
|
||
string fullPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/files/" + newFileName);
|
||
|
||
kolfiles objFile = new kolfiles();
|
||
|
||
objFile.file_uid = "f_" + GlobalClass.CreateRandomCode(22);
|
||
objFile.file_originName = originFileName;
|
||
objFile.file_path = "/files/" + newFileName;
|
||
objFile.file_mimeType = file.ContentType;
|
||
objFile.file_createdate = DateTime.Now;
|
||
|
||
|
||
|
||
try
|
||
{
|
||
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||
{
|
||
file.CopyTo(stream);
|
||
}
|
||
|
||
conn.Insert<kolfiles>(objFile);
|
||
|
||
List<uploadFile> files = new List<uploadFile>();
|
||
|
||
uploadFile newFile = new uploadFile();
|
||
|
||
newFile.name = originFileName;
|
||
newFile.url = "/Api/fileService?uid=" + objFile.file_uid;
|
||
newFile.size = file.Length;
|
||
newFile.thumbnailUrl = "/Api/fileService?uid=" + objFile.file_uid;
|
||
newFile.deleteUrl = "/Api/fileService?uid=" + objFile.file_uid;
|
||
newFile.uid = objFile.file_uid;
|
||
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
|
||
|
||
|
||
|
||
return Content(JsonConvert.SerializeObject(obj), "application/json;charset=utf-8");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
List<errFile> files = new List<errFile>();
|
||
|
||
errFile newFile = new errFile();
|
||
newFile.name = originFileName;
|
||
newFile.size = file.Length;
|
||
newFile.error = ex.Message;
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
return Content(JsonConvert.SerializeObject(files), "application/json;charset=utf-8");
|
||
}
|
||
}
|
||
|
||
[Route("subPhotoUpload")]
|
||
[RequestFormLimits(MultipartBodyLengthLimit = int.MaxValue)]
|
||
[RequestSizeLimit(int.MaxValue)]
|
||
public ActionResult SubPhotoUpload([FromForm(Name = "subPhoto")] IFormFile file)
|
||
{
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
List<errFile> files = new List<errFile>();
|
||
|
||
errFile newFile = new errFile();
|
||
newFile.name = "";
|
||
newFile.size = 0;
|
||
newFile.error = "尚未登入";
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
return Content(JsonConvert.SerializeObject(files), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
string originFileName = file.FileName;
|
||
string newFileName = "cutPhoto_" + GlobalClass.CreateRandomCode(8) + Path.GetExtension(originFileName);
|
||
string fullPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images/cut/" + newFileName);
|
||
try
|
||
{
|
||
using (var stream = new FileStream(fullPath, FileMode.Create))
|
||
{
|
||
file.CopyTo(stream);
|
||
}
|
||
|
||
List<uploadFile> files = new List<uploadFile>();
|
||
|
||
uploadFile newFile = new uploadFile();
|
||
|
||
newFile.name = originFileName;
|
||
newFile.url = "/images/cut/" + newFileName;
|
||
newFile.size = file.Length;
|
||
newFile.thumbnailUrl = "/images/cut/" + newFileName;
|
||
newFile.deleteUrl = "/images/cut/" + newFileName;
|
||
|
||
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
|
||
|
||
|
||
|
||
return Content(JsonConvert.SerializeObject(obj), "application/json;charset=utf-8");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
List<errFile> files = new List<errFile>();
|
||
|
||
errFile newFile = new errFile();
|
||
newFile.name = originFileName;
|
||
newFile.size = file.Length;
|
||
newFile.error = ex.Message;
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
return Content(JsonConvert.SerializeObject(files), "application/json;charset=utf-8");
|
||
}
|
||
}
|
||
|
||
[Route("updateTags")]
|
||
public ActionResult UpdateTags(IFormCollection obj) {
|
||
updatTagResult ret = new updatTagResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string search = obj["search"].ToString();
|
||
|
||
if (search.Length < 2) {
|
||
ret.ret = "no";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
tags tag = conn.QueryFirstOrDefault<tags>("select * from tags where tag_text = @tag_text", new { tag_text = search });
|
||
|
||
|
||
|
||
if (tag == null)
|
||
{
|
||
tags newTag = new tags();
|
||
newTag.tag_uid = "tag_" + GlobalClass.CreateRandomCode(12);
|
||
newTag.tag_text = search;
|
||
|
||
conn.Insert<tags>(newTag);
|
||
|
||
ret.data.id = newTag.tag_uid;
|
||
ret.data.text = search;
|
||
ret.ret = "yes";
|
||
}
|
||
else {
|
||
ret.data.id = tag.tag_uid;
|
||
ret.data.text = search;
|
||
ret.ret = "yes";
|
||
}
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("queryTags")]
|
||
public ActionResult QueryTags(IFormCollection obj) {
|
||
tagListResult ret = new tagListResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string search = obj["search"].ToString();
|
||
|
||
search = "%" + search + "%";
|
||
|
||
List<tags> tagList = conn.Query<tags>("select * from tags where tag_text like @tag_text", new { tag_text = search }).ToList();
|
||
|
||
foreach (tags tag in tagList)
|
||
{
|
||
optionData item = new optionData();
|
||
|
||
item.id = tag.tag_uid;
|
||
item.text = tag.tag_text;
|
||
|
||
ret.data.Add(item);
|
||
}
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("queryPrmFile")]
|
||
public ActionResult QueryPrmFile(IFormCollection obj) {
|
||
prmFileResult ret = new prmFileResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string quotation_serial = obj["quotation_serial"].ToString();
|
||
|
||
files fil = prmConn.QueryFirstOrDefault<files>("select * from files where file_target_uid = @quotation_serial and file_del = 'N'", new { quotation_serial = quotation_serial });
|
||
|
||
if (fil == null)
|
||
{
|
||
ret.ret = "yes";
|
||
ret.hasFile = "N";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
else {
|
||
ret.ret = "yes";
|
||
ret.hasFile = "Y";
|
||
ret.fileName = fil.file_filename;
|
||
ret.fileUrl = "https://prm.bremennetwork.tw/api/fileService4Journeys.ashx?id=" + fil.file_uid;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
|
||
}
|
||
|
||
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("queryPrm")]
|
||
public ActionResult QueryPrm(IFormCollection obj) {
|
||
prmResult ret = new prmResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string search = obj["search"].ToString();
|
||
|
||
string quotation_serial = search + "%";
|
||
string quotation_name = "%" + search + "%";
|
||
|
||
List<quotation> quotations = prmConn.Query<quotation>("select * from quotation where dept_uid in ('bremen', 'journeys') and quotation_del = 'N' and quotation_invalid = 'N' and (quotation_serial like @quotation_serial or quotation_name like @quotation_name) order by quotation_serial desc ", new { quotation_serial = quotation_serial, quotation_name = quotation_name }).ToList();
|
||
|
||
foreach (quotation proj in quotations)
|
||
{
|
||
optionData item = new optionData();
|
||
|
||
item.id = proj.quotation_serial;
|
||
item.text = "(" + proj.quotation_serial + ") " + proj.quotation_name;
|
||
|
||
ret.data.Add(item);
|
||
}
|
||
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("projectAddEditDelGet")]
|
||
public ActionResult ProjectAddEditDelGet(IFormCollection obj)
|
||
{
|
||
projectResult ret = new projectResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string method = obj["method"].ToString();
|
||
string project_uid = obj["project_uid"].ToString();
|
||
|
||
string project_isPrm = obj["project_isPrm"].ToString();
|
||
string project_prmSerial = obj["project_prmSerial"].ToString();
|
||
string project_name = obj["project_name"].ToString();
|
||
string project_year = obj["project_year"].ToString();
|
||
string project_month = obj["project_month"].ToString();
|
||
string project_isExec = project_isPrm;
|
||
|
||
if (method == "del") {
|
||
project newProj = conn.QueryFirstOrDefault<project>("select * from project where project_uid = @project_uid", new { project_uid = project_uid });
|
||
|
||
if (newProj == null)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "2001";
|
||
ret.message = "找不到此專案資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
conn.Delete<project>(newProj);
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
if (method == "get") {
|
||
project newProj = conn.QueryFirstOrDefault<project>("select * from project where project_uid = @project_uid", new { project_uid = project_uid });
|
||
|
||
if (newProj == null)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "2001";
|
||
ret.message = "找不到此專案資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
ret.ret = "yes";
|
||
ret.data = newProj;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
if (method == "edit") {
|
||
project newProj = conn.QueryFirstOrDefault<project>("select * from project where project_uid = @project_uid", new { project_uid = project_uid });
|
||
|
||
if (newProj == null) {
|
||
ret.ret = "no";
|
||
ret.err_code = "2001";
|
||
ret.message = "找不到此專案資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
newProj.project_name = project_name;
|
||
newProj.project_isPrm = project_isPrm;
|
||
newProj.project_year = int.Parse(project_year);
|
||
newProj.project_month = int.Parse(project_month);
|
||
newProj.project_modifydate = DateTime.Now;
|
||
newProj.project_modify_id = token.user_id;
|
||
newProj.project_prmSerial = project_prmSerial;
|
||
newProj.project_isExec = project_isExec;
|
||
|
||
conn.Update<project>(newProj);
|
||
ret.ret = "yes";
|
||
ret.data = newProj;
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
if (method == "add") {
|
||
project_uid = GlobalClass.CreateRandomCode(12);
|
||
|
||
if (project_isPrm == "Y")
|
||
{
|
||
project findProje = conn.QueryFirstOrDefault<project>("select * from project where project_prmSerial = @project_prmSerial", new { project_prmSerial = project_prmSerial });
|
||
if (findProje != null)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "1001";
|
||
ret.message = "此PRM專案已經存在於KOL系統之中!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
}
|
||
else {
|
||
project findProje = conn.QueryFirstOrDefault<project>("select * from project where project_name = @project_name and project_year = @project_year and project_month = @project_month ", new { project_name = project_name, project_year = project_year, project_month = project_month });
|
||
if (findProje != null)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "1002";
|
||
ret.message = "此專案名稱已經存在於KOL系統之中!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
}
|
||
|
||
project newProj = new project();
|
||
|
||
newProj.project_uid = project_uid;
|
||
newProj.project_name = project_name;
|
||
newProj.project_isPrm = project_isPrm;
|
||
newProj.project_year = int.Parse(project_year);
|
||
newProj.project_month = int.Parse(project_month);
|
||
newProj.project_create_id = token.user_id;
|
||
newProj.project_modify_id = token.user_id;
|
||
newProj.project_prmSerial = project_prmSerial;
|
||
newProj.project_isExec = project_isExec;
|
||
|
||
conn.Insert(newProj);
|
||
ret.ret = "yes";
|
||
ret.data = newProj;
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("projectList")]
|
||
public ActionResult ProjectList(IFormCollection obj) {
|
||
projectListResult ret = new projectListResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string project_year = obj["year"].ToString();
|
||
string project_month = obj["month"].ToString();
|
||
string is_filiter = obj["is_filiter"].ToString();
|
||
string start = obj["start"].ToString();
|
||
string end = obj["end"].ToString();
|
||
string isExec = obj["isExec"].ToString();
|
||
|
||
|
||
if (is_filiter == "Y") {
|
||
string dateString = "";
|
||
string exeString = "";
|
||
|
||
if (start != "" && end != "") {
|
||
start = start.Replace("/", "");
|
||
end = end.Replace("/", "");
|
||
|
||
dateString = " and ((CONVERT(NVARCHAR, project_year) + RIGHT('00' + CONVERT(NVARCHAR, project_month), 2)) >= '" + start + "') and ((CONVERT(NVARCHAR, project_year) + RIGHT('00' + CONVERT(NVARCHAR, project_month), 2)) <= '" + end + "' ) ";
|
||
}
|
||
|
||
if (isExec != "A") {
|
||
exeString = " and project_isExec = '" + isExec + "' ";
|
||
}
|
||
|
||
string sqlString = "select * from project where 1=1 " + dateString + exeString + " order by project_modifydate desc ";
|
||
|
||
List<project> projects = conn.Query<project>(sqlString).ToList();
|
||
foreach (project item in projects)
|
||
{
|
||
ret.projectList.Add(new projectDetail(item));
|
||
}
|
||
|
||
ret.ret = "yes";
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
if (project_year == "")
|
||
{
|
||
List<project> projects = conn.Query<project>("select * from project order by project_modifydate desc ").ToList();
|
||
|
||
foreach (project item in projects) {
|
||
ret.projectList.Add(new projectDetail(item));
|
||
}
|
||
|
||
//ret.projectList = projects;
|
||
}
|
||
else {
|
||
List<project> projects = conn.Query<project>("select * from project where project_year = @project_year and project_month = @project_month order by project_modifydate desc ", new { project_year = project_year, project_month = project_month }).ToList();
|
||
|
||
foreach (project item in projects)
|
||
{
|
||
ret.projectList.Add(new projectDetail(item));
|
||
}
|
||
//ret.projectList = projects;
|
||
}
|
||
|
||
|
||
|
||
ret.ret = "yes";
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("kolList")]
|
||
public ActionResult KolList(IFormCollection obj) {
|
||
kolListResult ret = new kolListResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string is_filiter = obj["is_filiter"].ToString();
|
||
string kolMediaJson = obj["kolMediaJson"].ToString();
|
||
string kolMakeupJson = obj["kolMakeupJson"].ToString();
|
||
string kolStyleJson = obj["kolStyleJson"].ToString();
|
||
string kolFansTypeJson = obj["kolFansTypeJson"].ToString();
|
||
string kolTagsJson = obj["kolTagsJson"].ToString();
|
||
|
||
string SQLString = "";
|
||
|
||
if (is_filiter == "Y")
|
||
{
|
||
string whereString = "";
|
||
|
||
SQLString += "SELECT distinct kol.kol_sn, kol.kol_uid, kol.kol_name, kol.kol_photo, kol.kol_descript, kol.kol_men_ratio, ";
|
||
SQLString += " kol.kol_women_ratio, kol.kol_13_17, kol.kol_18_24, kol.kol_25_34, kol.kol_35_44, ";
|
||
SQLString += " kol.kol_45_54, kol.kol_55_64, kol.kol_65, kol.kol_contact1, kol.kol_contact2, ";
|
||
SQLString += " kol.kol_createdate, kol.kol_modifydate, kol.kol_create_userId, kol.kol_modify_userId ";
|
||
SQLString += "FROM kol LEFT OUTER JOIN ";
|
||
SQLString += " kolFansType ON kol.kol_uid = kolFansType.kol_uid LEFT OUTER JOIN ";
|
||
SQLString += " kolMakeup ON kol.kol_uid = kolMakeup.kol_uid LEFT OUTER JOIN ";
|
||
SQLString += " kolTag ON kol.kol_uid = kolTag.kol_uid LEFT OUTER JOIN ";
|
||
SQLString += " kolStyle ON kol.kol_uid = kolStyle.kol_uid LEFT OUTER JOIN ";
|
||
SQLString += " kolMedia ON kol.kol_uid = kolMedia.kol_uid ";
|
||
|
||
if (kolMediaJson != "") {
|
||
dynamic kolMediaObj;
|
||
|
||
try
|
||
{
|
||
kolMediaObj = JsonConvert.DeserializeObject(kolMediaJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "media json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string filiterSql = "";
|
||
|
||
foreach (dynamic item in kolMediaObj) {
|
||
filiterSql += " kolMedia.optionItem_uid = '" + item.optionItem + "' Or";
|
||
}
|
||
|
||
filiterSql = " and (" + filiterSql.TrimEnd('r').TrimEnd('O') + ") ";
|
||
whereString += filiterSql;
|
||
}
|
||
|
||
if (kolMakeupJson != "")
|
||
{
|
||
dynamic kolMakeupObj;
|
||
|
||
try
|
||
{
|
||
kolMakeupObj = JsonConvert.DeserializeObject(kolMakeupJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "media json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string filiterSql = "";
|
||
|
||
foreach (dynamic item in kolMakeupObj)
|
||
{
|
||
filiterSql += " kolMakeup.optionItem_uid = '" + item.optionItem + "' Or";
|
||
}
|
||
|
||
filiterSql = " and (" + filiterSql.TrimEnd('r').TrimEnd('O') + ") ";
|
||
whereString += filiterSql;
|
||
}
|
||
|
||
if (kolStyleJson != "")
|
||
{
|
||
dynamic kolStyleObj;
|
||
|
||
try
|
||
{
|
||
kolStyleObj = JsonConvert.DeserializeObject(kolStyleJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "media json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string filiterSql = "";
|
||
|
||
foreach (dynamic item in kolStyleObj)
|
||
{
|
||
filiterSql += " kolStyle.optionItem_uid = '" + item.optionItem + "' Or";
|
||
}
|
||
|
||
filiterSql = " and (" + filiterSql.TrimEnd('r').TrimEnd('O') + ") ";
|
||
whereString += filiterSql;
|
||
}
|
||
|
||
if (kolFansTypeJson != "")
|
||
{
|
||
dynamic kolFansTypeObj;
|
||
|
||
try
|
||
{
|
||
kolFansTypeObj = JsonConvert.DeserializeObject(kolFansTypeJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "media json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string filiterSql = "";
|
||
|
||
foreach (dynamic item in kolFansTypeObj)
|
||
{
|
||
filiterSql += " kolFansType.optionItem_uid = '" + item.optionItem + "' Or";
|
||
}
|
||
|
||
filiterSql = " and (" + filiterSql.TrimEnd('r').TrimEnd('O') + ") ";
|
||
whereString += filiterSql;
|
||
}
|
||
|
||
if (kolTagsJson != "")
|
||
{
|
||
dynamic kolTagsObj;
|
||
|
||
try
|
||
{
|
||
kolTagsObj = JsonConvert.DeserializeObject(kolTagsJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "media json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string filiterSql = "";
|
||
|
||
foreach (dynamic item in kolTagsObj)
|
||
{
|
||
filiterSql += " kolTag.tag_uid = '" + item.tag_uid + "' Or";
|
||
}
|
||
|
||
filiterSql = " and (" + filiterSql.TrimEnd('r').TrimEnd('O') + ") ";
|
||
whereString += filiterSql;
|
||
}
|
||
|
||
if (whereString != "") {
|
||
SQLString = SQLString + " where 1=1 " + whereString + " order by kol_modifydate desc";
|
||
}
|
||
|
||
|
||
}
|
||
else {
|
||
SQLString = "select * from kol order by kol_modifydate desc";
|
||
}
|
||
|
||
List<kol> kols = conn.Query<kol>(SQLString).ToList();
|
||
|
||
foreach (kol kolItem in kols)
|
||
{
|
||
kolDetial objItem = new kolDetial(kolItem);
|
||
|
||
ret.kolList.Add(objItem);
|
||
}
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("kolAddEditDelGet")]
|
||
public ActionResult kolAddEditDelGet(IFormCollection obj) {
|
||
kolResult ret = new kolResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string method = obj["method"].ToString();
|
||
string kol_uid = obj["kol_uid"].ToString();
|
||
|
||
if (method == "del") {
|
||
conn.Execute("delete kol where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolMakeup where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolStyle where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolFansType where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolMedia where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolCooperateType where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolTag where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
|
||
ret.ret = "yes";
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
if (method == "get")
|
||
{
|
||
kol kolData = conn.QueryFirstOrDefault<kol>("select * from kol where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
|
||
if (kolData == null)
|
||
{
|
||
ret.ret = "no";
|
||
ret.message = "找不到此kol_uid資料!";
|
||
ret.err_code = "0003";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
ret.kol = new kolDetial(kolData);
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
string kol_name = obj["kol_name"].ToString();
|
||
string kol_descript = obj["kol_descript"].ToString();
|
||
string kol_contact1 = obj["kol_contact1"].ToString();
|
||
string kol_contact2 = obj["kol_contact2"].ToString();
|
||
double kol_men_ratio = double.Parse(obj["kol_men_ratio"].ToString());
|
||
double kol_women_ratio = double.Parse(obj["kol_women_ratio"].ToString());
|
||
double kol_13_17 = double.Parse(obj["kol_13_17"].ToString());
|
||
double kol_18_24 = double.Parse(obj["kol_18_24"].ToString());
|
||
double kol_25_34 = double.Parse(obj["kol_25_34"].ToString());
|
||
double kol_35_44 = double.Parse(obj["kol_35_44"].ToString());
|
||
double kol_45_54 = double.Parse(obj["kol_45_54"].ToString());
|
||
double kol_55_64 = double.Parse(obj["kol_55_64"].ToString());
|
||
double kol_65 = double.Parse(obj["kol_65"].ToString());
|
||
string kol_photo = obj["kol_photo"].ToString();
|
||
|
||
string kolMakeupStr = obj["kolMakeupStr"].ToString().TrimEnd(',');
|
||
string kolStyleStr = obj["kolStyleStr"].ToString().TrimEnd(',');
|
||
string kolFansTypeStr = obj["kolFansType"].ToString().TrimEnd(',');
|
||
string kolTagsStr = obj["kolTags"].ToString().TrimEnd(',');
|
||
string mediaArrayJson = obj["mediaArrayJson"].ToString().TrimEnd(',');
|
||
|
||
if (method == "") {
|
||
ret.ret = "no";
|
||
ret.err_code = "0001";
|
||
ret.message = "無method參數!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
if (method == "edit") {
|
||
string err_msg = "";
|
||
|
||
if (kol_name == "")
|
||
{
|
||
err_msg = "請輸入KOL頻道名稱!\n";
|
||
}
|
||
|
||
if (kol_photo == "")
|
||
{
|
||
err_msg += "請選擇KOL的照片!\n";
|
||
}
|
||
|
||
if (err_msg != "")
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0002";
|
||
ret.message = err_msg;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
kol newKol = conn.QueryFirstOrDefault<kol>("select * from kol where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
|
||
//newKol.kol_uid = kol_uid;
|
||
newKol.kol_name = kol_name;
|
||
newKol.kol_descript = kol_descript;
|
||
newKol.kol_photo = kol_photo;
|
||
newKol.kol_contact1 = kol_contact1;
|
||
newKol.kol_contact2 = kol_contact2;
|
||
newKol.kol_men_ratio = kol_men_ratio;
|
||
newKol.kol_women_ratio = kol_women_ratio;
|
||
newKol.kol_13_17 = kol_13_17;
|
||
newKol.kol_18_24 = kol_18_24;
|
||
newKol.kol_25_34 = kol_25_34;
|
||
newKol.kol_35_44 = kol_35_44;
|
||
newKol.kol_45_54 = kol_45_54;
|
||
newKol.kol_55_64 = kol_55_64;
|
||
newKol.kol_65 = kol_65;
|
||
newKol.kol_modifydate = DateTime.Now;
|
||
newKol.kol_modify_userId = token.user_id;
|
||
|
||
string[] kolMakeupArr = kolMakeupStr.Split(',');
|
||
|
||
List<kolMakeup> kolMakeups = new List<kolMakeup>();
|
||
foreach (string makeup in kolMakeupArr)
|
||
{
|
||
optionItem item = conn.QueryFirstOrDefault<optionItem>("select * from optionItem where optionItem_ishide = 'N' and optionItem_uid = @optionItem_uid", new { optionItem_uid = makeup });
|
||
|
||
if (item != null)
|
||
{
|
||
kolMakeup makeupObj = new kolMakeup();
|
||
makeupObj.kolMakeup_uid = "kmk_" + GlobalClass.CreateRandomCode(12);
|
||
makeupObj.kol_uid = kol_uid;
|
||
makeupObj.option_uid = item.option_uid;
|
||
makeupObj.optionItem_uid = item.optionItem_uid;
|
||
kolMakeups.Add(makeupObj);
|
||
}
|
||
}
|
||
|
||
string[] kolStyleArr = kolStyleStr.Split(",");
|
||
|
||
List<kolStyle> kolStyles = new List<kolStyle>();
|
||
foreach (string style in kolStyleArr)
|
||
{
|
||
optionItem item = conn.QueryFirstOrDefault<optionItem>("select * from optionItem where optionItem_ishide = 'N' and optionItem_uid = @optionItem_uid", new { optionItem_uid = style });
|
||
|
||
if (item != null)
|
||
{
|
||
kolStyle styleObj = new kolStyle();
|
||
styleObj.kolStyle_uid = "ks_" + GlobalClass.CreateRandomCode(12);
|
||
styleObj.kol_uid = kol_uid;
|
||
styleObj.option_uid = item.option_uid;
|
||
styleObj.optionItem_uid = item.optionItem_uid;
|
||
kolStyles.Add(styleObj);
|
||
}
|
||
|
||
}
|
||
|
||
string[] kolFansTypeArr = kolFansTypeStr.Split(",");
|
||
|
||
List<kolFansType> kolFansTypes = new List<kolFansType>();
|
||
foreach (string fansType in kolFansTypeArr)
|
||
{
|
||
optionItem item = conn.QueryFirstOrDefault<optionItem>("select * from optionItem where optionItem_ishide = 'N' and optionItem_uid = @optionItem_uid", new { optionItem_uid = fansType });
|
||
|
||
if (item != null)
|
||
{
|
||
kolFansType fansObj = new kolFansType();
|
||
fansObj.kolFansType_uid = "kft_" + GlobalClass.CreateRandomCode(12);
|
||
fansObj.kol_uid = kol_uid;
|
||
fansObj.option_uid = item.option_uid;
|
||
fansObj.optionItem_uid = item.optionItem_uid;
|
||
kolFansTypes.Add(fansObj);
|
||
}
|
||
}
|
||
|
||
string[] kolTagArr = kolTagsStr.Split(",");
|
||
List<kolTag> kolTags = new List<kolTag>();
|
||
foreach (string tag in kolTagArr) {
|
||
tags tagData = conn.QueryFirstOrDefault<tags>("select * from tags where tag_uid = @tag_uid", new { tag_uid = tag });
|
||
|
||
if (tagData != null) {
|
||
kolTag newKolTag = new kolTag();
|
||
newKolTag.kolTag_uid = "kt_" + GlobalClass.CreateRandomCode(12);
|
||
newKolTag.kol_uid = kol_uid;
|
||
newKolTag.tag_uid = tag;
|
||
kolTags.Add(newKolTag);
|
||
}
|
||
}
|
||
|
||
dynamic mediaJsonObj;
|
||
|
||
try
|
||
{
|
||
mediaJsonObj = JsonConvert.DeserializeObject(mediaArrayJson);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "media json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolMedia> medias = new List<kolMedia>();
|
||
|
||
foreach (dynamic item in mediaJsonObj)
|
||
{
|
||
kolMedia mediaObj = new kolMedia();
|
||
|
||
mediaObj.kolMedia_uid = "km_" + GlobalClass.CreateRandomCode(12);
|
||
mediaObj.kol_uid = kol_uid;
|
||
mediaObj.option_uid = item.option_uid;
|
||
mediaObj.optionItem_uid = item.optionItem_uid;
|
||
mediaObj.kolMedia_fansNum = int.Parse(item.kolMedia_fansNum.ToString());
|
||
mediaObj.kolMedia_accountName = item.kolMedia_accountName;
|
||
mediaObj.kolMedia_displayName = item.kolMedia_displayName;
|
||
mediaObj.kolMedia_url = item.kolMedia_url;
|
||
|
||
medias.Add(mediaObj);
|
||
}
|
||
|
||
conn.Execute("delete kolMakeup where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolStyle where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolFansType where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolMedia where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
conn.Execute("delete kolTag where kol_uid = @kol_uid", new { kol_uid = kol_uid });
|
||
|
||
conn.Insert(kolMakeups);
|
||
conn.Insert(kolStyles);
|
||
conn.Insert(kolFansTypes);
|
||
conn.Insert(medias);
|
||
conn.Insert(kolTags);
|
||
|
||
try
|
||
{
|
||
conn.Update(newKol);
|
||
conn.Close();
|
||
|
||
ret.kol = new kolDetial(kol_uid);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "1001";
|
||
ret.message = ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
if (method == "add") {
|
||
string err_msg = "";
|
||
|
||
if (kol_name == "") {
|
||
err_msg = "請輸入KOL頻道名稱!\n";
|
||
}
|
||
|
||
if (kol_photo == "") {
|
||
err_msg += "請選擇KOL的照片!\n";
|
||
}
|
||
|
||
if (err_msg != "") {
|
||
ret.ret = "no";
|
||
ret.err_code = "0002";
|
||
ret.message = err_msg;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
kol newKol = new kol();
|
||
|
||
kol_uid = "kol_" + GlobalClass.CreateRandomCode(12);
|
||
|
||
newKol.kol_uid = kol_uid;
|
||
newKol.kol_name = kol_name;
|
||
newKol.kol_descript = kol_descript;
|
||
newKol.kol_photo = kol_photo;
|
||
newKol.kol_contact1 = kol_contact1;
|
||
newKol.kol_contact2 = kol_contact2;
|
||
newKol.kol_men_ratio = kol_men_ratio;
|
||
newKol.kol_women_ratio = kol_women_ratio;
|
||
newKol.kol_13_17 = kol_13_17;
|
||
newKol.kol_18_24 = kol_18_24;
|
||
newKol.kol_25_34 = kol_25_34;
|
||
newKol.kol_35_44 = kol_35_44;
|
||
newKol.kol_45_54 = kol_45_54;
|
||
newKol.kol_55_64 = kol_55_64;
|
||
newKol.kol_65 = kol_65;
|
||
newKol.kol_create_userId = token.user_id;
|
||
newKol.kol_modify_userId = token.user_id;
|
||
|
||
string[] kolMakeupArr = kolMakeupStr.Split(',');
|
||
|
||
List<kolMakeup> kolMakeups = new List<kolMakeup>();
|
||
foreach (string makeup in kolMakeupArr)
|
||
{
|
||
optionItem item = conn.QueryFirstOrDefault<optionItem>("select * from optionItem where optionItem_ishide = 'N' and optionItem_uid = @optionItem_uid", new { optionItem_uid = makeup });
|
||
|
||
if (item != null)
|
||
{
|
||
kolMakeup makeupObj = new kolMakeup();
|
||
makeupObj.kolMakeup_uid = "kmk_" + GlobalClass.CreateRandomCode(12);
|
||
makeupObj.kol_uid = kol_uid;
|
||
makeupObj.option_uid = item.option_uid;
|
||
makeupObj.optionItem_uid = item.optionItem_uid;
|
||
kolMakeups.Add(makeupObj);
|
||
}
|
||
}
|
||
|
||
string[] kolStyleArr = kolStyleStr.Split(",");
|
||
|
||
List<kolStyle> kolStyles = new List<kolStyle>();
|
||
foreach (string style in kolStyleArr)
|
||
{
|
||
optionItem item = conn.QueryFirstOrDefault<optionItem>("select * from optionItem where optionItem_ishide = 'N' and optionItem_uid = @optionItem_uid", new { optionItem_uid = style });
|
||
|
||
if (item != null)
|
||
{
|
||
kolStyle styleObj = new kolStyle();
|
||
styleObj.kolStyle_uid = "ks_" + GlobalClass.CreateRandomCode(12);
|
||
styleObj.kol_uid = kol_uid;
|
||
styleObj.option_uid = item.option_uid;
|
||
styleObj.optionItem_uid = item.optionItem_uid;
|
||
kolStyles.Add(styleObj);
|
||
}
|
||
|
||
}
|
||
|
||
string[] kolFansTypeArr = kolFansTypeStr.Split(",");
|
||
|
||
List<kolFansType> kolFansTypes = new List<kolFansType>();
|
||
foreach (string fansType in kolFansTypeArr)
|
||
{
|
||
optionItem item = conn.QueryFirstOrDefault<optionItem>("select * from optionItem where optionItem_ishide = 'N' and optionItem_uid = @optionItem_uid", new { optionItem_uid = fansType });
|
||
|
||
if (item != null)
|
||
{
|
||
kolFansType fansObj = new kolFansType();
|
||
fansObj.kolFansType_uid = "kft_" + GlobalClass.CreateRandomCode(12);
|
||
fansObj.kol_uid = kol_uid;
|
||
fansObj.option_uid = item.option_uid;
|
||
fansObj.optionItem_uid = item.optionItem_uid;
|
||
kolFansTypes.Add(fansObj);
|
||
}
|
||
}
|
||
|
||
string[] kolTagArr = kolTagsStr.Split(",");
|
||
List<kolTag> kolTags = new List<kolTag>();
|
||
foreach (string tag in kolTagArr)
|
||
{
|
||
tags tagData = conn.QueryFirstOrDefault<tags>("select * from tags where tag_uid = @tag_uid", new { tag_uid = tag });
|
||
|
||
if (tagData != null)
|
||
{
|
||
kolTag newKolTag = new kolTag();
|
||
newKolTag.kolTag_uid = "kt_" + GlobalClass.CreateRandomCode(12);
|
||
newKolTag.kol_uid = kol_uid;
|
||
newKolTag.tag_uid = tag;
|
||
kolTags.Add(newKolTag);
|
||
}
|
||
}
|
||
|
||
dynamic mediaJsonObj;
|
||
|
||
try {
|
||
mediaJsonObj = JsonConvert.DeserializeObject(mediaArrayJson);
|
||
} catch (Exception ex)
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "0003";
|
||
ret.message = "media json error" + ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
List<kolMedia> medias = new List<kolMedia>();
|
||
|
||
foreach (dynamic item in mediaJsonObj) {
|
||
kolMedia mediaObj = new kolMedia();
|
||
|
||
mediaObj.kolMedia_uid = "km_" + GlobalClass.CreateRandomCode(12);
|
||
mediaObj.kol_uid = kol_uid;
|
||
mediaObj.option_uid = item.option_uid;
|
||
mediaObj.optionItem_uid = item.optionItem_uid;
|
||
mediaObj.kolMedia_fansNum = int.Parse(item.kolMedia_fansNum.ToString());
|
||
mediaObj.kolMedia_accountName = item.kolMedia_accountName;
|
||
mediaObj.kolMedia_displayName = item.kolMedia_displayName;
|
||
mediaObj.kolMedia_url = item.kolMedia_url;
|
||
|
||
medias.Add(mediaObj);
|
||
}
|
||
|
||
conn.Insert(kolMakeups);
|
||
conn.Insert(kolStyles);
|
||
conn.Insert(kolFansTypes);
|
||
conn.Insert(medias);
|
||
conn.Insert(kolTags);
|
||
|
||
try
|
||
{
|
||
conn.Insert(newKol);
|
||
conn.Close();
|
||
|
||
ret.kol = new kolDetial(kol_uid);
|
||
}
|
||
catch (Exception ex) {
|
||
ret.ret = "no";
|
||
ret.err_code = "1001";
|
||
ret.message = ex.Message;
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
[Route("kolPhotoUpload")]
|
||
[RequestFormLimits(MultipartBodyLengthLimit = int.MaxValue)]
|
||
[RequestSizeLimit(int.MaxValue)]
|
||
public ActionResult KolPhotoUpload([FromForm(Name = "avatar")] IFormFile file) {
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
List<errFile> files = new List<errFile>();
|
||
|
||
errFile newFile = new errFile();
|
||
newFile.name = "";
|
||
newFile.size = 0;
|
||
newFile.error = "尚未登入";
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
return Content(JsonConvert.SerializeObject(files), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
string originFileName = file.FileName;
|
||
string newFileName = "avatar_" + GlobalClass.CreateRandomCode(8) + Path.GetExtension(originFileName);
|
||
string fullPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images/avatar/" + newFileName);
|
||
try
|
||
{
|
||
using (var stream = new FileStream(fullPath, FileMode.Create)) {
|
||
file.CopyTo(stream);
|
||
}
|
||
|
||
List<uploadFile> files = new List<uploadFile>();
|
||
|
||
uploadFile newFile = new uploadFile();
|
||
|
||
newFile.name = originFileName;
|
||
newFile.url = "/images/avatar/" + newFileName;
|
||
newFile.size = file.Length;
|
||
newFile.thumbnailUrl = "/images/avatar/" + newFileName;
|
||
newFile.deleteUrl = "/images/avatar/" + newFileName;
|
||
|
||
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
|
||
|
||
|
||
|
||
return Content(JsonConvert.SerializeObject(obj), "application/json;charset=utf-8");
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
List<errFile> files = new List<errFile>();
|
||
|
||
errFile newFile = new errFile();
|
||
newFile.name = originFileName;
|
||
newFile.size = file.Length;
|
||
newFile.error = ex.Message;
|
||
|
||
files.Add(newFile);
|
||
|
||
fileResult obj = new fileResult();
|
||
|
||
obj.files = files;
|
||
|
||
return Content(JsonConvert.SerializeObject(files), "application/json;charset=utf-8");
|
||
}
|
||
}
|
||
|
||
[Route("optionItemList")]
|
||
public ActionResult OptionItemList(IFormCollection obj)
|
||
{
|
||
optionListResult ret = new optionListResult();
|
||
|
||
authToken token = new authToken(this._httpContextAccessor);
|
||
if (token.user_isLogin == false)
|
||
{
|
||
HttpContext.Response.Cookies.Delete("token_key");
|
||
ret.ret = "no";
|
||
ret.err_code = "99999";
|
||
ret.message = "非登入狀態!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
|
||
string option_uid = obj["option_uid"].ToString();
|
||
|
||
if (option_uid == "")
|
||
{
|
||
ret.ret = "no";
|
||
ret.err_code = "00001";
|
||
ret.message = "無option_uid資料!";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
ret.optionItems = conn.Query<optionItem>("select * from optionItem where optionItem_ishide = 'N' and option_uid = @option_uid order by optionItem_order ", new { option_uid = option_uid }).ToList();
|
||
ret.ret = "yes";
|
||
return Content(JsonConvert.SerializeObject(ret), "application/json;charset=utf-8");
|
||
}
|
||
|
||
|
||
}
|
||
|
||
public class igDataResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<instagramDetail> list = new List<instagramDetail>();
|
||
}
|
||
|
||
public class igRankListResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<instagramKolView> list { get; set; } = new List<instagramKolView>();
|
||
}
|
||
|
||
public class facebookDataResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
public List<facebookDetail> list = new List<facebookDetail>();
|
||
}
|
||
public class fbRankListResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<facebookKolView> list { get; set; } = new List<facebookKolView>();
|
||
}
|
||
|
||
public class fbUpdateListResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<fbClass> list { get; set; } = new List<fbClass>();
|
||
}
|
||
|
||
public class fbClass
|
||
{
|
||
public string kol_uid { get; set; } = "";
|
||
public string kolMedia_uid { get; set; } = "";
|
||
public string optionItem_uid { get; set; } = "";
|
||
public string kolMedia_url { get; set; } = "";
|
||
public string kolMedia_accountName { get; set; } = "";
|
||
|
||
}
|
||
|
||
public class youtubeDataResult
|
||
{
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
public youtubeDetailClass data = new youtubeDetailClass();
|
||
}
|
||
public class youtubeListResult
|
||
{
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<youtubeDetailClass> youtubeList = new List<youtubeDetailClass>();
|
||
}
|
||
public class projectKolViewResult
|
||
{
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
public projectKolView detail { get; set; } = new projectKolView();
|
||
}
|
||
public class kolProjectViewResult
|
||
{
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
public List<kolProjectViewDetail> detail { get; set; } = new List<kolProjectViewDetail>();
|
||
}
|
||
public class kolProjectListResult
|
||
{
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<kolProjectDetail> datas { get; set; } = new List<kolProjectDetail>();
|
||
}
|
||
public class kolProjectResult
|
||
{
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public kolProjectDetail data { get; set; } = new kolProjectDetail();
|
||
}
|
||
|
||
public class mediaSpecListResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<mediaItem> mediaSpecList = new List<mediaItem>();
|
||
}
|
||
|
||
public class updatTagResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public optionData data = new optionData();
|
||
}
|
||
public class tagListResult {
|
||
public List<optionData> data = new List<optionData>();
|
||
}
|
||
public class prmFileResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public string hasFile { get; set; } = "N";
|
||
public string fileName { get; set; } = "";
|
||
public string fileUrl { get; set; } = "";
|
||
|
||
}
|
||
public class prmResult {
|
||
public List<optionData> data = new List<optionData>();
|
||
}
|
||
|
||
public class optionData {
|
||
public string id { get; set; } = "";
|
||
public string text { get; set; } = "";
|
||
}
|
||
|
||
public class projectResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public project data { get; set; } = new project();
|
||
}
|
||
|
||
public class projectListResult {
|
||
public string ret { get; set; } = "no";
|
||
public string err_code { get; set; } = "0000";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<projectDetail> projectList { get; set; } = new List<projectDetail>();
|
||
}
|
||
|
||
public class kolListResult {
|
||
public string ret { get; set; } = "";
|
||
public string err_code { get; set; } = "";
|
||
public string message { get; set; } = "";
|
||
|
||
public List<kolDetial> kolList { get; set; } = new List<kolDetial>();
|
||
}
|
||
public class kolResult {
|
||
public string ret { get; set; } = "";
|
||
public string err_code { get; set; } = "";
|
||
public string message { get; set; } = "";
|
||
public kolDetial kol { get; set; } = new kolDetial();
|
||
|
||
}
|
||
|
||
public class fileResult {
|
||
public object files = new object();
|
||
}
|
||
|
||
public class uploadFile {
|
||
public string name { get; set; } = "";
|
||
public long size { get; set; } = 0;
|
||
public string url { get; set; } = "";
|
||
|
||
public string uid { get; set; } = "";
|
||
public string thumbnailUrl { get; set; } = "";
|
||
public string deleteUrl { get; set; } = "";
|
||
public string deleteType { get; set; } = "DELETE";
|
||
}
|
||
|
||
public class errFile {
|
||
public string name { get; set; } = "";
|
||
public long size { get; set; } = 0;
|
||
public string error { get; set; } = "";
|
||
}
|
||
|
||
public class normalResult {
|
||
public string ret { get; set; } = "";
|
||
public string err_code { get; set; } = "";
|
||
public string message { get; set; } = "";
|
||
}
|
||
}
|
||
|