Example #1
0
        //unavailable:短信开关关闭。0:发送短信成功。其他:发送失败状态码。
        public string CF10113(DBMA1DataContext dbma1, string userSN, string phone, string content, int seqid, int priority, bool ifNeedPay)
        {
            //验证短信开关是否打开
            if (dbma1.A034s.First().switchStatus != true)
            {
                return("unavailable");
            }

            //发送短信
            string res = CF10109(phone, content, seqid, priority);

            //添加短信记录表
            T000 t000 = new T000();

            t000.smSN         = C101.FC10102("T000", 8, "T");
            t000.generateDate = DateTime.Now;
            t000.sendDate     = DateTime.Now;
            t000.ifSuc        = res == "0" ? true : false;
            dbma1.T000s.InsertOnSubmit(t000);

            //扣款
            if (ifNeedPay == true && res == "0")
            {
                decimal smFee = Convert.ToInt32(dbma1.A028s.First().shortMessageCost);
                C201.FC20154(dbma1, userSN, smFee, "短信发送", t000.smSN);
            }

            return("");
        }
Example #2
0
        //unavailable:短信开关关闭。balanceNotEnough:余额不足。0:发送短信成功。其他:发送失败状态码。
        public static string F001(DBMA1DataContext dbma1, string userSN, string phone, string content, int priority, bool ifNeedPay)
        {
            try
            {
                //验证短信开关是否打开
                if (dbma1.A034s.First().switchStatus != true)
                {
                    return("unavailable");
                }

                decimal smFee = Convert.ToDecimal(dbma1.A028s.First().shortMessageCost);

                //余额不足
                if (ifNeedPay == true)
                {
                    if (dbma1.F000s.Where(c => c.userSN == userSN).First().balance < smFee)
                    {
                        return("balanceNotEnough");
                    }
                }

                string smSN  = C101.FC10102("T000", 8, "T");
                int    seqid = Comm.C101.CF10112(smSN, 1, 8);

                //发送短信
                string res = SendSM(phone, content, seqid, priority);

                //添加短信记录表
                T000 t000 = new T000();
                t000.smSN         = smSN;
                t000.userSN       = userSN;
                t000.phoneNum     = phone;
                t000.smContent    = content;
                t000.generateDate = DateTime.Now;
                t000.sendDate     = DateTime.Now;
                t000.ifSuc        = res == "0" ? true : false;
                dbma1.T000s.InsertOnSubmit(t000);

                //扣款
                if (ifNeedPay == true && res == "0")
                {
                    C201.FC20154(dbma1, userSN, smFee, "短信发送", t000.smSN);
                }

                return(res);
            }
            catch (Exception ex)
            {
                return("");
            }
        }