|
|
|
@ -6,7 +6,11 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
|
|
|
|
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.EmptyInterface;
|
|
|
|
|
import com.dsideal.QingLong.Interceptor.IsNumericInterface;
|
|
|
|
|
import com.dsideal.QingLong.Util.RsaUtils;
|
|
|
|
|
import com.jfinal.aop.Before;
|
|
|
|
|
import com.jfinal.ext.interceptor.POST;
|
|
|
|
|
import com.jfinal.kit.Kv;
|
|
|
|
|
import com.jfinal.kit.PropKit;
|
|
|
|
|
import com.jfinal.kit.StrKit;
|
|
|
|
@ -425,7 +429,6 @@ public class HuiYaModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Record getModelPromptRecord(int model_id, int prompt_id) {
|
|
|
|
|
//http://hzkc.oss-cn-beijing.aliyuncs.com/Images/System/2/2.png
|
|
|
|
|
Record r = new Record();
|
|
|
|
|
r.set("prompt_id", prompt_id);
|
|
|
|
|
String img_url = "http://hzkc.oss-cn-beijing.aliyuncs.com/Images/System/" + model_id + "/" + prompt_id + ".png";
|
|
|
|
@ -536,38 +539,6 @@ public class HuiYaModel {
|
|
|
|
|
return Db.paginate(page, limit, sqlPara);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:记录文件MD5值
|
|
|
|
|
*
|
|
|
|
|
* @param image_md5
|
|
|
|
|
* @param image_url
|
|
|
|
|
*/
|
|
|
|
|
public boolean wxWriteImageMd5(String image_md5, String image_url) {
|
|
|
|
|
try {
|
|
|
|
|
String sql = "delete from t_hy_image_md5 where image_md5=?";
|
|
|
|
|
Db.update(sql, image_md5);
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
record.set("image_md5", image_md5);
|
|
|
|
|
record.set("image_url", image_url);
|
|
|
|
|
Db.save("t_hy_image_md5", "image_md5", record);
|
|
|
|
|
return true;
|
|
|
|
|
} catch (Exception err) {
|
|
|
|
|
System.out.println(err.toString());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取指定的MD5图片是不是存在
|
|
|
|
|
*
|
|
|
|
|
* @param image_md5
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Record wxMd5Exist(String image_md5) {
|
|
|
|
|
String sql = "select * from t_hy_image_md5 where image_md5=?";
|
|
|
|
|
Record record = Db.findFirst(sql, image_md5);
|
|
|
|
|
return record;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取生成图片的耗时
|
|
|
|
@ -578,7 +549,7 @@ public class HuiYaModel {
|
|
|
|
|
public static DateTime wxGetCostTimeListBeginTime = DateTime.now();
|
|
|
|
|
public static Map<Integer, Integer> wxGetCostMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
public Map<Integer, Integer> wxGetCostTimeMap() {
|
|
|
|
|
public void wxGetCostTimeMap() {
|
|
|
|
|
Duration duration = Duration.between((Temporal) DateTime.now(), (Temporal) wxGetCostTimeListBeginTime);
|
|
|
|
|
if (duration.getSeconds() > 60) {
|
|
|
|
|
wxGetCostTimeList.clear();
|
|
|
|
@ -594,10 +565,12 @@ public class HuiYaModel {
|
|
|
|
|
wxGetCostMap.put(model_id, seconds_difference);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return wxGetCostMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String wxGetCostTime(int task_id) {
|
|
|
|
|
//调用生成Map
|
|
|
|
|
wxGetCostTimeMap();
|
|
|
|
|
|
|
|
|
|
//当前任务的model_id
|
|
|
|
|
Record r = Db.findById("t_hy_task", "task_id", task_id);
|
|
|
|
|
int model_id = r.getInt("model_id");
|
|
|
|
@ -630,4 +603,16 @@ public class HuiYaModel {
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:获取用户的上传图片历史记录
|
|
|
|
|
*
|
|
|
|
|
* @param user_id
|
|
|
|
|
* @param limit
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> wxUserImgHistory(String user_id, int limit) {
|
|
|
|
|
Kv kv = Kv.by("user_id", user_id).set("limit", limit);
|
|
|
|
|
SqlPara sqlPara = Db.getSqlPara("HuiYa.wxUserImgHistory", kv);
|
|
|
|
|
return Db.find(sqlPara);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|