From d871b3c107c72c015b9bd6aaffd81878747f478b Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 12 四月 2024 08:39:03 +0800 Subject: [PATCH] 经销商推广费用, 用户积分 --- CoreCms.Net.Web.Admin/Controllers/Distribution/CoreCmsDistributionController.cs | 143 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 135 insertions(+), 8 deletions(-) diff --git a/CoreCms.Net.Web.Admin/Controllers/Distribution/CoreCmsDistributionController.cs b/CoreCms.Net.Web.Admin/Controllers/Distribution/CoreCmsDistributionController.cs index 2f1cbcf..d9d042f 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Distribution/CoreCmsDistributionController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Distribution/CoreCmsDistributionController.cs @@ -1,7 +1,7 @@ /*********************************************************************** - * Project: CoreCms + * Project: baifenBinfa * ProjectName: 鐧惧垎鍏垫硶绠$悊绯荤粺 - * Web: hhtp://chuanyin.com + * Web: http://chuanyin.com * Author: * Email: * CreateTime: 202403/02 @@ -9,6 +9,7 @@ ***********************************************************************/ using System; +using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Linq.Expressions; @@ -31,6 +32,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis.Operations; using SqlSugar; +using ZstdSharp.Unsafe; namespace CoreCms.Net.Web.Admin.Controllers { @@ -52,6 +54,8 @@ private readonly ICoreCmsAreaServices _areaServices; private readonly ICoreCmsSettingServices _coreCmsSettingServices; private readonly IUnitOfWork _unitOfWork; + private readonly ICoreCmsStoreServices _coreCmsStoreServices; + private readonly ICoreCmsClerkServices _coreCmsClerkServices; /// <summary> @@ -64,7 +68,9 @@ ICoreCmsUserServices userServices, ICoreCmsAreaServices areaServices, ICoreCmsSettingServices coreCmsSettingServices, - IUnitOfWork unitOfWork) + IUnitOfWork unitOfWork, + ICoreCmsStoreServices coreCmsStoreServices, + ICoreCmsClerkServices coreCmsClerkServices) { _webHostEnvironment = webHostEnvironment; _coreCmsDistributionServices = coreCmsDistributionServices; @@ -74,6 +80,9 @@ _areaServices = areaServices; _coreCmsSettingServices = coreCmsSettingServices; _unitOfWork = unitOfWork; + _coreCmsStoreServices = coreCmsStoreServices; + _coreCmsClerkServices= coreCmsClerkServices; + } #region 鑾峰彇鍒楄〃============================================================ @@ -133,7 +142,7 @@ //缁忛攢鍟嗗悕绉� nvarchar var name = Request.Form["name"].FirstOrDefault(); if (!string.IsNullOrEmpty(name)) where = where.And(p => p.name.Contains(name)); - //鍒嗛攢绛夌骇 int + //缁忛攢绛夌骇 int var gradeId = Request.Form["gradeId"].FirstOrDefault().ObjectToInt(0); if (gradeId > 0) where = where.And(p => p.gradeId == gradeId); //鐢ㄦ埛绛夌骇 int @@ -405,20 +414,24 @@ oldModel.name = entity.name; oldModel.gradeId = entity.gradeId; oldModel.mobile = entity.mobile; - oldModel.weixin = entity.weixin; - oldModel.qq = entity.qq; + //oldModel.weixin = entity.weixin; + //oldModel.qq = entity.qq; try { _unitOfWork.BeginTran(); if (oldModel.verifyStatus != (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes && entity.verifyStatus == (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes) { + + //鑰佹ā鍨嬫湭閫氳繃瀹℃牳锛屾柊妯″瀷鏈�氳繃瀹℃牳锛岄偅涔堜负瀹℃牳閫氳繃杩囩▼ var allConfigs = await _coreCmsSettingServices.GetConfigDictionaries(); var kc = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.DictionaryUserGroupKey); + var olduser = await _userServices.QueryByIdAsync(oldModel.userId); var group = await _userGradeServices.GetUserGradeByValueKey(kc); if (group != null) { - var olduser = await _userServices.QueryByIdAsync(oldModel.userId); + + //鍏宠仈缁忛攢鍟嗙敤鎴风瓑绾� if (olduser != null) { olduser.grade = group.id; @@ -430,6 +443,74 @@ //濡傛灉鏄�氳繃瀹℃牳 oldModel.verifyTime = DateTime.Now; + //澶勭悊搴楅摵 + if(entity.profession=="鏂囧叿搴�") + { + + //鏂板缓搴楅摵鍚嶇О + + var store = await _coreCmsStoreServices.QueryByClauseAsync(x => x.userID == oldModel.userId); + if(store!=null) + { + //瀛樺湪搴楅摵 + store.coordinate= entity.storeCoordinate; + store.storeName = entity.storeName; + //鐢╨ogo浠f浛闂ㄥご鐓х墖 + store.logoImage = entity.storeLogo; + store.en = true; + store.updateTime = DateTime.Now; + await _coreCmsStoreServices.UpdateAsync(store); + + + } + else + { + var areaCode = oldModel.areaCode.Split(',').OrderByDescending(x=>x).FirstOrDefault(); + var db = _unitOfWork.GetDbClient(); + string[] lat = []; + if (!string.IsNullOrEmpty(oldModel.storeCoordinate)) + lat = oldModel.storeCoordinate.Split(","); + //鏂板缓鍦伴摵 + store = new CoreCmsStore + { + userID = oldModel.userId, + address = oldModel.address, + areaId = areaCode.ToInt32OrDefault(510000), + storeName = oldModel.storeName, + coordinate = oldModel.storeCoordinate, + createTime = DateTime.Now, + mobile = oldModel.mobile, + linkMan = olduser.userName, + + + + }; + if(lat.Length==2) + { + store.latitude= lat[0]; + store.longitude= lat[1]; + } + var id= await _unitOfWork.GetDbClient().Insertable(store).ExecuteReturnIdentityAsync(); + + //灏嗚嚜宸辫缃负搴楀憳 + CoreCmsClerk clerk = new CoreCmsClerk() + { + createTime = DateTime.Now, + storeId = id, + userId = entity.userId, + + }; + await _coreCmsClerkServices.InsertAsync(clerk); + + + + + } + + } + + + } else if (oldModel.verifyStatus == (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes && entity.verifyStatus != (int)GlobalEnumVars.DistributionVerifyStatus.VerifyYes) @@ -444,7 +525,7 @@ { var olduser = await _userServices.QueryByIdAsync(oldModel.userId); if (olduser != null) - { + {//澶勭悊鐢ㄦ埛绛夌骇 if (olduser.grade == group.id) { if (defgroup != null) @@ -462,6 +543,18 @@ } } + var store = await _coreCmsStoreServices.QueryByClauseAsync(x => x.userID == oldModel.userId); + //澶勭悊搴楅摵 鍙栨秷宸叉湁搴楅摵鐨勪娇鑳� + if(store != null ) + if(store.en== true) + { + store.en = false; + store.updateTime= DateTime.Now; + + await _coreCmsStoreServices.UpdateAsync(store); + + } + } } @@ -587,5 +680,39 @@ } #endregion + + + #region 棰勮鏁版嵁============================================================ + + // POST: Api/CoreCmsDistribution/GetDetailsAchievement/10 + /// <summary> + /// 棰勮鏁版嵁 + /// </summary> + /// <param name="entity"></param> + /// <returns></returns> + [HttpPost] + [Description("棰勮鏁版嵁")] + public async Task<AdminUiCallBack> GetDetailsAchievement([FromBody] FMIntId entity) + { + var jm = new AdminUiCallBack(); + + var model = await _coreCmsDistributionServices.QueryByIdAsync(entity.id); + if (model == null) + { + jm.msg = "涓嶅瓨鍦ㄦ淇℃伅"; + return jm; + } + var distributionRankingDTOs = _coreCmsDistributionServices.QueryAchievement(model.userId); + + + + + jm.code = 0; + jm.data = distributionRankingDTOs; + + return jm; + } + + #endregion } } \ No newline at end of file -- Gitblit v1.9.1