更新
This commit is contained in:
@@ -443,4 +443,24 @@ public class UserDao {
|
|||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int addUserProjectNum(int userId)
|
||||||
|
{
|
||||||
|
int num ;
|
||||||
|
try {
|
||||||
|
Connection conn = JdbcUtils.getConnection();
|
||||||
|
QueryRunner runner = new QueryRunner();
|
||||||
|
String sql="update user set projectNum = projectNum+1 where userId = ?";
|
||||||
|
num = runner.update(conn,sql,userId);
|
||||||
|
sql="update user set contributionValue = contributionValue+10 where userId = ?";
|
||||||
|
if( runner.update(conn,sql,userId) == 1 )
|
||||||
|
{
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
conn.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -268,7 +268,10 @@ public class projectService {
|
|||||||
String submitTime = format.format(time).toString();
|
String submitTime = format.format(time).toString();
|
||||||
int categoryId = categoryIdList.get(0);
|
int categoryId = categoryIdList.get(0);
|
||||||
int userId = userDao.selectIdByName(username);
|
int userId = userDao.selectIdByName(username);
|
||||||
|
int tem =userDao.addUserProjectNum(userId);
|
||||||
|
if( tem!=2){
|
||||||
|
flag=0;
|
||||||
|
}
|
||||||
pnum = projectDao.insertProject(userId,projectName,projectUrl,projectIco,projectTitle,projectDescription,submitTime,categoryId);
|
pnum = projectDao.insertProject(userId,projectName,projectUrl,projectIco,projectTitle,projectDescription,submitTime,categoryId);
|
||||||
if(pnum == 0 )
|
if(pnum == 0 )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user