From 8ac38e88c5d1061ae7404a4e82aed9b2f0f69a3c Mon Sep 17 00:00:00 2001 From: liaoxujun@qq.com <liaoxujun@qq.com> Date: 星期三, 27 三月 2024 17:28:36 +0800 Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/baifenbaishop --- CoreCms.Net.Web.Admin/Controllers/Distribution/CoreCmsDistributionController.cs | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 100 insertions(+), 7 deletions(-) diff --git a/CoreCms.Net.Web.Admin/Controllers/Distribution/CoreCmsDistributionController.cs b/CoreCms.Net.Web.Admin/Controllers/Distribution/CoreCmsDistributionController.cs index 2f1cbcf..0e6a477 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 鑾峰彇鍒楄〃============================================================ @@ -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); + + } + } } -- Gitblit v1.9.1