예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tableName">发送表名对应的提示模块</param>
        /// <param name="audit">默认为发送通知消息给管理员审核,6,7为审核通过/未通过</param>
        /// <param name="phoneNo">是否指定电话发送消息</param>
        /// <returns></returns>
        public static (bool, string) SendAliAuditSTK(string tableName, AuditType audit = AuditType.Notice, string phoneNo = null)
        {
            //获取所有审核权限的人发送APP消息通知
            string        msg  = null;
            List <string> list = new List <string>();

            Enum.TryParse(tableName, out AuditType auditType);
            switch (auditType)
            {
            case AuditType.App_Question:
                msg = "提问";
                break;

            case AuditType.App_Expert:
                msg = "专家申请认证";
                break;

            case AuditType.App_ReportPrice:
                msg = "上报肉牛价格";
                break;
            }
            if (string.IsNullOrEmpty(phoneNo))
            {
                list = DBServerProvider.GetSqlDapper().QueryList <string>($"SELECT PhoneNo FROM [vAuditUser] WHERE TableName='{tableName}'", null).Where(x => x.IsPhoneNo()).ToList();
                if (list.Count == 0)
                {
                    return(false, "没有分配审核帐号");
                }
            }
            else
            {
                list.Add(phoneNo);
            }

            return(SendAliSTK(new Dictionary <string, object>()
            {
                { "PhoneNo", string.Join(',', list) },
                { "PINType", (int)audit }, //模板类型5,审核给管理员通知,6提示审核通过,7,审核失败
                { "Msg", msg }
            }));
        }
예제 #2
0
        public async Task <IViewComponentResult> InvokeAsync(string dropDownIds)
        {
            if (string.IsNullOrEmpty(dropDownIds))
            {
                return(null);
            }

            string[]      dicNos        = dropDownIds.Split(',');
            StringBuilder stringBuilder = new StringBuilder();
            VOLContext    context       = DBServerProvider.GetEFDbContext();
            var           dicData       = await(from d in context.Set <Sys_Dictionary>()
                                                join list in context.Set <Sys_DictionaryList>()
                                                on d.Dic_ID equals list.Dic_ID
                                                into t
                                                from list in t.DefaultIfEmpty()
                                                where dicNos.Contains(d.DicNo)
                                                select new { list.DicValue, list.DicName, d.Config, d.DbSql, list.OrderNo, d.DicNo }).ToListAsync();

            foreach (var item in dicData.GroupBy(x => x.DicNo))
            {
                stringBuilder.AppendLine($" var optionConfig{item.Key} = {item.Select(x => x.Config).FirstOrDefault()}");

                string dbSql = item.Select(s => s.DbSql).FirstOrDefault();

                stringBuilder.AppendLine($@" var dataSource{item.Key} = {
                    (!string.IsNullOrEmpty(dbSql)
                    ? DBServerProvider.GetSqlDapper().QueryList<object>(dbSql, null).Serialize()
                    : item.OrderByDescending(o => o.OrderNo).
                            Select(s => new { s.DicName, s.DicValue }).ToList()
                            .Serialize())
                     }.convertToValueText(optionConfig{item.Key})");
                stringBuilder.AppendLine($" optionConfig{item.Key}.data = dataSource{item.Key};");
            }
            ViewBag.Dic = stringBuilder.ToString();
            return(View("~/Views/Shared/Dictionary.cshtml"));
        }