package com.stylefeng.guns; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.system.util.ResultUtil; import com.stylefeng.guns.modular.system.util.WeChatUtil; import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; import java.io.InputStream; @RunWith(SpringRunner.class) @SpringBootTest public class GunsApplicationTest { @Resource private IOrderTaxiService orderTaxiService; @Autowired private WeChatUtil weChatUtil; @Test public void test() { try { orderTaxiService.grabOrder(819, 14); } catch (Exception e) { throw new RuntimeException(e); } } @Test public void testWeChat(){ Integer id = 474; StringBuilder sceneBuilder = new StringBuilder(); sceneBuilder.append("id=").append(id); sceneBuilder.append("&f=").append("10"); String scene = sceneBuilder.toString(); // 4. 生成小程序码 String page = "pages/scanOrder/scanOrder"; // 小程序跳转页面 InputStream inputStream = null; try { inputStream = weChatUtil.getwxacodeunlimit(page, scene, "trial"); } catch (Exception e) { throw new RuntimeException(e); } } }