Parcourir la Source

融合IVR控制器中

machenyang il y a 8 ans
Parent
commit
99098257dc

+ 30 - 8
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/IVRWordsController.cs

@@ -170,16 +170,30 @@ namespace CallCenterApi.Interface.Controllers
170 170
                     HttpPostedFile _upFile = RequestString.GetFile("upFile");
171 171
                     if (_upFile != null)
172 172
                     {
173
+                        //string datename = DateTime.Now.ToString("yyyyMMddHHMMss");
174
+                        //string fullFileName = datename + "_" + _upFile.FileName;
175
+                        //string ffmpegLocation = Server.MapPath("~/");
176
+                        //string dirpath = Server.MapPath(this.Request.ApplicationPath + "\\auoupload");
177
+                        //string temp_filename = "";
178
+                        //if (!System.IO.Directory.Exists(dirpath))
179
+                        //{
180
+                        //    System.IO.Directory.CreateDirectory(dirpath);
181
+                        //}
182
+                        //string path = this.Request.ApplicationPath + "/auoupload/" + fullFileName;
183
+                        //string physicalpath = Server.MapPath(path);
184
+                        //_upFile.SaveAs(physicalpath);
185
+
173 186
                         string datename = DateTime.Now.ToString("yyyyMMddHHMMss");
174 187
                         string fullFileName = datename + "_" + _upFile.FileName;
175 188
                         string ffmpegLocation = Server.MapPath("~/");
176 189
                         string dirpath = Server.MapPath(this.Request.ApplicationPath + "\\auoupload");
177
-                        string temp_filename = "";
190
+                        //string dirpath = Configs.GetValue("saveloc");
178 191
                         if (!System.IO.Directory.Exists(dirpath))
179 192
                         {
180 193
                             System.IO.Directory.CreateDirectory(dirpath);
181 194
                         }
182 195
                         string path = this.Request.ApplicationPath + "/auoupload/" + fullFileName;
196
+                        //string physicalpath = dirpath + fullFileName;
183 197
                         string physicalpath = Server.MapPath(path);
184 198
                         _upFile.SaveAs(physicalpath);
185 199
 
@@ -195,13 +209,19 @@ namespace CallCenterApi.Interface.Controllers
195 209
                             p.StartInfo.RedirectStandardError = true;
196 210
                             p.StartInfo.CreateNoWindow = true;
197 211
 
198
-                            temp_filename = physicalpath.Split('\\').Last().Split('.')[0] + "_temp";
212
+                            string temp_filename = physicalpath.Split('\\').Last().Split('.')[0] + "_temp";
213
+                            string savedir = Configs.GetValue("saveloc");
214
+                            if (!System.IO.Directory.Exists(savedir))
215
+                            {
216
+                                System.IO.Directory.CreateDirectory(savedir);
217
+                            }
199 218
 
200 219
                             p.Start();
201 220
                             p.StandardInput.WriteLine("cd " + ffmpegLocation);
202 221
                             p.StandardInput.WriteLine(ffmpegLocation.Split('\\').First());
203 222
                             p.StandardInput.WriteLine("ffmpeg.exe");
204
-                            string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + dirpath + "\\" + temp_filename + ".wav";
223
+                            //string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + dirpath + "\\" + temp_filename + ".wav";
224
+                            string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + savedir + "\\" + temp_filename + ".wav";
205 225
                             p.StandardInput.WriteLine(changefile);
206 226
                             Thread.Sleep(3000);
207 227
                             p.StandardInput.WriteLine("exit");
@@ -219,7 +239,8 @@ namespace CallCenterApi.Interface.Controllers
219 239
                             upfile.ftpUserID = _acc;
220 240
                             upfile.ftpPassword = _pwd;
221 241
                             FileInfo fi = new FileInfo(physicalpath);
222
-                            string uploadres = upfile.UploadLocalToFtp(dirpath + "\\" + temp_filename + ".wav");
242
+                            //string uploadres = upfile.UploadLocalToFtp(dirpath + "\\" + temp_filename + ".wav");
243
+                            string uploadres = upfile.UploadLocalToFtp(savedir + "\\" + temp_filename + ".wav");
223 244
                             if (uploadres == "上传成功!")
224 245
                             {
225 246
                                 //写入日志
@@ -240,14 +261,15 @@ namespace CallCenterApi.Interface.Controllers
240 261
                                     if (ua != null)
241 262
                                         ucode = ua.F_UserCode;
242 263
                                 }
243
-                                
264
+                                dModel.F_WavOldName = fullFileName;
265
+                                dModel.F_WavNewName = temp_filename + ".wav";
266
+                                //dModel.F_WavPath = dirpath + "\\" + temp_filename + ".wav";
267
+                                dModel.F_WavPath = savedir + "\\" + temp_filename + ".wav";
244 268
                             }
245 269
                             #endregion
246 270
                         }
247 271
                         #endregion
248
-                        dModel.F_WavOldName = fullFileName;
249
-                        dModel.F_WavNewName = temp_filename + ".wav";
250
-                        dModel.F_WavPath = dirpath + "\\" + temp_filename + ".wav";
272
+                        
251 273
                     }
252 274
                     else
253 275
                         return Error("参数传入失败");