Commit 2f98a156 by 庄欣

推送

parent 5016fc0e
......@@ -53,7 +53,13 @@ func open(url string, index int) {
chromedp.ActionFunc(func(ctx context.Context) error {
totalString = strings.Replace(totalString, "<em>", "", 1)
totalString = strings.Replace(totalString, "</em>", "", 1);
totalNum,_ := strconv.ParseInt(totalString,10, 64)
var totalNum int64;
fmt.Printf(totalString);
if (strings.Contains(totalString, "万")) {
totalNum = 10000;
} else {
totalNum,_ = strconv.ParseInt(totalString,10, 64)
}
var totalPage int;
if (totalNum > 0) {
totalPage = f2i(math.Floor(float64(totalNum/15)))
......@@ -151,12 +157,8 @@ func main() {
}
}()
urls := []string {
"https://weibo.com/1618051664/JF9nSmV3n?filter=hot&page_source=hot&root_comment_id=0",
"https://weibo.com/5634100124/JDIIu47rJ?filter=hot&root_comment_id=0&type=comment",
"https://weibo.com/1609953534/JF9s1b6wW?filter=hot&root_comment_id=0&type=comment",
"https://weibo.com/2656274875/JFdQC8TIz?filter=hot&root_comment_id=0",
"https://weibo.com/1618051664/JF8TP0Kv4?filter=hot&root_comment_id=0",
"https://weibo.com/6146894071/K4DtMfUpt?type=comment",
}
for i := 0; i < len(urls); i++ {
......
......@@ -16,7 +16,7 @@ def feature_extract(database_path, model):
for i, img_path in enumerate(img_list):
norm_feat = model.vgg_extract_feat(img_path)
img_name = os.path.split(img_path)[1]
feats.append(norm_feat)
feats.append(norm_f eat)
names.append(img_name.encode())
current = i+1
total = len(img_list)
......
......@@ -144,10 +144,16 @@ function getImages() {
lists = $(".swiper-wrapper").find("img");
var urls = [];
var imgSrc = "";
var worksString = window.location.href.match(/\works\/\S*\?/g);
if (worksString.length > 0) {
worksId = worksString[0].replace("works/", "");
worksId = worksId.replace("?", "");
var worksString = window.location.href
if (worksString.length > 0 && worksString.indexOf("works") > -1) {
var start = worksString.indexOf("works/") + "works/".length;
var end = worksString.indexOf("?");
if (end <= -1) {
end = worksString.length;
}
var worksId = worksString.substring(start, end)
worksId = base64Decode(worksId);
}
userNickname = $($(".user-info > span.nickname")[0]).text();
......
......@@ -164,4 +164,50 @@ input[type=radio] {
transform: rotate(360deg);
}
}
.__messagebox_container {
width: 100%;
margin: 0 auto;
position: absolute;
z-index: 999;
background-color: rgb(255, 255, 153);
}
._button_groups {
flex-direction: row;
margin: 10px auto;
display: flex;
justify-content: space-between;
width: 70%;
}
.btn {
width: auto;
padding-left: 20px;
padding-right: 20px;
background: #0277bd;
border: none;
height: 30px;
color: white;
border-radius: 2px;
}
.pushContent {
margin: 0 auto;
width: 90%;
text-align: left;
}
.activeCls {
background-color: #FF9F2A;
}
.upload {
height: 100px;
display: flex;
justify-content: left;
align-content: center;
align-items: center;
padding-left: 30px;
}
\ No newline at end of file
var UI = chrome.extension.getURL("ui.html");
var icon = chrome.extension.getURL("icon.png");
var uploadIcon = chrome.extension.getURL("60616b3c6cf28.png")
let extendDom = document.createElement("div");
var host = "https://api.mepai.me/manage";
let app = null;
extendDom.id = "__extend_dom"
extendDom.innerHTML = "<div class='cicon'><div><img src='"+icon+"' v-on:click='showUi'/></div></div>";
......@@ -35,6 +37,7 @@ fetch(UI).then(function(res){
token: "",
permission: "-1",
remark: "",
uploadIcon: uploadIcon,
user: {
id: "",
mobile: "",
......@@ -58,15 +61,32 @@ fetch(UI).then(function(res){
userToken: "",
err: "",
loading: false,
sendPush: false,
authContent: "亲爱的摄影师,您的作品非常符合米拍有米计划的投稿标准," +
"我们期望获得您的授权,允许我们在有米计划中使用您的作品," +
"发布到vivo、OPPO、小米、华为锁屏等平台进行内容流量增值。" +
"若上架的平台有现金收益,我们将在社区内给予结算。若您同意使用," +
"请联系米拍编少微信mepai110,进行详细沟通。",
picContent: "亲爱的摄影师,您的作品 {url} 中的第x张图,内容非常符合米拍有米计划的投稿标准," +
"但目前图片在云端已被压缩,因图片分辨率较小或噪点较为明显," +
"而无法通过第三方审核,我们期望您能将大图发送至米拍编少邮箱laigao@mepai.me," +
"若有任何疑问请联系米拍编少微信mepai110。",
smsContent:"您的作品非常符合有米计划标准,米拍期望使用它进行流量增值运营,若有收益会与您分成,目前有事项还需和您确认,详情请在米拍-通知内查看",
pushContentN: "亲爱的摄影师,您的作品内容非常符合米拍有米计划的投稿标准,但目前图片在云端已被压缩,因图片分辨率较小或噪点较为明显,而无法通过第三方审核,我们期望您能将相应大图发送至米拍编少邮箱laigao@mepai.me,若有任何疑问请联系米拍编少微信mepai110。",
authType: "auth", //auth, pic
API: {
addZone: "https://api.mepai.me/manage/youmi/add-zone",
getZone: "https://api.mepai.me/manage/youmi/get-zone",
removeZone: "https://api.mepai.me/manage/youmi/remove-zone",
setRemark: "https://api.mepai.me/manage/youmi/set-remark",
getRemark: "https://api.mepai.me/manage/youmi/get-remark",
getUserInfo: "https://api.mepai.me/manage/youmi/user",
getIsYoumi: "https://api.mepai.me/manage/youmi/is-youmi",
auth: "https://api.mepai.me/manage/youmi/is-auth"
addZone: host + "/youmi/add-zone",
getZone: host + "/youmi/get-zone",
removeZone: host + "/youmi/remove-zone",
setRemark: host + "/youmi/set-remark",
getRemark: host + "/youmi/get-remark",
getUserInfo: host + "/youmi/user",
getIsYoumi: host + "/youmi/is-youmi",
auth: host + "/youmi/is-auth",
pushContactSms: host + "/push/sms",
pushContact: host + "/push",
}
},
methods: {
......@@ -74,6 +94,8 @@ fetch(UI).then(function(res){
this.showUiProp = !this.showUiProp;
if (this.showUiProp) {
this.openUi();
} else {
this.sendPush = false;
}
},
openUi: function() {
......@@ -121,6 +143,7 @@ fetch(UI).then(function(res){
}
}
})
$this.authType = "now";
}
if ($this.isWorks ) {
$this.getData($this.API.getIsYoumi, {
......@@ -129,6 +152,8 @@ fetch(UI).then(function(res){
}, data => {
$this.isYoumi = data.data;
});
$this.picContent = $this.picContent.replace("{url}", "https://m.mepai.me/works/" + $this.objectId)
$this.authType = "pic";
}
if ($this.isReading) {
$this.getData($this.API.getIsYoumi, {
......@@ -137,6 +162,7 @@ fetch(UI).then(function(res){
}, data => {
$this.isYoumi = data.data;
});
$this.authType = "now";
}
if ($this.isReading || $this.isWorks) {
$this.getData(this.API.getZone, {
......@@ -154,6 +180,8 @@ fetch(UI).then(function(res){
} else {
$this.err = "不在个人中心或作品详情或文章详情页";
}
console.log(this.authType)
},
assertIn: function() {
let url = window.location.href;
......@@ -283,6 +311,9 @@ fetch(UI).then(function(res){
var idStrings = avatar.match(reg);
if (idStrings !== undefined && idStrings !== null && idStrings !== "") {
userId = idStrings[0].replace(/\//g, "");
} else {
alert("很遗憾,未能获取当前用户信息!");
return false;
}
this.userId = userId;
},
......@@ -387,6 +418,57 @@ fetch(UI).then(function(res){
rv = escape(rv);
rv = decodeURIComponent(rv);
return rv;
},
openMessageBox() {
this.sendPush = true
},
changeTab(type) {
this.authType = type;
},
sendPushOnly() {
if (confirm("确定发送PUSH?")) {
var api = this.API.pushContact;
var content = "";
switch (this.authType) {
case "auth":
content = this.authContent;
break;
case "pic":
content = this.smsContent;
break;
case "now":
content = this.pushContentN;
break;
}
var sendData = {
message: content,
uid: this.user.id
};
this.sendData(api, sendData, (res) => {
if (res.code === "100001") {
alert("发送PUSH成功");
return;
}else {
alert("发送PUSH操作失败:"+res.message +";请联系管理员!");
return
}
});
}
},
sendAll() { //发送SMS
this.sendPushOnly();
if (confirm("确定发送短信?")) {
var api = this.API.pushContactSms;
this.sendData(api, {uid: this.user.id, tid:901349}, (res) => {
if (res.code === "100001") {
alert("发送短信成功");
return;
}else {
alert("发送短信操作失败:"+res.message +";请联系管理员!");
return
}
});
}
}
}
});
......
<style>
.__messagebox_container {
width: 30%;
margin: 0 auto;
}
._button_groups {
margin: 10px auto;
display: flex;
justify-content: space-between;
width: 70%;
}
.btn {
width: auto;
padding-left: 20px;
padding-right: 20px;
background: #0277bd;
border: none;
height: 30px;
color: white;
border-radius: 2px;
}
.pushContent {
margin: 0 auto;
width: 100%;
text-align: left;
}
</style>
<div class="__messagebox_container">
站内Push内容(可修改)
<div class="_button_groups">
<button class="btn btn-primary " v-if="authType == 'auth'" v-on:click="">要授权</button>
<button class="btn btn-primary" v-if="authType == 'pic'" v-on:click="">要大图</button>
</div>
<div class="auth">
<textarea cols="50" rows="15" class="pushContent">
亲爱的摄影师,您的作品非常符合米拍有米计划的投稿标准,
我们期望获得您的授权,允许我们在有米计划中使用您的作品,
发布到vivo、OPPO、小米、华为锁屏等平台进行内容流量增值。
若上架的平台有现金收益,我们将在社区内给予结算。若您同意使用,
请联系米拍编少微信mepai110,进行详细沟通。
</textarea>
</div>
<div class="">
<div class="_button_groups">
<div>
<button class="btn">仅发送米拍站内PUSH</button>
</div>
<div>
<button class="btn">发送PUSH和短信</button>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<div class="x" v-on:click="showUi"><img :src="closeX"></div>
<div class="danger" v-if="err != ''">{{err}}</div>
<!------------------- 用户开始 -------->
<div class="userinfo row" v-if="isUserInfo && canOpen && isAuth">
<div class="userinfo row" v-if="isUserInfo && canOpen && isAuth && !sendPush">
<div class="col-md-12">
<div class="form-group">
<div class="label">用户id:</div>
......@@ -58,7 +58,7 @@
</div>
<!------------------- 用户结束 作品开始 -------->
<div class="workinfo row" v-if="isWorks && canOpen && isAuth" style="margin-top:20px;">
<div class="workinfo row" v-if="isWorks && canOpen && isAuth && !sendPush" style="margin-top:20px;">
<div class="col-md-12">
<div class="id-flex">
<div>作品id:{{objectId}}</div>
......@@ -102,7 +102,7 @@
<!------------------- 作品结束 文章开始 -------->
<div class="readinginfo row" v-if="isReading && canOpen && isAuth" style="margin-top:20px">
<div class="readinginfo row" v-if="isReading && canOpen && isAuth && !sendPush" style="margin-top:20px">
<div class="col-md-12">
<div class="id-flex">
......@@ -143,4 +143,43 @@
</div>
</div>
<!------------------- 文章结束 -------->
<!------------------- 消息推送 ---------------->
<div class="form-group" style="margin: 30px auto;display: flex;justify-content: center"
v-if="(authType == 'auth' || authType =='pic' | authType=='now') && canOpen && isAuth && !sendPush"
>
<button class="btn button-primary primary large" v-on:click="openMessageBox">给作者发送消息</button>
</div>
<div class="__messagebox_container" v-if="sendPush">
<label>站内Push内容(可修改)</label>
<div class="_button_groups">
<button class="btn btn-primary " :class="authType=='auth' ? 'activeCls' : ''" v-on:click="changeTab('auth')">要授权</button>
<button class="btn btn-primary " :class="authType=='pic' ? 'activeCls' : ''" v-show="isWorks" v-on:click="changeTab('pic')">要大图</button>
<button class="btn btn-primary " :class="authType=='now' ? 'activeCls' : ''" v-show="!isWorks" v-on:click="changeTab('now')">要大图</button>
</div>
<div class="auth">
<textarea cols="50" rows="7" class="pushContent" name="pushContentAuth" v-show="authType=='auth'">{{authContent}}</textarea>
<textarea cols="50" rows="7" class="pushContent" name="pushContentPic" v-show="authType=='pic'">{{picContent}}</textarea>
<textarea cols="50" rows="7" class="pushContent" name="pushContentN" v-show="authType=='now'">{{pushContentN}}</textarea>
</div>
<!-- <div class="upload">
<input type="file" name="uploadFile"/>
</div>-->
<label>短信内容(不可修改)</label>
<div class="auth">
<textarea cols="50" rows="5" class="pushSmsContent" readonly>{{smsContent}}</textarea>
</div>
<div class="">
<div class="_button_groups">
<div>
<button class="btn" v-on:click="sendPushOnly">仅发送米拍站内PUSH</button>
</div>
<div>
<button class="btn" v-on:click="sendAll">发送PUSH和短信</button>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment