| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/apph5/v1/share")
|
| | | public class AppH5ShareController {
|
| | |
|
| | | |
| | | @Resource
|
| | | private UserShareGoodsGroupService userShareGoodsGroupService;
|
| | | private UserShareGoodsRecordService userShareGoodsRecordService;
|
| | |
|
| | | /**
|
| | | * 分享商品
|
| | | * 分享商品详情
|
| | | * @param callback
|
| | | * @param shareId 分享id
|
| | | * @param source 来源
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getDetail")
|
| | | public void getDetail(String callback, Long shareId, String source, PrintWriter out) {
|
| | | public void getDetail(String callback, Long shareId, String source, String fingerprint, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | if (shareId == null) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("传递参数不正确")));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不正确"));
|
| | | return;
|
| | | }
|
| | |
|
| | | userShareGoodsGroupService.updateBrowseRecord(shareId, 1);
|
| | | // 获取商品信息
|
| | | JSONObject data = userShareGoodsRecordService.getGoodsGroupDetail(shareId);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("更新成功")));
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMsg())));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("更新失败")));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 分享商品
|
| | | * @param callback
|
| | | * @param shareId 分享id
|
| | | * @param source 来源
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "record")
|
| | | public void query(String callback, Long shareId, String source, PrintWriter out) {
|
| | | |
| | | try {
|
| | | |
| | | if (shareId == null) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("传递参数不正确")));
|
| | | return;
|
| | | }
|
| | | |
| | | userShareGoodsGroupService.updateBrowseRecord(shareId, 1);
|
| | | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("更新成功")));
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMsg())));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("更新失败")));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|