Sfoglia il codice sorgente

Merge branch 'master' of http://192.168.1.222:3000/zhengbingbing/NewCallCenter5.1_API

zhengbingbing 8 anni fa
parent
commit
6203e1d454

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

170
                     HttpPostedFile _upFile = RequestString.GetFile("upFile");
170
                     HttpPostedFile _upFile = RequestString.GetFile("upFile");
171
                     if (_upFile != null)
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
                         string datename = DateTime.Now.ToString("yyyyMMddHHMMss");
186
                         string datename = DateTime.Now.ToString("yyyyMMddHHMMss");
174
                         string fullFileName = datename + "_" + _upFile.FileName;
187
                         string fullFileName = datename + "_" + _upFile.FileName;
175
                         string ffmpegLocation = Server.MapPath("~/");
188
                         string ffmpegLocation = Server.MapPath("~/");
176
                         string dirpath = Server.MapPath(this.Request.ApplicationPath + "\\auoupload");
189
                         string dirpath = Server.MapPath(this.Request.ApplicationPath + "\\auoupload");
177
-                        string temp_filename = "";
190
+                        //string dirpath = Configs.GetValue("saveloc");
178
                         if (!System.IO.Directory.Exists(dirpath))
191
                         if (!System.IO.Directory.Exists(dirpath))
179
                         {
192
                         {
180
                             System.IO.Directory.CreateDirectory(dirpath);
193
                             System.IO.Directory.CreateDirectory(dirpath);
181
                         }
194
                         }
182
                         string path = this.Request.ApplicationPath + "/auoupload/" + fullFileName;
195
                         string path = this.Request.ApplicationPath + "/auoupload/" + fullFileName;
196
+                        //string physicalpath = dirpath + fullFileName;
183
                         string physicalpath = Server.MapPath(path);
197
                         string physicalpath = Server.MapPath(path);
184
                         _upFile.SaveAs(physicalpath);
198
                         _upFile.SaveAs(physicalpath);
185
 
199
 
195
                             p.StartInfo.RedirectStandardError = true;
209
                             p.StartInfo.RedirectStandardError = true;
196
                             p.StartInfo.CreateNoWindow = true;
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
                             p.Start();
219
                             p.Start();
201
                             p.StandardInput.WriteLine("cd " + ffmpegLocation);
220
                             p.StandardInput.WriteLine("cd " + ffmpegLocation);
202
                             p.StandardInput.WriteLine(ffmpegLocation.Split('\\').First());
221
                             p.StandardInput.WriteLine(ffmpegLocation.Split('\\').First());
203
                             p.StandardInput.WriteLine("ffmpeg.exe");
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
                             p.StandardInput.WriteLine(changefile);
225
                             p.StandardInput.WriteLine(changefile);
206
                             Thread.Sleep(3000);
226
                             Thread.Sleep(3000);
207
                             p.StandardInput.WriteLine("exit");
227
                             p.StandardInput.WriteLine("exit");
219
                             upfile.ftpUserID = _acc;
239
                             upfile.ftpUserID = _acc;
220
                             upfile.ftpPassword = _pwd;
240
                             upfile.ftpPassword = _pwd;
221
                             FileInfo fi = new FileInfo(physicalpath);
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
                             if (uploadres == "上传成功!")
244
                             if (uploadres == "上传成功!")
224
                             {
245
                             {
225
                                 //写入日志
246
                                 //写入日志
240
                                     if (ua != null)
261
                                     if (ua != null)
241
                                         ucode = ua.F_UserCode;
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
                             #endregion
269
                             #endregion
246
                         }
270
                         }
247
                         #endregion
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
                     else
274
                     else
253
                         return Error("参数传入失败");
275
                         return Error("参数传入失败");