lsw 9 miesięcy temu
rodzic
commit
9139bf650c

+ 1 - 1
admin-ui/src/views/work/pay/cash_out.vue

@@ -36,7 +36,7 @@
       <el-table-column label="提现时间" align="center" prop="createTime" width="200" />
       <el-table-column label="操作" align="center" width="200">
         <template slot-scope="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit', scope.row)" v-hasPermi="['work:pay:edit']">确认</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit', scope.row)" v-hasPermi="['work:pay:audit']" v-if="scope.row == 0">确认</el-button>
         </template>
       </el-table-column>
       <template slot="empty">

+ 1 - 1
app/pages/job/position/manage/part_time_push.vue

@@ -18,7 +18,7 @@
 		<view class="form_group">
 			<view class="lable re">兼职金额(元)</view>
 			<view class="bgm">
-				<input type="number" placeholder="请输入" v-model="item.salary" class="input" />
+				<input type="digit" placeholder="请输入" v-model="item.salary" class="input" />
 				<view class="msg">
 					<text>{{ money }}</text>
 					<text @click="go('/pages/user/money/index')">充值</text>

+ 1 - 1
app/pages/user/index.vue

@@ -181,7 +181,7 @@
 			<view class="cd" @click="go('/pages/user/resume/application/task_to_do?role=0')">
 				<view class="out">
 					<view class="int">
-						<view class="icon" style="background-color: #FF5722">&#xe63e;</view>
+						<view class="icon" style="background-color: #00BCD4">&#xe63e;</view>
 						<view class="title">甲方任务</view>
 						<view class="bage" v-if="user.completeApplication > 0">进行中</view>
 					</view>

+ 13 - 7
app/pages/user/money/cash_out.vue

@@ -79,13 +79,19 @@ export default {
 							data: this.item,
 							method: 'POST',
 							success: (res) => {
-								uni.showModal({
-									title: '提示',
-									content: '提现申请成功,等待平台审核打款',
-									showCancel: false,
-									success: (res) => {
-										uni.$emit('payMoney');
-										uni.navigateBack();
+								//通知模板订阅消息
+								uni.requestSubscribeMessage({
+									tmplIds: ['PtdKbqfzmpvGsJPx_YekDX4-cljbhOXcvoUB3XJaVLg', 'NIqSQq0j765o9Iz9gMiSelnuxMgPIPeCnk3lvEnWJlo'],
+									complete: (c) => {
+										uni.showModal({
+											title: '提示',
+											content: '提现申请成功,等待平台审核打款',
+											showCancel: false,
+											success: (res) => {
+												uni.$emit('payMoney');
+												uni.navigateBack();
+											}
+										});
 									}
 								});
 							}

+ 1 - 1
app/pages/user/resume/application/task_to_do.vue

@@ -16,7 +16,7 @@
 				<view class="msg">驳回原因:{{ item.rejectMsg }}</view>
 			</view>
 			<view class="flex" v-if="param.role == 0">
-				<view class="f br agree" v-if="item.isComplete == 0">请确认完成申请...</view>
+				<view class="f br agree" v-if="item.isComplete == 0">进行中...</view>
 				<view class="f br agree" v-if="item.isComplete == 1">对方发起任务完成申请</view>
 				<view class="f br agree" v-if="item.isComplete == 2">已完成(打款)</view>
 				<view class="f br danger" v-if="item.isComplete == 3">申请驳回</view>

+ 4 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IPayService.java

@@ -33,4 +33,7 @@ public interface IPayService extends IService<Pay> {
      * @return
      */
     AjaxResult audit(PayAuditDto dto) throws ServerException;
-}
+
+    public void sendMessage(Pay pay);
+
+}

+ 44 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/PayServiceImpl.java

@@ -1,5 +1,8 @@
 package com.ruoyi.web.work.service.impl;
 
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.StringUtils;
@@ -12,10 +15,12 @@ import com.ruoyi.web.work.mapper.PayMapper;
 import com.ruoyi.web.work.service.IPayService;
 import com.ruoyi.web.work.service.IUserService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.rmi.ServerException;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -30,6 +35,9 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements IPayS
     @Autowired
     IUserService userService;
 
+    @Autowired
+    private Environment env;
+
     @Override
     public List<Pay> selectList(Pay pay) {
         return payMapper.selectList(pay);
@@ -73,7 +81,7 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements IPayS
     @Override
     public AjaxResult audit(PayAuditDto dto) throws ServerException {
         Pay pay = getById(dto.getId());
-        if (pay == null) {
+        if (pay == null || pay.getType() != 2) {
             return AjaxResult.error("提现信息不存在");
         }
         if (pay.getState() == 1) {
@@ -86,12 +94,46 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements IPayS
         }
         //提现驳回需要退回到用户账户余额
         if (dto.getState() == 2) {
-            User user =userService.getById(pay.getUserId());
+            User user = userService.getById(pay.getUserId());
             user.setMoney(user.getMoney().add(pay.getMoney()));
             if (!userService.updateById(user)) {
                 throw new ServerException("更新用户账户余额失败,请联系平台");
             }
         }
+        sendMessage(pay);
         return AjaxResult.success();
     }
+
+    @Override
+    public void sendMessage(Pay pay) {
+        JSONObject jsonObject = JSONUtil.parseObj(HttpUtil.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + env.getProperty("wx.appid") + "&secret=" + env.getProperty("wx.appSecret")));
+        JSONObject body = new JSONObject();
+        body.set("appid", env.getProperty("wx.appid"));
+        JSONObject content = new JSONObject();
+        //提现成功通知
+        if (pay.getState() == 1) {
+            User user = userService.getById(pay.getUserId());
+            body.set("touser", user.getOpenId());
+            body.set("template_id", "PtdKbqfzmpvGsJPx_YekDX4-cljbhOXcvoUB3XJaVLg");
+            body.set("page", "pages/user/money/index");
+            content.set("amount3", new JSONObject().set("value", pay.getMoney()));//提现金额
+            content.set("character_string4", new JSONObject().set("value", pay.getNums()));//交易单号
+            content.set("time2", new JSONObject().set("value", new Date())); //提现时间
+        }
+        //提现失败通知
+        if (pay.getState() == 2) {
+            User user = userService.getById(pay.getUserId());
+            body.set("touser", user.getOpenId());
+            body.set("template_id", "NIqSQq0j765o9Iz9gMiSelnuxMgPIPeCnk3lvEnWJlo");
+            body.set("page", "pages/user/money/index");
+            content.set("amount3", new JSONObject().set("value", pay.getMoney()));//提现金额
+            content.set("character_string4", new JSONObject().set("value", pay.getNums()));//交易单号
+            content.set("thing5", new JSONObject().set("value", pay.getMsg())); //失败原因
+            content.set("time2", new JSONObject().set("value", new Date())); //提现时间
+        }
+        body.set("data", content);
+        String result = HttpUtil.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + jsonObject.getStr("access_token"), body.toString());
+        System.out.println("body:" + body);
+        System.out.println("小程序订阅消息:" + result);
+    }
 }