12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2018/3/6
- * Time: 下午5:20
- */
- define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_ROOT_PATH . '/core/framework/function/http.php');
- require_once(BASE_ROOT_PATH . '/helper/geo_helper.php');
- class TestMap extends PHPUnit_Framework_TestCase
- {
- const amap_key = 'a284df4b8cef6aa5144f43ad5753b7d4';
- public static function setUpBeforeClass()
- {
- Base::run_util();
- }
- public function testLoc()
- {
- $loc_l = geo_helper::instance()->geocodes("上海","上海市第六人民医院");
- $loc_r = geo_helper::instance()->geocodes("上海","徐汇区番禺路900号");
- $dis = geo_helper::instance()->getdistance($loc_l[0],$loc_l[1],$loc_r[0],$loc_r[1]);
- }
- public function testUpdateStore()
- {
- $mod_member = Model('store');
- $i = 0;
- while (true) {
- $start = $i * 1000;
- $items = $mod_member->field('*')->order('store_id asc')->limit("{$start},1000")->select();
- if (empty($items)) {
- return;
- }
- $i++;
- foreach ($items as $item) {
- $store_id = intval($item['store_id']);
- $ret = geo_helper::instance()->update_store($store_id);
- }
- }
- }
- public function testUpdate()
- {
- geo_helper::instance()->update_store(38);
- }
- }
|