Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
DataCenter_Core2.1_20190520
Commits
b1b5467d
Commit
b1b5467d
authored
Aug 26, 2019
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善速卖通广告费导入功能
parent
92e0d52b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
278 additions
and
38 deletions
+278
-38
dc_base_company_account.cs
Bailun.DC.Models/dc_base_company_account.cs
+145
-0
dc_base_finance_aliexpress.cs
Bailun.DC.Models/dc_base_finance_aliexpress.cs
+3
-0
CommonServices.cs
Bailun.DC.Services/CommonServices.cs
+25
-0
OrdersServices.cs
Bailun.DC.Services/OrdersServices.cs
+2
-2
OrdersController.cs
Bailun.DC.Web/Areas/Reports/Controllers/OrdersController.cs
+85
-19
AliexpressAD.cshtml
Bailun.DC.Web/Areas/Reports/Views/Orders/AliexpressAD.cshtml
+18
-17
No files found.
Bailun.DC.Models/dc_base_company_account.cs
0 → 100644
View file @
b1b5467d
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.Models
{
public
class
dc_base_company_account
{
/// <summary>
///
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
company_id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
account_id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
account_name
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
account_email
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
oms_code
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
oms_account
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
platform_id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
platform_cn
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
platform_en
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
site_id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
site_cn
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
site_en
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
auth_json
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
status
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
status_cn
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
soap_auth_token
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
soap_auth_status
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
auth_status
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
extension_info
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
developer_json
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
manager
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
seller_id
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
ebay_ad_auth_json
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
DateTime
bj_create
{
get
;
set
;
}
/// <summary>
/// on update CURRENT_TIMESTAMP
/// </summary>
public
DateTime
bj_modified
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
amazon_ad_auth_json
{
get
;
set
;
}
}
}
Bailun.DC.Models/dc_base_finance_aliexpress.cs
View file @
b1b5467d
...
...
@@ -14,6 +14,9 @@ namespace Bailun.DC.Models
/// </summary>
public
int
id
{
get
;
set
;
}
public
int
company_id
{
get
;
set
;
}
/// <summary>
/// 帐号id
/// </summary>
...
...
Bailun.DC.Services/CommonServices.cs
View file @
b1b5467d
...
...
@@ -266,6 +266,31 @@ namespace Bailun.DC.Services
}
}
/// <summary>
/// 根据账号名称获取账号信息
/// </summary>
/// <param name="accountname">账号名称</param>
/// <param name="companyid">公司id</param>
/// <returns></returns>
public
static
dc_base_company_account
GetCompanyAccount
(
string
accountname
,
int
companyid
)
{
var
sql
=
"select * from dc_base_company_account where account_name=@account_name and company_id="
+
companyid
;
var
sqlparam
=
new
DynamicParameters
();
sqlparam
.
Add
(
"account_name"
,
accountname
);
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
var
obj
=
cn
.
QueryFirstOrDefault
<
dc_base_company_account
>(
sql
,
sqlparam
,
null
,
2
*
60
);
return
obj
;
}
}
}
#
region
汇率实体
ExchangeRate
...
...
Bailun.DC.Services/OrdersServices.cs
View file @
b1b5467d
...
...
@@ -620,7 +620,7 @@ namespace Bailun.DC.Services
cn
.
Open
();
}
var
obj
=
cn
.
Page
<
Models
.
Orders
.
mAmazonStatistics
>(
parameter
.
pageIndex
,
parameter
.
limit
,
sql
,
ref
total
,
sqlparam
);
var
obj
=
cn
.
Page
<
Models
.
Orders
.
mAmazonStatistics
>(
parameter
.
pageIndex
,
parameter
.
limit
,
sql
,
ref
total
,
sqlparam
,
""
,
2
*
60
);
return
obj
.
AsList
();
}
...
...
@@ -695,7 +695,7 @@ namespace Bailun.DC.Services
cn
.
Open
();
}
var
obj
=
cn
.
QueryFirst
<
Models
.
Orders
.
mAmazonStatistics
>(
sql
,
sqlparam
);
var
obj
=
cn
.
QueryFirst
<
Models
.
Orders
.
mAmazonStatistics
>(
sql
,
sqlparam
,
null
,
2
*
60
);
return
obj
;
}
...
...
Bailun.DC.Web/Areas/Reports/Controllers/OrdersController.cs
View file @
b1b5467d
...
...
@@ -2364,7 +2364,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="currency">币种</param>
/// <returns></returns>
[
BailunAuthentication
(
LoginMode
.
Enforce
)]
public
string
AlipressADJson
(
BtTableParameter
parameter
,
DateTime
?
start
,
DateTime
?
end
,
string
account
,
string
currency
)
public
string
AlipressADJson
(
BtTableParameter
parameter
,
DateTime
?
start
,
DateTime
?
end
,
string
account
,
string
currency
=
"CNY"
)
{
var
total
=
0
;
var
companyid
=
HttpContextHelper
.
Current
?.
User
?.
GetCompanyId
().
ToInt32
();
...
...
@@ -2453,7 +2453,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return
File
(
ms
,
"text/csv"
,
filename
+
".csv"
);
}
public
JsonResult
ImportAliExpressAD
()
public
JsonResult
ImportAliExpressAD
(
int
?
companyid
)
{
if
(
Request
.
Form
.
Files
.
Count
==
0
)
{
...
...
@@ -2477,7 +2477,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
try
{
var
account_name
=
row
[
"
帐
号"
].
ToString
();
var
account_name
=
row
[
"
账
号"
].
ToString
();
var
product_id
=
row
[
"商品ID"
].
ToString
();
var
product_name
=
row
[
"商品名称"
].
ToString
();
var
exposure
=
row
[
"曝光量"
].
ToString
();
...
...
@@ -2493,7 +2493,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var
currency
=
row
[
"币种"
].
ToString
();
var
recore_time
=
row
[
"统计日期"
].
ToString
();
if
(
!
string
.
IsNullOrEmpty
(
account_name
))
if
(
string
.
IsNullOrEmpty
(
account_name
))
{
return
Json
(
new
{
...
...
@@ -2501,7 +2501,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行帐号不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
product_id
))
if
(
string
.
IsNullOrEmpty
(
product_id
))
{
return
Json
(
new
{
...
...
@@ -2509,7 +2509,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行商品id不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
product_name
))
if
(
string
.
IsNullOrEmpty
(
product_name
))
{
return
Json
(
new
{
...
...
@@ -2517,7 +2517,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行商品名称不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
exposure
))
if
(
string
.
IsNullOrEmpty
(
exposure
))
{
return
Json
(
new
{
...
...
@@ -2525,7 +2525,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行曝光量不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
clickcount
))
if
(
string
.
IsNullOrEmpty
(
clickcount
))
{
return
Json
(
new
{
...
...
@@ -2533,7 +2533,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行点击量不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
clickrate
))
if
(
string
.
IsNullOrEmpty
(
clickrate
))
{
return
Json
(
new
{
...
...
@@ -2541,7 +2541,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行点击率不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
cost_fee
))
if
(
string
.
IsNullOrEmpty
(
cost_fee
))
{
return
Json
(
new
{
...
...
@@ -2549,7 +2549,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行花费不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
avg_click_cost
))
if
(
string
.
IsNullOrEmpty
(
avg_click_cost
))
{
return
Json
(
new
{
...
...
@@ -2560,7 +2560,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
if
(
!
string
.
IsNullOrEmpty
(
p4p_ordercount
))
if
(
string
.
IsNullOrEmpty
(
p4p_ordercount
))
{
return
Json
(
new
{
...
...
@@ -2568,7 +2568,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行P4P下单数不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
p4p_orderamount
))
if
(
string
.
IsNullOrEmpty
(
p4p_orderamount
))
{
return
Json
(
new
{
...
...
@@ -2576,7 +2576,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行P4P下单金额不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
p4p_shoppingcart_count
))
if
(
string
.
IsNullOrEmpty
(
p4p_shoppingcart_count
))
{
return
Json
(
new
{
...
...
@@ -2584,7 +2584,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行P4P带来的购物车数不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
p4p_collect_count
))
if
(
string
.
IsNullOrEmpty
(
p4p_collect_count
))
{
return
Json
(
new
{
...
...
@@ -2592,7 +2592,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行P4P带来的收藏数不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
currency
))
if
(
string
.
IsNullOrEmpty
(
currency
))
{
return
Json
(
new
{
...
...
@@ -2600,7 +2600,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg
=
$"导入失败,第
{(
i
+
1
)}
行币种不能为空!"
});
}
if
(
!
string
.
IsNullOrEmpty
(
recore_time
))
if
(
string
.
IsNullOrEmpty
(
recore_time
))
{
return
Json
(
new
{
...
...
@@ -2610,6 +2610,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
var
m
=
new
dc_base_finance_aliexpress
{
company_id
=
companyid
??
0
,
account_name
=
account_name
,
avg_click_cost
=
decimal
.
Parse
(
avg_click_cost
),
clickcount
=
int
.
Parse
(
clickcount
),
...
...
@@ -2653,11 +2654,76 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
//var result = service.AddDailySale(list);
var
listRate
=
new
List
<
Tuple
<
string
,
string
,
decimal
>>();
var
listAccount
=
new
List
<
Tuple
<
int
,
string
>>();
foreach
(
var
item
in
list
)
{
//获取相关汇率
var
rates
=
listRate
.
Where
(
a
=>
a
.
Item1
==
item
.
currency
);
if
(
rates
.
Count
()
==
0
)
{
var
rateRMB
=
Services
.
CommonServices
.
GetExchangeRate
(
item
.
currency
,
"CNY"
);
var
rateUSD
=
Services
.
CommonServices
.
GetExchangeRate
(
item
.
currency
,
"USD"
);
listRate
.
Add
(
new
Tuple
<
string
,
string
,
decimal
>(
item
.
currency
,
"CNY"
,
rateRMB
));
listRate
.
Add
(
new
Tuple
<
string
,
string
,
decimal
>(
item
.
currency
,
"USD"
,
rateUSD
));
item
.
cost_fee_rmb
=
item
.
cost_fee
*
rateRMB
;
item
.
to_rmb_rate
=
rateRMB
;
item
.
to_usd_rate
=
rateUSD
;
}
else
{
var
rateRMB
=
rates
.
Where
(
a
=>
a
.
Item2
==
"CNY"
).
FirstOrDefault
();
var
rateUSD
=
rates
.
Where
(
a
=>
a
.
Item2
==
"USD"
).
FirstOrDefault
();
if
(
rateRMB
==
null
)
{
return
Json
(
new
{
success
=
false
,
msg
=
$"找不到币种【
{
item
.
currency
}
】转人民币的汇率"
,
});
}
if
(
rateUSD
==
null
)
{
return
Json
(
new
{
success
=
false
,
msg
=
$"找不到币种【
{
item
.
currency
}
】转美元的汇率"
,
});
}
item
.
cost_fee_rmb
=
item
.
cost_fee
*
rateRMB
.
Item3
;
item
.
to_rmb_rate
=
rateRMB
.
Item3
;
item
.
to_usd_rate
=
rateUSD
.
Item3
;
}
//获取帐号id
var
objAccount
=
listAccount
.
Where
(
a
=>
a
.
Item2
==
item
.
account_name
).
FirstOrDefault
();
if
(
objAccount
==
null
)
{
var
_account
=
Services
.
CommonServices
.
GetCompanyAccount
(
item
.
account_name
,
companyid
??
0
);
if
(
_account
==
null
)
{
return
Json
(
new
{
success
=
false
,
msg
=
$"找不到该账号【
{
item
.
account_name
}
】"
,
});
}
item
.
account_id
=
_account
.
account_id
;
listAccount
.
Add
(
new
Tuple
<
int
,
string
>(
_account
.
account_id
,
item
.
account_name
));
}
else
{
item
.
account_id
=
objAccount
.
Item1
;
}
}
var
result
=
new
Services
.
OrdersServices
().
SaveAliExpressAD
(
list
);
return
Json
(
new
...
...
Bailun.DC.Web/Areas/Reports/Views/Orders/AliexpressAD.cshtml
View file @
b1b5467d
...
...
@@ -76,27 +76,13 @@
var tb;
var BASE_URL = '@(Url.Content("~/js/webuploader-0.1.5/"))';
$(document).ready(function () {
uploadfile('btnupload',
'@Url.Content("~/Reports/Orders/ImportAliExpressAD")',
function(result){
if(result.result.success)
{
alert('上传成功!');
}
else
{
alert(result.result.msg);
}
});
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 170));
list();
list(
1
);
listAccount();
...
...
@@ -105,7 +91,7 @@
//listcategory12();
})
function list() {
function list(
p
) {
var columns = [
{
field: 'account_name', title: '帐号', width: '200', iscount: true
...
...
@@ -140,6 +126,21 @@
}
companyid = d.companyid;
if (p == 1) {
uploadfile('btnupload',
'@Url.Content("~/Reports/Orders/ImportAliExpressAD")',
function(result){
if(result.result.success)
{
alert('上传成功!');
}
else
{
alert(result.result.msg);
}
});
}
}
}, {
fixedcol: true,
...
...
@@ -235,7 +236,7 @@
// swf文件路径
swf: BASE_URL + 'Uploader.swf',
// 文件接收服务端。
server: url
!=undefined?url:
'@Url.Content("~/File/UploadFile")',
server: url
!= undefined ? (url + '?companyid=' + companyid) :
'@Url.Content("~/File/UploadFile")',
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: '#'+id,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment