咱們寫code時一般會用git或svn等工具來協同工做,可是Api case也用這種方式的話就顯得有點麻煩了,一個接口的屬性畢竟就那個幾個,不必修改前fetch & rebase,修改後還要push,Api的協做應該更簡單,相信不少人用過Atlassian的wiki,咱們在編輯文檔的時候經常會收到提醒:某某更改了此文檔,是否合併 之類,API的協做也應該這樣。java
如今不少商家抓住紅包這個營銷的利器,利用發佈現金紅包吸引更多粉絲,宣傳商家平臺,又或者設置發佈紅包收取手續費。公衆號小程序發語音紅包技術開發:185*6541-3369 微/電git
紅包分配代碼:
$total=20;//紅包總金額
$num=10;// 分紅10個紅包,支持10人隨機領取
$min=0.01;//每一個人最少能收到0.01元
for ($i=1;$i<$num;$i++)
{
$safe_total=($total-($num-$i)*$min)/($num-$i);//隨機安全上限
$money=mt_rand($min*100,$safe_total*100)/100;
$total=$total-$money;
echo '第'.$i.'個紅包:'.$money.' 元,餘額:'.$total.' 元
';
}web
package
com.paic.pad.info.tmr.redpacket.web.rest;
spring
import
java.util.Map;
import
javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpSession;
import
org.springframework.context.annotation.Scope;
import
org.springframework.stereotype.Controller;
import
org.springframework.ui.ModelMap;
import
org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.ResponseBody;
import
com.paic.pad.info.common.biz.services.CommSysParamService;
import
com.paic.pad.info.common.utils.SessionKeyConstant;
import
com.paic.pad.info.sysuser.dto.UserDTO;
import
com.paic.pad.info.tmr.redpacket.biz.services.RedPacketGrabSevice;
import
com.paic.pad.info.tmr.redpacket.biz.services.RedPacketSevice;
import
com.paic.pafa.appclient.annotation.BizServicesProxy;
import
com.paic.pafa.web.BaseRest;
@Controller
@Scope
(
"prototype"
)
@RequestMapping
(value =
"/redPacket"
)
public
class
RedPacketRest
extends
BaseRest {
@BizServicesProxy
private
CommSysParamService commSysParamService;
@BizServicesProxy
private
RedPacketSevice redPacketSevice;
@BizServicesProxy
private
RedPacketGrabSevice redPacketGrabSevice;
/**
* 搶紅包
*
* @param request
* @param modelMap
* @return
* @throws Exception
*/