Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
b569d9a8
Commit
b569d9a8
authored
Feb 17, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'scratch-web' of gitlab.gongsibao.com:jiangyong/zhichan into scratch-web
parents
0537dd77
d65e6070
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
358 additions
and
247 deletions
+358
-247
scratch-web/app/base/utils/execClient.js
+23
-1
scratch-web/app/base/wxapplet/impl/businesschanceApplet.js
+324
-242
scratch-web/app/config/localsettings.js
+4
-4
scratch-web/app/config/settings.js
+7
-0
No files found.
scratch-web/app/base/utils/execClient.js
View file @
b569d9a8
var
childproc
=
require
(
'child_process'
);
var
childproc
=
require
(
'child_process'
);
const
util
=
require
(
'util'
);
const
util
=
require
(
'util'
);
const
exec
=
util
.
promisify
(
require
(
'child_process'
).
exec
);
const
exec
=
util
.
promisify
(
require
(
'child_process'
).
exec
);
const
uuidv4
=
require
(
'uuid/v4'
);
class
ExecClient
{
class
ExecClient
{
constructor
()
{
constructor
()
{
this
.
cmdPostPattern
=
"curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"
;
this
.
cmdPostPattern
=
"curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"
;
this
.
cmdGetPattern
=
"curl -G -X GET '{url}'"
;
this
.
cmdGetPattern
=
"curl -G -X GET '{url}'"
;
this
.
cmdPushDataPostPattern
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"
;
}
}
async
exec
(
cmd
)
{
async
exec
(
cmd
)
{
...
@@ -69,6 +71,26 @@ class ExecClient {
...
@@ -69,6 +71,26 @@ class ExecClient {
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
,
options
);
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
,
options
);
return
{
stdout
,
stderr
};
return
{
stdout
,
stderr
};
}
}
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
}
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
)
{
var
requestId
=
requestId
||
this
.
getUUID
();
var
data
=
JSON
.
stringify
(
subData
);
var
cmd
=
this
.
cmdPushDataPostPattern
.
replace
(
/
\{
data
\}
/g
,
data
).
replace
(
/
\{
url
\}
/g
,
url
).
replace
(
/
\{
tk
\}
/g
,
token
).
replace
(
/
\{
requestId
\}
/g
,
requestId
);
console
.
log
(
cmd
);
return
cmd
;
}
async
execPushDataPost
(
subData
,
url
,
token
,
requestId
)
{
let
cmd
=
this
.
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
}
}
}
module
.
exports
=
ExecClient
;
module
.
exports
=
ExecClient
;
...
...
scratch-web/app/base/wxapplet/impl/businesschanceApplet.js
View file @
b569d9a8
var
system
=
require
(
"../../system"
)
var
system
=
require
(
"../../system"
)
const
http
=
require
(
"http"
)
const
http
=
require
(
"http"
)
const
querystring
=
require
(
'querystring'
);
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../config/settings"
);
var
settings
=
require
(
"../../../config/settings"
);
const
AppletBase
=
require
(
"../applet.base"
);
const
AppletBase
=
require
(
"../applet.base"
);
const
logCtl
=
system
.
getObject
(
"web.oplogCtl"
);
const
logCtl
=
system
.
getObject
(
"web.oplogCtl"
);
class
businesschanceApplet
extends
AppletBase
{
class
businesschanceApplet
extends
AppletBase
{
constructor
(){
constructor
()
{
super
();
super
();
this
.
businesschanceService
=
system
.
getObject
(
"service.businesschanceSve"
);
this
.
businesschanceService
=
system
.
getObject
(
"service.businesschanceSve"
);
this
.
orderService
=
system
.
getObject
(
"service.orderSve"
);
this
.
orderService
=
system
.
getObject
(
"service.orderSve"
);
this
.
businesschanceSve
=
system
.
getObject
(
"service.businesschanceSve"
);
this
.
businesschanceSve
=
system
.
getObject
(
"service.businesschanceSve"
);
this
.
channelSve
=
system
.
getObject
(
"service.channelSve"
);
this
.
channelSve
=
system
.
getObject
(
"service.channelSve"
);
this
.
servicesitemSve
=
system
.
getObject
(
"service.servicesitemSve"
);
this
.
servicesitemSve
=
system
.
getObject
(
"service.servicesitemSve"
);
this
.
shopSve
=
system
.
getObject
(
"service.shopSve"
);
this
.
shopSve
=
system
.
getObject
(
"service.shopSve"
);
}
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
async
getBusinessChancesByHhrId
(
obj
,
req
){
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
try
{
}
var
openid
=
obj
.
openid
;
async
getBusinessChancesByHhrId
(
obj
,
req
)
{
console
.
log
(
openid
);
try
{
var
userInfo
=
await
this
.
cacheManager
[
"AppletUserinfoCache"
].
get
(
openid
);
var
openid
=
obj
.
openid
;
if
(
userInfo
==
null
||
userInfo
==
"undefined"
){
console
.
log
(
openid
);
return
system
.
getResult2
(
null
,
null
);
var
userInfo
=
await
this
.
cacheManager
[
"AppletUserinfoCache"
].
get
(
openid
);
}
if
(
userInfo
==
null
||
userInfo
==
"undefined"
)
{
userInfo
=
JSON
.
parse
(
userInfo
);
return
system
.
getResult2
(
null
,
null
);
console
.
log
(
userInfo
);
}
var
userId
=
userInfo
.
id
;
userInfo
=
JSON
.
parse
(
userInfo
);
var
onlyCode
=
userInfo
.
onlyCode
;
console
.
log
(
userInfo
);
var
payUserIds
=
await
this
.
orderService
.
getPayUserIdByOnlyCode
(
userInfo
.
onlyCode
);
var
userId
=
userInfo
.
id
;
var
data
=
{};
var
onlyCode
=
userInfo
.
onlyCode
;
if
(
obj
.
searchName
==
null
||
obj
.
searchName
==
""
||
obj
.
searchName
==
"undefined"
){
var
payUserIds
=
await
this
.
orderService
.
getPayUserIdByOnlyCode
(
userInfo
.
onlyCode
);
if
(
payUserIds
[
0
]
==
null
){
var
data
=
{};
data
[
this
.
db
.
Op
.
or
]
=
[
if
(
obj
.
searchName
==
null
||
obj
.
searchName
==
""
||
obj
.
searchName
==
"undefined"
)
{
{
shopOnlyCode
:
onlyCode
}
if
(
payUserIds
[
0
]
==
null
)
{
];
data
[
this
.
db
.
Op
.
or
]
=
[
}
else
{
{
shopOnlyCode
:
onlyCode
}
data
[
this
.
db
.
Op
.
or
]
=
[
];
{
publisherId
:{[
this
.
db
.
Op
.
in
]:
payUserIds
}},
}
else
{
{
shopOnlyCode
:
onlyCode
}
data
[
this
.
db
.
Op
.
or
]
=
[
];
{
publisherId
:
{
[
this
.
db
.
Op
.
in
]:
payUserIds
}
},
}
{
shopOnlyCode
:
onlyCode
}
}
else
{
];
if
(
payUserIds
[
0
]
==
null
){
}
data
[
this
.
db
.
Op
.
or
]
=
[
}
else
{
{[
this
.
db
.
Op
.
or
]:[{
shopOnlyCode
:
onlyCode
},
if
(
payUserIds
[
0
]
==
null
)
{
{
publisherName
:{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}},
data
[
this
.
db
.
Op
.
or
]
=
[
{
publisherMobile
:{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}},
{
{
chanceTypeName
:{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}},
[
this
.
db
.
Op
.
or
]:
[{
shopOnlyCode
:
onlyCode
},
{
chanceStatusName
:{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}}]}
{
publisherName
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}
},
];
{
publisherMobile
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}
},
{
chanceTypeName
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}
},
{
chanceStatusName
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}
}]
}
];
}
else
{
data
[
this
.
db
.
Op
.
or
]
=
[
{
publisherId
:
{
[
this
.
db
.
Op
.
in
]:
payUserIds
}
},
{
[
this
.
db
.
Op
.
or
]:
[{
shopOnlyCode
:
onlyCode
},
{
publisherName
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}
},
{
publisherMobile
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}
},
{
chanceTypeName
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}
},
{
chanceStatusName
:
{
[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}
}]
}
];
}
}
var
chances
=
await
this
.
businesschanceService
.
findAllChances
(
data
);
if
(
chances
==
null
||
chances
.
length
==
0
)
{
return
system
.
getResult2
(
null
,
null
);
}
console
.
log
(
"chances.....................................01"
);
console
.
log
(
chances
);
//获取渠道名称
var
self
=
this
;
for
(
var
i
=
0
;
i
<
chances
.
length
;
i
++
)
{
if
(
chances
[
i
]
!=
null
)
{
chances
[
i
].
channelName
=
""
;
}
if
(
chances
[
i
].
channelCode
!=
null
&&
chances
[
i
].
channelCode
!=
""
&&
chances
[
i
].
channelCode
!=
"undefined"
)
{
var
channel
=
await
self
.
channelSve
.
getChannelItem
(
chances
[
i
].
channelCode
);
if
(
channel
!=
null
)
{
chances
[
i
].
channelName
=
channel
.
channelName
;
}
}
else
{
}
data
[
this
.
db
.
Op
.
or
]
=
[
}
{
publisherId
:{[
this
.
db
.
Op
.
in
]:
payUserIds
}},
console
.
log
(
"chances--------------------------------------------------02"
);
{[
this
.
db
.
Op
.
or
]:[{
shopOnlyCode
:
onlyCode
},
console
.
log
(
chances
);
{
publisherName
:{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}},
return
system
.
getResult2
(
chances
,
null
);
{
publisherMobile
:{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}},
}
catch
(
e
)
{
{
chanceTypeName
:{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}},
console
.
log
(
e
.
stack
);
{
chanceStatusName
:{[
this
.
db
.
Op
.
like
]:
"%"
+
obj
.
searchName
+
"%"
}}]}
//日志记录
];
logCtl
.
error
({
}
optitle
:
"获取我的商机异常,openid="
+
obj
.
openid
,
}
op
:
"wxapplet/impl/businesschanceApplet/getBusinessChancesByHhrId"
,
var
chances
=
await
this
.
businesschanceService
.
findAllChances
(
data
);
content
:
e
.
stack
,
if
(
chances
==
null
||
chances
.
length
==
0
){
clientIp
:
req
.
clientIp
return
system
.
getResult2
(
null
,
null
);
});
}
}
finally
{
console
.
log
(
"chances.....................................01"
);
console
.
log
(
chances
);
//获取渠道名称
var
self
=
this
;
for
(
var
i
=
0
;
i
<
chances
.
length
;
i
++
)
{
if
(
chances
[
i
]
!=
null
){
chances
[
i
].
channelName
=
""
;
}
if
(
chances
[
i
].
channelCode
!=
null
&&
chances
[
i
].
channelCode
!=
""
&&
chances
[
i
].
channelCode
!=
"undefined"
){
var
channel
=
await
self
.
channelSve
.
getChannelItem
(
chances
[
i
].
channelCode
);
if
(
channel
!=
null
){
chances
[
i
].
channelName
=
channel
.
channelName
;
}
}
}
console
.
log
(
"chances--------------------------------------------------02"
);
console
.
log
(
chances
);
return
system
.
getResult2
(
chances
,
null
);
}
catch
(
e
)
{
console
.
log
(
e
.
stack
);
//日志记录
logCtl
.
error
({
optitle
:
"获取我的商机异常,openid="
+
obj
.
openid
,
op
:
"wxapplet/impl/businesschanceApplet/getBusinessChancesByHhrId"
,
content
:
e
.
stack
,
clientIp
:
req
.
clientIp
});
}
finally
{
}
}
}
}
async
findCustomers
(
obj
,
req
)
{
async
findCustomers
(
obj
,
req
)
{
var
openid
=
obj
.
openid
;
var
openid
=
obj
.
openid
;
var
nickName
=
obj
.
nickName
;
var
nickName
=
obj
.
nickName
;
var
userinfo
=
await
this
.
getUserInfo
(
openid
);
var
userinfo
=
await
this
.
getUserInfo
(
openid
);
userinfo
=
JSON
.
parse
(
userinfo
);
userinfo
=
JSON
.
parse
(
userinfo
);
console
.
log
(
userinfo
.
unionId
);
console
.
log
(
userinfo
.
unionId
);
console
.
log
(
"findCustomers-----------------------getUserInfo------"
);
console
.
log
(
"findCustomers-----------------------getUserInfo------"
);
console
.
log
(
userinfo
);
console
.
log
(
userinfo
);
console
.
log
(
nickName
);
console
.
log
(
nickName
);
if
(
!
nickName
)
{
if
(
!
nickName
)
{
return
this
.
businesschanceService
.
findCustomersByOnlyCode
(
userinfo
.
unionId
);
return
this
.
businesschanceService
.
findCustomersByOnlyCode
(
userinfo
.
unionId
);
}
else
{
}
else
{
return
this
.
businesschanceService
.
findCustomers
(
userinfo
.
unionId
,
nickName
);
return
this
.
businesschanceService
.
findCustomers
(
userinfo
.
unionId
,
nickName
);
}
}
}
}
//发布需求
//发布需求
async
submitneed
(
pobj
,
obj
)
{
async
submitneed
(
pobj
,
obj
)
{
var
serviceItem_name
=
""
;
var
serviceItem_name
=
""
;
var
chanceType
=
"yzc"
;
var
chanceType
=
"yzc"
;
if
(
obj
.
publisherName
==
""
||
obj
.
publisherName
==
null
)
{
if
(
obj
.
publisherName
==
""
||
obj
.
publisherName
==
null
)
{
return
{
code
:
-
100
,
msg
:
"请填写您的姓名"
};
return
{
code
:
-
100
,
msg
:
"请填写您的姓名"
};
}
}
if
(
obj
.
publisherMobile
==
""
||
obj
.
publisherMobile
==
null
)
{
if
(
obj
.
publisherMobile
==
""
||
obj
.
publisherMobile
==
null
)
{
return
{
code
:
-
100
,
msg
:
"请填写您的电话"
};
return
{
code
:
-
100
,
msg
:
"请填写您的电话"
};
}
}
if
(
obj
.
notes
!=
""
&&
obj
.
notes
.
length
>
255
)
{
if
(
obj
.
notes
!=
""
&&
obj
.
notes
.
length
>
255
)
{
return
{
code
:
-
100
,
msg
:
"备注字数超出限制,请重新填写"
};
return
{
code
:
-
100
,
msg
:
"备注字数超出限制,请重新填写"
};
}
}
if
(
obj
.
channelCode
==
""
)
{
if
(
obj
.
channelCode
==
""
)
{
return
{
code
:
-
110
,
msg
:
"channelCode参数传递错误"
};
return
{
code
:
-
110
,
msg
:
"channelCode参数传递错误"
};
}
}
var
channelItem
=
await
this
.
channelSve
.
getChannelItem
(
obj
.
channelCode
);
var
channelItem
=
await
this
.
channelSve
.
getChannelItem
(
obj
.
channelCode
);
if
(
channelItem
==
""
||
channelItem
==
null
)
{
if
(
channelItem
==
""
||
channelItem
==
null
)
{
return
{
code
:
-
110
,
msg
:
"channelCode参数传递错误"
};
return
{
code
:
-
110
,
msg
:
"channelCode参数传递错误"
};
}
}
if
(
obj
.
serviceItem_code
==
""
)
{
if
(
obj
.
serviceItem_code
==
""
)
{
return
{
code
:
-
110
,
msg
:
"serviceItem_code参数传递错误"
};
return
{
code
:
-
110
,
msg
:
"serviceItem_code参数传递错误"
};
}
}
var
serviceItem
=
await
this
.
servicesitemSve
.
findOneByCode
(
obj
.
serviceItem_code
);
var
serviceItem
=
await
this
.
servicesitemSve
.
findOneByCode
(
obj
.
serviceItem_code
);
if
(
serviceItem
==
""
||
serviceItem
==
null
)
{
if
(
serviceItem
==
""
||
serviceItem
==
null
)
{
return
{
code
:
-
110
,
msg
:
"serviceItem_code参数传递错误"
};
return
{
code
:
-
110
,
msg
:
"serviceItem_code参数传递错误"
};
}
else
{
}
else
{
serviceItem_name
=
serviceItem
.
name
;
serviceItem_name
=
serviceItem
.
name
;
chanceType
=
serviceItem
.
itemType
;
chanceType
=
serviceItem
.
itemType
;
}
}
if
(
obj
.
publisherOnlyCode
!=
""
&&
obj
.
shopOnlyCode
!=
""
)
{
if
(
obj
.
publisherOnlyCode
!=
""
&&
obj
.
shopOnlyCode
!=
""
)
{
var
pobj
=
{
var
pobj
=
{
publisherOnlyCode
:
obj
.
publisherOnlyCode
,
publisherOnlyCode
:
obj
.
publisherOnlyCode
,
shopOnlyCode
:
obj
.
shopOnlyCode
,
shopOnlyCode
:
obj
.
shopOnlyCode
,
serviceItem_code
:
obj
.
serviceItem_code
,
serviceItem_code
:
obj
.
serviceItem_code
,
channelCode
:
obj
.
channelCode
,
channelCode
:
obj
.
channelCode
,
chanceStatus
:
"1"
chanceStatus
:
"1"
}
}
var
result
=
await
this
.
businesschanceService
.
findchance
(
pobj
);
var
result
=
await
this
.
businesschanceService
.
findchance
(
pobj
);
if
(
result
!=
""
&&
result
!=
null
)
{
if
(
result
!=
""
&&
result
!=
null
)
{
return
{
code
:
"0"
,
msg
:
"您已经发布需求,请不要重复提交"
};
return
{
code
:
"0"
,
msg
:
"您已经发布需求,请不要重复提交"
};
}
}
}
}
try
{
try
{
var
reqParams
=
{
var
reqParams
=
{
notes
:
obj
.
notes
,
notes
:
obj
.
notes
,
publisherName
:
obj
.
publisherName
,
publisherName
:
obj
.
publisherName
,
publisherMobile
:
obj
.
publisherMobile
,
publisherMobile
:
obj
.
publisherMobile
,
channelCode
:
obj
.
channelCode
,
channelCode
:
obj
.
channelCode
,
serviceItem_code
:
obj
.
serviceItem_code
,
serviceItem_code
:
obj
.
serviceItem_code
,
serviceItem_name
:
serviceItem_name
,
serviceItem_name
:
serviceItem_name
,
publisherOnlyCode
:
obj
.
publisherOnlyCode
,
publisherOnlyCode
:
obj
.
publisherOnlyCode
,
shopOnlyCode
:
obj
.
shopOnlyCode
,
shopOnlyCode
:
obj
.
shopOnlyCode
,
chanceStatus
:
"1"
,
chanceStatus
:
"1"
,
chanceType
:
chanceType
,
chanceType
:
chanceType
,
channelProfitRatio
:
channelItem
.
profitType
==
1
?(
channelItem
.
everySingleProfit
||
0
):
0
,
//渠道分成比率(如:总额100,字段值30,则渠道的利润为30/100,剩下的则为平台利润)
channelProfitRatio
:
channelItem
.
profitType
==
1
?
(
channelItem
.
everySingleProfit
||
0
)
:
0
,
//渠道分成比率(如:总额100,字段值30,则渠道的利润为30/100,剩下的则为平台利润)
channelProfit
:
channelItem
.
profitType
==
2
?(
channelItem
.
everySingleProfit
||
0
):
0
,
//渠道利润
channelProfit
:
channelItem
.
profitType
==
2
?
(
channelItem
.
everySingleProfit
||
0
)
:
0
,
//渠道利润
profitType
:
channelItem
.
profitType
//渠道利润类型:1: "比例分成", 2: "每单分成"
profitType
:
channelItem
.
profitType
//渠道利润类型:1: "比例分成", 2: "每单分成"
}
}
//新增的省份和城市
//新增的省份和城市
var
tCity
=
obj
.
city
||
""
;
var
tCity
=
obj
.
city
||
""
;
var
tProvince
=
obj
.
province
||
""
;
var
tProvince
=
obj
.
province
||
""
;
if
(
tCity
&&
tProvince
)
{
if
(
tCity
&&
tProvince
)
{
reqParams
.
city
=
tCity
;
reqParams
.
city
=
tCity
;
reqParams
.
province
=
tProvince
;
reqParams
.
province
=
tProvince
;
}
}
// console.log(reqParams);
// console.log(reqParams);
var
chance
=
await
this
.
businesschanceService
.
create
(
reqParams
);
var
chance
=
await
this
.
businesschanceService
.
create
(
reqParams
);
if
(
obj
.
shopOnlyCode
!=
null
&&
obj
.
shopOnlyCode
!=
""
&&
obj
.
shopOnlyCode
!=
"undefined"
&&
chance
)
{
if
(
obj
.
shopOnlyCode
!=
null
&&
obj
.
shopOnlyCode
!=
""
&&
obj
.
shopOnlyCode
!=
"undefined"
&&
chance
)
{
var
shopItem
=
await
this
.
shopSve
.
getShopItem
(
obj
.
shopOnlyCode
);
var
shopItem
=
await
this
.
shopSve
.
getShopItem
(
obj
.
shopOnlyCode
);
if
(
shopItem
!=
null
&&
shopItem
.
userMobile
!=
null
&&
shopItem
.
userMobile
!=
""
&&
shopItem
.
userMobile
!=
"undefined"
)
{
if
(
shopItem
!=
null
&&
shopItem
.
userMobile
!=
null
&&
shopItem
.
userMobile
!=
""
&&
shopItem
.
userMobile
!=
"undefined"
)
{
//发送短信
//发送短信
var
smsClient
=
system
.
getObject
(
"util.smsClient"
);
var
smsClient
=
system
.
getObject
(
"util.smsClient"
);
smsClient
.
sendMsg
(
shopItem
.
userMobile
,
"亲,您的客户【"
+
obj
.
publisherName
+
"】于"
+
(
new
Date
()).
Format
(
"yyyy-MM-dd"
)
+
"发布了关于【"
+
smsClient
.
sendMsg
(
shopItem
.
userMobile
,
"亲,您的客户【"
+
obj
.
publisherName
+
"】于"
+
(
new
Date
()).
Format
(
"yyyy-MM-dd"
)
+
"发布了关于【"
+
serviceItem_name
+
"】求购需求,赶紧到知产合伙人小程序中【我的商机】进行查看!"
);
serviceItem_name
+
"】求购需求,赶紧到知产合伙人小程序中【我的商机】进行查看!"
);
}
}
}
}
// console.log("-----------------chance-----------");
// console.log(chance);
var
token
=
""
;
// this.smsClient=System.getObject("util.smsClient");
var
app
=
{
// this.smsClient.sendMsg("13381139519","亲爱的知产合伙人,你的客户于"+(new Date()).Format("yyyy-MM-dd")+"发布了新的需求,亲,赶紧去自己店铺去查看“我的商机”吧!");
"uappKey"
:
""
,
return
{
code
:
"1"
,
msg
:
"发布成功"
};
"appSecret"
:
""
}
catch
(
e
){
}
console
.
log
(
e
);
switch
(
obj
.
channelCode
)
{
logCtl
.
error
({
case
"wssyh5"
:
optitle
:
"submitneed 发布需求异常,publisherName="
+
obj
.
publisherName
+
"publisherMobile:"
+
obj
.
publisherMobile
+
"serviceItem_code="
+
obj
.
serviceItem_code
+
",shopOnlyCode="
+
obj
.
shopOnlyCode
+
"publisherOnlyCode="
+
obj
.
publisherOnlyCode
,
app
.
uappKey
=
"202001201103"
;
op
:
"wxapplet/impl/businesschanceApplet/submitneed"
,
app
.
appSecret
=
"d4770f7e2bea4e45861292ab4ffnhjkm"
;
content
:
e
.
stack
,
break
;
clientIp
:
""
case
"yjs"
:
});
app
.
uappKey
=
"202001201106"
;
return
{
code
:
"-1"
,
msg
:
"操作失败,请稍后重试"
};
app
.
appSecret
=
"d4770f7e2bea4e45861292ab4ffedfgn"
;
}
break
;
}
case
"gsb"
:
//获取需求信息----=get
app
.
uappKey
=
"202001201108"
;
async
getNeedList
(
obj
){
app
.
appSecret
=
"d4770f7e2bea4e45861292ab4ffed753"
;
try
{
break
;
return
this
.
businesschanceSve
.
getTmTradeNeedList
(
obj
);
}
catch
(
e
)
{
default
:
//日志记录
break
;
logCtl
.
error
({
}
optitle
:
"获取需求信息异常,openid="
+
obj
.
openid
,
var
tokenRes
=
await
this
.
getCenterChannelToken
(
app
);
op
:
"wxapplet/impl/businesschanceApplet/getNeedList"
,
if
(
tokenRes
&&
tokenRes
.
status
==
0
&&
tokenRes
.
data
)
{
content
:
e
.
stack
,
token
=
tokenRes
.
data
.
token
;
clientIp
:
""
}
});
if
(
!
token
)
{
return
{
return
system
.
getResultFail
(
-
99
,
"获取token失败"
);
code
:
-
200
,
}
message
:
"error"
,
var
url
=
settings
.
centerChannelUrl
()
+
"web/action/zcbusinesschanceApi/springBoard"
;
data
:
[]
var
npobj
=
{
};
"actionType"
:
"needinfo2fq"
,
}
"actionBody"
:
{
}
notes
:
obj
.
notes
,
async
getTmTradeChanceDetail
(
obj
){
publishContent
:
obj
.
notes
,
try
{
publishName
:
obj
.
publishName
,
return
this
.
businesschanceSve
.
getTmTradeDetails
(
obj
);
publishMobile
:
obj
.
publishMobile
,
}
catch
(
e
)
{
// chanceType_code: "ip_wssyh5",
//日志记录
// chanceTypeName:"商标"
logCtl
.
error
({
chanceTypeName
:
chance
.
chanceTypeName
,
optitle
:
"获取需求详情信息异常,openid="
+
obj
.
openid
,
chanceType_code
:
chance
.
chanceType
+
"_"
+
obj
.
channelCode
op
:
"wxapplet/impl/businesschanceApplet/getTmTradeChanceDetail"
,
}
content
:
e
.
stack
,
};
clientIp
:
""
var
rtn
=
await
this
.
execClient
.
execPushDataPost
(
npobj
,
url
,
token
);
});
console
.
log
(
rtn
);
return
{
code
:
-
200
,
message
:
"error"
,
// console.log("-----------------chance-----------");
data
:
[]
// console.log(chance);
};
// this.smsClient=System.getObject("util.smsClient");
}
// this.smsClient.sendMsg("13381139519","亲爱的知产合伙人,你的客户于"+(new Date()).Format("yyyy-MM-dd")+"发布了新的需求,亲,赶紧去自己店铺去查看“我的商机”吧!");
}
return
{
code
:
"1"
,
msg
:
"发布成功"
};
}
catch
(
e
)
{
console
.
log
(
e
);
logCtl
.
error
({
optitle
:
"submitneed 发布需求异常,publisherName="
+
obj
.
publisherName
+
"publisherMobile:"
+
obj
.
publisherMobile
+
"serviceItem_code="
+
obj
.
serviceItem_code
+
",shopOnlyCode="
+
obj
.
shopOnlyCode
+
"publisherOnlyCode="
+
obj
.
publisherOnlyCode
,
op
:
"wxapplet/impl/businesschanceApplet/submitneed"
,
content
:
e
.
stack
,
clientIp
:
""
});
return
{
code
:
"-1"
,
msg
:
"操作失败,请稍后重试"
};
}
}
//获取center-channel token
async
getCenterChannelToken
(
app
)
{
var
pobj
=
{
"actionType"
:
"getAppTokenByAppKey"
,
"actionBody"
:
{
"appkey"
:
app
.
uappKey
,
"secret"
:
app
.
appSecret
}
};
var
url
=
settings
.
centerChannelUrl
()
+
"web/auth/accessAuth/getAppTokenByAppKey"
;
var
rtn
=
await
this
.
restClient
.
execPost
(
pobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost is empty"
);
}
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
console
.
log
(
result
)
return
result
;
}
//获取需求信息----=get
async
getNeedList
(
obj
)
{
try
{
return
this
.
businesschanceSve
.
getTmTradeNeedList
(
obj
);
}
catch
(
e
)
{
//日志记录
logCtl
.
error
({
optitle
:
"获取需求信息异常,openid="
+
obj
.
openid
,
op
:
"wxapplet/impl/businesschanceApplet/getNeedList"
,
content
:
e
.
stack
,
clientIp
:
""
});
return
{
code
:
-
200
,
message
:
"error"
,
data
:
[]
};
}
}
async
getTmTradeChanceDetail
(
obj
)
{
try
{
return
this
.
businesschanceSve
.
getTmTradeDetails
(
obj
);
}
catch
(
e
)
{
//日志记录
logCtl
.
error
({
optitle
:
"获取需求详情信息异常,openid="
+
obj
.
openid
,
op
:
"wxapplet/impl/businesschanceApplet/getTmTradeChanceDetail"
,
content
:
e
.
stack
,
clientIp
:
""
});
return
{
code
:
-
200
,
message
:
"error"
,
data
:
[]
};
}
}
}
}
module
.
exports
=
businesschanceApplet
;
module
.
exports
=
businesschanceApplet
;
// var task=new businesschanceApplet();
// var obj ={openid:"ovPx35GktY-8pn3GmpIYfcbmqZQk",chanceId:"53"};
// task.getTmTradeChanceDetail(obj).then(function(result){
// var task = new businesschanceApplet();
// var obj = {
// notes: "obj.notes",
// publishName: "obj.publisherName",
// publishMobile: "obj.publisherMobile",
// channelCode: "wssyh5"
// }
// task.submitneed(null, obj);
// task.getTmTradeChanceDetail(obj).then(function (result) {
// console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
// console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
// console.log((result));
// console.log((result));
// }).catch(function
(e)
{
// }).catch(function
(e)
{
// console.log(e);
// console.log(e);
// });
// });
scratch-web/app/config/localsettings.js
View file @
b569d9a8
...
@@ -7,11 +7,11 @@ var settings={
...
@@ -7,11 +7,11 @@ var settings={
},
},
database
:{
database
:{
dbname
:
"zc"
,
dbname
:
"zc"
,
user
:
"
root
"
,
user
:
"
write
"
,
password
:
"
123456
"
,
password
:
"
write
"
,
config
:
{
config
:
{
host
:
'
192.168.4.119
'
,
host
:
'
43.247.184.35
'
,
port
:
3306
,
port
:
8899
,
dialect
:
'mysql'
,
dialect
:
'mysql'
,
operatorsAliases
:
false
,
operatorsAliases
:
false
,
pool
:
{
pool
:
{
...
...
scratch-web/app/config/settings.js
View file @
b569d9a8
...
@@ -38,6 +38,13 @@ var settings = {
...
@@ -38,6 +38,13 @@ var settings = {
return
"http://43.247.184.94:7200/"
;
return
"http://43.247.184.94:7200/"
;
}
}
},
},
centerChannelUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://gsb.qifu.gongsibao.com:4012/"
;
}
else
{
return
"http://center-channel-service/"
;
}
},
reqEsAddrIc
:
function
(){
reqEsAddrIc
:
function
(){
if
(
this
.
env
==
"dev"
){
if
(
this
.
env
==
"dev"
){
var
localsettings
=
require
(
"./localsettings"
);
var
localsettings
=
require
(
"./localsettings"
);
...
...
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