Commit d285c948 authored by 赵然's avatar 赵然

zr

parent be7dc363
......@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.net.URLEncoder;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
......@@ -63,7 +64,7 @@ public class CreatUrlModule {
params.put("uid",userId);
params.put("credits",credits);
if(dcustom!=null&&dcustom!=""&&dcustom != "null") {
params.put("dcustom", dcustom);
params.put("dcustom", URLEncoder.encode( dcustom, "UTF-8" ));
}
if(transfer!=null&&transfer!=""&&transfer != "null"){
params.put("transfer",transfer);
......
package main.com.atguigu.springmvc.handlers;
import main.com.atguigu.springmvc.common.MysqlUtils;
import main.com.atguigu.springmvc.service.SqlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -16,6 +18,8 @@ import java.util.Locale;
@Controller
public class SignModule {
@Autowired
SqlService sqlService;
private MysqlUtils jdbc;
private static final String SUCCESS = "success";
......@@ -35,12 +39,18 @@ public class SignModule {
//链接数据库
jdbc = MysqlUtils.mysqlDuiba("sign_record");
//jdbc = MysqlUtils.mysqlDuiba("sign_record");
//执行数据库
jdbc.update("delete from sign_record.tb_sign_log where consumer_id="+consumer_id+" and source_relation_id="+source_relation_id+"");
jdbc.update("delete from sign_record.tb_sign_statics where consumer_id="+consumer_id+" and source_relation_id="+source_relation_id+"");
//jdbc.update("delete from sign_record.tb_sign_log where consumer_id="+consumer_id+" and source_relation_id="+source_relation_id+"");
//jdbc.update("delete from sign_record.tb_sign_statics where consumer_id="+consumer_id+" and source_relation_id="+source_relation_id+"");
//释放数据库
jdbc.releaseConn();
//jdbc.releaseConn();
String sql1 = "delete from sign_record.tb_sign_log where consumer_id='"+consumer_id+"' and source_relation_id='"+source_relation_id+"'";
String sql2 = "delete from sign_record.tb_sign_statics where consumer_id='"+consumer_id+"' and source_relation_id='"+source_relation_id+"'";
sqlService.update(sql1);
sqlService.update(sql2);
return new ModelAndView(SUCCESS);
}
......@@ -71,22 +81,26 @@ public class SignModule {
System.out.println("签到类型为:"+sign_type);
//链接数据库
jdbc = MysqlUtils.mysqlDuiba("sign_record");
//jdbc = MysqlUtils.mysqlDuiba("sign_record");
//执行数据库
jdbc.update("INSERT INTO `tb_sign_statics` (`consumer_id`, `source_type`, `source_relation_id`, `continue_day`, `last_sign_day`, `gmt_create`, `gmt_modified`, `app_id`, `acm_day`) VALUES ( '"+consumer_id+"', '2', '"+source_relation_id+"', '"+continue_day+"', '"+last_sign_day+"', '"+last_sign_day+"', '"+last_sign_day+"', '"+app_id+"', '"+continue_day+"')", null);
//jdbc.update("INSERT INTO sign_record.tb_sign_statics (`consumer_id`, `source_type`, `source_relation_id`, `continue_day`, `last_sign_day`, `gmt_create`, `gmt_modified`, `app_id`, `acm_day`) VALUES ( '"+consumer_id+"', '2', '"+source_relation_id+"', '"+continue_day+"', '"+last_sign_day+"', '"+last_sign_day+"', '"+last_sign_day+"', '"+app_id+"', '"+continue_day+"')", null);
String sql1 = "INSERT INTO sign_record.tb_sign_statics (`consumer_id`, `source_type`, `source_relation_id`, `continue_day`, `last_sign_day`, `gmt_create`, `gmt_modified`, `app_id`, `acm_day`, `max_continue_day`) VALUES ( '"+consumer_id+"', '2', '"+source_relation_id+"', '"+continue_day+"', '"+last_sign_day+"', '"+last_sign_day+"', '"+last_sign_day+"', '"+app_id+"', '"+continue_day+"', '"+continue_day+"')";
sqlService.update(sql1);
int i= Integer.valueOf(continue_day);
while(i>0){
String sign_date =this.getTime(i*(-1));
Thread.sleep(500);
String log_id = String.valueOf(System.currentTimeMillis());
jdbc.update("INSERT INTO `tb_sign_log` ( `log_id`, `biz_id`, `consumer_id`, `credits`, `sign_type`, `log_statue`, `gmt_create`, `gmt_modified`, `source_type`, `source_relation_id`, `activity_count`, `activity_count_remark`, `credits_remark`, `activity_count_status`, `credits_status`, `sign_date`, `re_sign`, `sign_remark`, `app_id`) VALUES ( '"+log_id+"', NULL, '"+consumer_id+"', '0', '"+sign_type+"', '2', '"+sign_date+"', '"+sign_date+"', '2', '"+source_relation_id+"', '0', '{\\\"rw\\\":{}}', '{\\\"rw\\\":{}}', '2', '2', '"+sign_date+"', '0', NULL, '"+app_id+"')");
//jdbc.update("INSERT INTO sign_record.tb_sign_log ( `log_id`, `biz_id`, `consumer_id`, `credits`, `sign_type`, `log_statue`, `gmt_create`, `gmt_modified`, `source_type`, `source_relation_id`, `activity_count`, `activity_count_remark`, `credits_remark`, `activity_count_status`, `credits_status`, `sign_date`, `re_sign`, `sign_remark`, `app_id`) VALUES ( '"+log_id+"', NULL, '"+consumer_id+"', '0', '"+sign_type+"', '2', '"+sign_date+"', '"+sign_date+"', '2', '"+source_relation_id+"', '0', '{\\\"rw\\\":{}}', '{\\\"rw\\\":{}}', '2', '2', '"+sign_date+"', '0', NULL, '"+app_id+"')");
String sql2 = "INSERT INTO sign_record.tb_sign_log ( `log_id`, `biz_id`, `consumer_id`, `credits`, `sign_type`, `log_statue`, `gmt_create`, `gmt_modified`, `source_type`, `source_relation_id`, `activity_count`, `activity_count_remark`, `credits_remark`, `activity_count_status`, `credits_status`, `sign_date`, `re_sign`, `sign_remark`, `app_id`) VALUES ( '"+log_id+"', NULL, '"+consumer_id+"', '0', '"+sign_type+"', '2', '"+sign_date+"', '"+sign_date+"', '2', '"+source_relation_id+"', '0', '{\\\"rw\\\":{}}', '{\\\"rw\\\":{}}', '2', '2', '"+sign_date+"', '0', NULL, '"+app_id+"')";
sqlService.update(sql2);
i--;
}
//释放数据库
jdbc.releaseConn();
//jdbc.releaseConn();
return new ModelAndView(SUCCESS);
}
......
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