截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ShopContentLogic.php 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. <?php
  2. namespace app\api\logic;
  3. use app\common\basics\Logic;
  4. use app\common\enum\GoodsEnum;
  5. use app\common\enum\ShopAdEnum;
  6. use app\common\enum\ShopEnum;
  7. use app\common\logic\QrCodeLogic;
  8. use app\common\model\dev\DevRegion;
  9. use app\common\model\shop\ShopAd;
  10. use app\common\model\shop\ShopGoods as shopGoodsModel;
  11. use app\common\server\ConfigServer;
  12. use app\common\server\UrlServer;
  13. use app\common\model\goods\Goods;
  14. use app\common\model\shop\Shop;
  15. use app\common\model\shop\ShopFollow;
  16. use app\common\model\content\ClosureCategory;
  17. use app\common\model\content\Closure;
  18. use app\common\model\shop\Shop as shopModel;
  19. use app\common\model\content\EquiCategory as EquiCategoryModel;
  20. use think\facade\Event;
  21. class ShopContentLogic extends Logic
  22. {
  23. /*
  24. * 获取机器秘钥
  25. */
  26. public static function codeInfo($code='',$mcode='')
  27. {
  28. if(empty($code) || empty($mcode)){
  29. $data = [
  30. 'status' => 105,
  31. 'msg' => "参数不正确,不能为空!"
  32. ];
  33. return $data;
  34. }
  35. $where = [
  36. "del" => 0,
  37. "is_show" => 1,
  38. "pid" => 0, //必须是电脑
  39. "code" => $code
  40. ];
  41. $item = EquiCategoryModel::where($where)->find();
  42. //判断商家服务
  43. if(!empty($item)) {
  44. $expire_time = shopModel::where('id', $item['shop_id'])->value('expire_time');
  45. //dump($expire_time);
  46. if($expire_time < time()){
  47. $data = [
  48. 'status' => 107,
  49. 'msg' => "商户服务当前套餐到期,到期时间".date('Y-m-d H:i:s',$expire_time)."!"
  50. ];
  51. return $data;
  52. }
  53. }
  54. if(empty($item))
  55. {
  56. $data = [
  57. 'status' => 101,
  58. 'msg' => "秘钥错误,找不到设备!"
  59. ];
  60. }else if(empty($item['machine_code']))
  61. {
  62. //验证秘钥是否合法
  63. $res = self::getCodeIs($item['shop_id'],$code);
  64. if($res === false){
  65. $data = [
  66. 'status' => 106,
  67. 'msg' => "超出套餐服务电脑数量!"
  68. ];
  69. }else {
  70. //未绑定机器码 那么进行绑定
  71. $row = EquiCategoryModel::where(['id' => $item['id']])->update([
  72. "machine_code" => $mcode,
  73. ]);
  74. if ($row == 1) {
  75. $data = [
  76. 'status' => 100,
  77. 'msg' => "绑定机器码成功!"
  78. ];
  79. } else {
  80. $data = [
  81. 'status' => 102,
  82. 'msg' => "绑定机器码失败!"
  83. ];
  84. }
  85. }
  86. }else{
  87. //验证秘钥是否合法
  88. $res = self::getCodeIs($item['shop_id'],$code);
  89. if($res === false){
  90. $data = [
  91. 'status' => 106,
  92. 'msg' => "超出套餐服务电脑数量!"
  93. ];
  94. }else {
  95. //机器码已存在
  96. if($item['machine_code'] != $mcode){
  97. //机器码不一致
  98. $data = [
  99. 'status' => 103,
  100. 'msg' => "该秘钥已绑定其他设备,操作失败!"
  101. ];
  102. }else{
  103. $data = [
  104. 'status' => 100,
  105. 'msg' => "已绑定该机器码!"
  106. ];
  107. }
  108. }
  109. }
  110. return $data;
  111. }
  112. public static function getCodeIs($shop_id,$code)
  113. {
  114. //首先获取合法的电脑数量是多少
  115. $tid = shopModel::where('id',$shop_id)->value('tid');
  116. if ((int)$tid === 0) {
  117. //未配置
  118. $count_pc = 1;
  119. $count_mobile = 3;
  120. $count_run = 3;
  121. } else if ((int)$tid > 0) {
  122. //查找配置
  123. $one = shopGoodsModel::where('id', $tid)->find();
  124. $count_pc = $one['pc_num'];
  125. $count_mobile = $one['mobile_num'];
  126. $count_run = $one['run_num'];
  127. } else {
  128. //其他
  129. $count_pc = 1;
  130. $count_mobile = 3;
  131. $count_run = 3;
  132. }
  133. //调用合法的秘钥是哪些
  134. $where = [
  135. "del" => 0, //未删除
  136. //"is_show" => 1,
  137. "pid" => 0, //必须是电脑
  138. "shop_id" => $shop_id
  139. ];
  140. $code_list = EquiCategoryModel::where($where)->order('id asc')->limit($count_pc)->column('code');
  141. if(in_array($code,$code_list)){
  142. return true;
  143. }
  144. return false;
  145. }
  146. /*
  147. * getComputer
  148. * 获取电脑 根据code
  149. */
  150. public static function getComputer($code){
  151. if(empty($code)){
  152. $data = [
  153. 'status' => 105,
  154. 'msg' => "参数不正确,不能为空!"
  155. ];
  156. return $data;
  157. }
  158. $where = [
  159. "del" => 0,
  160. "is_show" => 1,
  161. "pid" => 0, //必须是电脑
  162. "code" => $code
  163. ];
  164. $item = EquiCategoryModel::where($where)->find();
  165. if(empty($item))
  166. {
  167. $data = [
  168. 'status' => 101,
  169. 'msg' => "秘钥错误,找不到设备!"
  170. ];
  171. }else{
  172. $data = [
  173. 'status' => 100,
  174. 'msg' => "设备存在!",
  175. 'item' => $item
  176. ];
  177. }
  178. return $data;
  179. }
  180. /*
  181. * 获取手机配置
  182. */
  183. public static function getDefaultMobile($data){
  184. //判断是否绑定配置
  185. if(empty($data['pz'])){
  186. $data = [
  187. 'status' => 101,
  188. 'msg' => "请对该设备绑定默认配置!"
  189. ];
  190. }else{
  191. $pz = json_decode($data['pz'],true);
  192. //获取小红书appid
  193. $app_id = ClosureCategory::where([
  194. 'name' => '小红书',
  195. 'shop_id' => $data['shop_id']
  196. ])->value('id');
  197. if(empty($app_id)){
  198. $data = [
  199. 'status' => 102,
  200. 'msg' => "找不到名为小红书的appID!"
  201. ];
  202. }else{
  203. //读取默认配置
  204. foreach ($pz as $k=>$v){
  205. if((int)$v['cid'] === (int)$app_id){
  206. //读取具体配置对象 $v['val']
  207. $item = Closure::where(['id'=>$v['val']])->find();
  208. if(empty($item['json_data'])){
  209. $data = [
  210. 'status' => 103,
  211. 'msg' => "找不到配置对象记录!"
  212. ];
  213. }else{
  214. $data = [
  215. 'status' => 100,
  216. 'msg' => "存在默认配置!",
  217. 'data' => json_decode($item['json_data'],true)
  218. ];
  219. $data['data']['版本号'] = $v['ver'];
  220. }
  221. }
  222. }
  223. }
  224. }
  225. //查询默认配置
  226. return $data;
  227. }
  228. /*
  229. * 获取手机列表
  230. */
  231. public static function getMobile($data)
  232. {
  233. //限制手机数量 首先获取合法的手机数量是多少
  234. $tid = shopModel::where('id',$data['shop_id'])->value('tid');
  235. if ((int)$tid === 0) {
  236. //未配置
  237. $count_pc = 1;
  238. $count_mobile = 3;
  239. $count_run = 3;
  240. } else if ((int)$tid > 0) {
  241. //查找配置
  242. $one = shopGoodsModel::where('id', $tid)->find();
  243. $count_pc = $one['pc_num'];
  244. $count_mobile = $one['mobile_num'];
  245. $count_run = $one['run_num'];
  246. } else {
  247. //其他
  248. $count_pc = 1;
  249. $count_mobile = 3;
  250. $count_run = 3;
  251. }
  252. //只调用允许数量 按id排序即可 后台不可更改排序
  253. $list = EquiCategoryModel::where(['pid'=>$data['id'],'is_show'=>1,'del'=>0])
  254. ->order('id asc')
  255. ->limit($count_mobile)
  256. ->select();
  257. if(empty($list)){
  258. $data = [
  259. 'status' => 100,
  260. 'msg' => "找不到手机设备,全部使用默认配置!"
  261. ];
  262. }else{
  263. //获取小红书appid
  264. $app_id = ClosureCategory::where([
  265. 'name' => '小红书',
  266. 'shop_id' => $data['shop_id']
  267. ])->value('id');
  268. if(empty($app_id)){
  269. $data = [
  270. 'status' => 102,
  271. 'msg' => "找不到名为小红书的appID!"
  272. ];
  273. }else{
  274. $pz_list = [];
  275. $ids = [];
  276. foreach ($list as $k=>$v){
  277. //没有配置指定 就使用默认的配置
  278. if(!empty($v['pz'])){
  279. $pz = json_decode($v['pz'],true);
  280. foreach ($pz as $kk=>$vv){
  281. //小红书
  282. if((int)$vv['cid'] === (int)$app_id){
  283. $pz_list[(int)$vv['val']] = $v['name'];
  284. $ids[] = $vv['val'];
  285. $ver[(int)$vv['val']] = $vv['ver']; //版本号
  286. }
  287. }
  288. }
  289. }
  290. if(empty($ids)){
  291. $data = [
  292. 'status' => 100,
  293. 'msg' => "不存在手机配置,使用默认配置"
  294. ];
  295. }else{
  296. $data = [
  297. 'status' => 100,
  298. 'data' => $pz_list,
  299. 'ids' => $ids,
  300. 'ver' => $ver
  301. ];
  302. }
  303. }
  304. }
  305. return $data;
  306. }
  307. /*
  308. * 获取手机配置
  309. */
  310. public static function getMobileConfig($data,$ids,$ver)
  311. {
  312. $res = [];
  313. if(!empty($ids)){
  314. $list = Closure::where('id','in',$ids)->select();
  315. foreach ($list as $k=>$v){
  316. if(!empty($v['json_data'])){
  317. $res[$data[(int)$v['id']]] = json_decode($v['json_data'],true);
  318. $res[$data[(int)$v['id']]]['ver'] = $ver[(int)$v['id']]; //追加版本号
  319. }
  320. }
  321. }
  322. return $res;
  323. }
  324. /**
  325. * 获取店铺信息
  326. */
  327. public static function getShopInfo($shopId, $userId, $params = [])
  328. {
  329. // 记录统计信息(访问商铺用户量)
  330. Event::listen('ShopStat', 'app\common\listener\ShopStat');
  331. event('ShopStat', $shopId);
  332. $where = [
  333. 'del' => 0,
  334. 'id' => $shopId
  335. ];
  336. $field = [
  337. 'id', 'create_time', 'name', 'logo', 'background',
  338. 'type', 'score', 'star', 'intro',
  339. 'visited_num', 'cover', 'banner', 'is_freeze',
  340. 'is_run', 'expire_time',
  341. 'province_id', 'city_id', 'district_id', 'address',
  342. 'run_start_time', 'run_end_time', 'weekdays',
  343. ];
  344. $shop = Shop::field($field)
  345. ->where($where)
  346. ->append([ 'type_desc', 'is_expire' ])
  347. ->findOrEmpty();
  348. if($shop->isEmpty()) {
  349. return [];
  350. }else{
  351. $shop = $shop->toArray();
  352. }
  353. //
  354. $shop['logo'] = UrlServer::getFileUrl($shop['logo'] ? : ShopEnum::DEFAULT_LOGO);
  355. $shop['background'] = UrlServer::getFileUrl($shop['background'] ? : ShopEnum::DEFAULT_BG);
  356. $shop['cover'] = UrlServer::getFileUrl($shop['cover'] ? :ShopEnum::DEFAULT_COVER);
  357. $shop['banner'] = UrlServer::getFileUrl($shop['banner'] ? : ShopEnum::DEFAULT_BANNER);
  358. $shop['run_start_time'] = $shop['run_start_time'] ? date('H:i:s', $shop['run_start_time']) : '';
  359. $shop['run_end_time'] = $shop['run_end_time'] ? date('H:i:s', $shop['run_end_time']) : '';
  360. $shop['province'] = DevRegion::getAreaName($shop['province_id']);
  361. $shop['city'] = DevRegion::getAreaName($shop['city_id']);
  362. $shop['district'] = DevRegion::getAreaName($shop['district_id']);
  363. $shop['qr_code'] = (new QrCodeLogic)->shopQrCode($shop['id'], $params['terminal'] ?? '');
  364. // 在售商品
  365. // 销售中商品:未删除/审核通过/已上架
  366. $onSaleWhere = [
  367. ['del', '=', GoodsEnum::DEL_NORMAL], // 未删除
  368. ['status', '=', GoodsEnum::STATUS_SHELVES], // 上架中
  369. ['audit_status', '=', GoodsEnum::AUDIT_STATUS_OK], // 审核通过
  370. ];
  371. $shop['on_sale_count'] = Goods::where($onSaleWhere)->where('shop_id', $shopId)->count();
  372. // 店铺推荐商品
  373. $shop['goods_list'] = Goods::field('id,image,name,min_price,market_price')
  374. ->where($onSaleWhere)
  375. ->where([
  376. 'shop_id' => $shop['id'],
  377. 'is_recommend' => 1, // 推荐商品
  378. ])
  379. ->limit(9)
  380. ->select()
  381. ->toArray();
  382. // 用户是否关注店铺
  383. $shop['shop_follow_status'] = 0;
  384. if($userId) { // 用户已登录
  385. $shopFollow = ShopFollow::where(['user_id'=>$userId, 'shop_id'=>$shopId])->findOrEmpty();
  386. if(!$shopFollow->isEmpty()) {
  387. $shop['shop_follow_status'] = $shopFollow['status'];
  388. }
  389. }
  390. $shop['follow_num'] = ShopFollow::where(['shop_id' => $shopId,'status' => 1])->count('id');
  391. $image = ConfigServer::get('shop_customer_service', 'image', '', $shopId);
  392. $shop['customer_image'] = $image ? UrlServer::getFileUrl($image) : '';
  393. $shop['customer_wechat'] = ConfigServer::get('shop_customer_service', 'wechat', '', $shopId);
  394. $shop['customer_phone'] = ConfigServer::get('shop_customer_service', 'phone', '', $shopId);
  395. // 店铺广告
  396. $adWhere = [
  397. [ 'shop_id', '=', $shopId ],
  398. [ 'status', '=', 1 ],
  399. ];
  400. $shop['ad'] = [
  401. 'pc' => ShopAd::where($adWhere)->where('terminal', ShopAdEnum::TERMINAL_PC)->append([ 'link_path', 'link_query' ])->order('sort desc,id desc')->select()->toArray(),
  402. 'mobile' => ShopAd::where($adWhere)->where('terminal', ShopAdEnum::TERMINAL_MOBILE)->append([ 'link_path', 'link_query' ])->order('sort desc,id desc')->select()->toArray(),
  403. ];
  404. return $shop;
  405. }
  406. /**
  407. * 店铺列表
  408. */
  409. public static function getShopList($get)
  410. {
  411. $where = [
  412. ['is_freeze', '=', 0], // 未冻结
  413. ['del', '=', 0], // 未删除
  414. ['is_run', '=', 1], // 未暂停营业
  415. ];
  416. // 店铺名称
  417. if(isset($get['name']) && !empty($get['name'])) {
  418. $where[] = ['name', 'like', '%'. trim($get['name']. '%')];
  419. }
  420. // 主营类目
  421. if(isset($get['shop_cate_id']) && !empty($get['shop_cate_id'])) {
  422. $where[] = ['cid', '=', $get['shop_cate_id']];
  423. }
  424. $order = [
  425. 'weight' => 'asc',
  426. 'score' => 'desc',
  427. 'id' => 'desc'
  428. ];
  429. $list = Shop::field('id,type,name,logo,background,visited_num,cover,banner')
  430. ->where($where)
  431. // 无限期 或 未到期
  432. ->whereRaw('expire_time =0 OR expire_time > '. time())
  433. ->order($order)
  434. ->page($get['page_no'], $get['page_size'])
  435. ->select()
  436. ->toArray();
  437. $count = Shop::where($where)
  438. // 无限期 或 未到期
  439. ->whereRaw('expire_time =0 OR expire_time > '. time())
  440. ->count();
  441. $onSaleWhere = [
  442. ['del', '=', GoodsEnum::DEL_NORMAL], // 未删除
  443. ['status', '=', GoodsEnum::STATUS_SHELVES], // 上架中
  444. ['audit_status', '=', GoodsEnum::AUDIT_STATUS_OK], // 审核通过
  445. ];
  446. foreach($list as &$shop) {
  447. $shop['goods_list'] = Goods::field('id,image,name,min_price,market_price')
  448. ->where($onSaleWhere)
  449. ->where([
  450. 'shop_id' => $shop['id'],
  451. ])
  452. ->limit(10)
  453. ->select()
  454. ->toArray();
  455. $shop['on_sale_goods'] = count($shop['goods_list']);
  456. // logo及背景图
  457. $shop['logo'] = $shop['logo'] ? UrlServer::getFileUrl($shop['logo']) : UrlServer::getFileUrl(ShopEnum::DEFAULT_LOGO);
  458. $shop['background'] = $shop['background'] ? UrlServer::getFileUrl($shop['background']) : UrlServer::getFileUrl(ShopEnum::DEFAULT_BG);
  459. $shop['cover'] = $shop['cover'] ? UrlServer::getFileUrl($shop['cover']) : UrlServer::getFileUrl(ShopEnum::DEFAULT_COVER);
  460. $shop['banner'] = $shop['banner'] ? UrlServer::getFileUrl($shop['banner']) : '';
  461. }
  462. $more = is_more($count, $get['page_no'], $get['page_size']);
  463. $data = [
  464. 'list' => $list,
  465. 'count' => $count,
  466. 'more' => $more,
  467. 'page_no' => $get['page_no'],
  468. 'page_isze' => $get['page_size']
  469. ];
  470. return $data;
  471. }
  472. /**
  473. * @notes 附近店铺列表
  474. * @param $get
  475. * @return array
  476. * @throws \think\db\exception\DataNotFoundException
  477. * @throws \think\db\exception\DbException
  478. * @throws \think\db\exception\ModelNotFoundException
  479. * @author ljj
  480. * @date 2022/9/20 4:29 下午
  481. */
  482. public static function getNearbyShops($get)
  483. {
  484. $where = [
  485. ['is_freeze', '=', 0], // 未冻结
  486. ['del', '=', 0], // 未删除
  487. ['is_run', '=', 1], // 未暂停营业
  488. ['city_id', '=', $get['city_id']],
  489. ];
  490. // 店铺名称
  491. if(isset($get['name']) && !empty($get['name'])) {
  492. $where[] = ['name', 'like', '%'. trim($get['name']. '%')];
  493. }
  494. // 主营类目
  495. if(isset($get['shop_cate_id']) && !empty($get['shop_cate_id'])) {
  496. $where[] = ['cid', '=', $get['shop_cate_id']];
  497. }
  498. $city = DevRegion::where('id',$get['city_id'])->field('db09_lng,db09_lat')->findOrEmpty()->toArray();
  499. $list = Shop::field('id,name,logo,background,visited_num,cover,banner,st_distance_sphere(point('.$city['db09_lng'].','.$city['db09_lat'].'),point(longitude, latitude)) as distance')
  500. ->where($where)
  501. // 无限期 或 未到期
  502. ->whereRaw('expire_time =0 OR expire_time > '. time())
  503. ->order('distance asc')
  504. ->page($get['page_no'], $get['page_size'])
  505. ->select()
  506. ->toArray();
  507. $count = Shop::where($where)
  508. // 无限期 或 未到期
  509. ->whereRaw('expire_time =0 OR expire_time > '. time())
  510. ->count();
  511. $onSaleWhere = [
  512. ['del', '=', GoodsEnum::DEL_NORMAL], // 未删除
  513. ['status', '=', GoodsEnum::STATUS_SHELVES], // 上架中
  514. ['audit_status', '=', GoodsEnum::AUDIT_STATUS_OK], // 审核通过
  515. ];
  516. foreach($list as &$shop) {
  517. $shop['goods_list'] = Goods::field('id,image,name,min_price,market_price')
  518. ->where($onSaleWhere)
  519. ->where([
  520. 'shop_id' => $shop['id'],
  521. ])
  522. ->select()
  523. ->toArray();
  524. $shop['on_sale_goods'] = count($shop['goods_list']);
  525. // logo及背景图
  526. $shop['logo'] = $shop['logo'] ? UrlServer::getFileUrl($shop['logo']) : UrlServer::getFileUrl(ShopEnum::DEFAULT_LOGO);
  527. $shop['background'] = $shop['background'] ? UrlServer::getFileUrl($shop['background']) : UrlServer::getFileUrl(ShopEnum::DEFAULT_BG);
  528. $shop['cover'] = $shop['cover'] ? UrlServer::getFileUrl($shop['cover']) : UrlServer::getFileUrl(ShopEnum::DEFAULT_COVER);
  529. $shop['banner'] = $shop['banner'] ? UrlServer::getFileUrl($shop['banner']) : '';
  530. //转换距离单位
  531. if ($shop['distance'] < 1000) {
  532. $shop['distance'] = round($shop['distance']).'m';
  533. }else {
  534. $shop['distance'] = round($shop['distance'] / 1000,2).'km';
  535. }
  536. }
  537. $more = is_more($count, $get['page_no'], $get['page_size']);
  538. $data = [
  539. 'list' => $list,
  540. 'count' => $count,
  541. 'more' => $more,
  542. 'page_no' => $get['page_no'],
  543. 'page_isze' => $get['page_size']
  544. ];
  545. return $data;
  546. }
  547. public static function getXhsDefaultAppuim()
  548. {
  549. $data = [
  550. '默认' => '',
  551. "搜索列表" => '//androidx.recyclerview.widget.RecyclerView[@class="androidx.recyclerview.widget.RecyclerView"]/android.widget.FrameLayout[@class="android.widget.FrameLayout"]/android.widget.RelativeLayout[@class="android.widget.RelativeLayout"]/android.widget.TextView[@class="android.widget.TextView" and @text!=""]',
  552. "推荐列表" => '//androidx.recyclerview.widget.RecyclerView[@class="androidx.recyclerview.widget.RecyclerView"]/android.widget.FrameLayout[@class="android.widget.FrameLayout" and @content-desc!=""]',
  553. '推荐列表元素' => '//android.widget.FrameLayout[@content-desc="变量1"]',
  554. '搜索列表元素' => '//android.widget.TextView[@text="变量1"]',
  555. "私信发送按钮" => '//android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.TextView[contains(@text,"发送")]',
  556. '判断当前是否视频' => '//android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.Button[@content-desc="分享"]',
  557. '视频评论数' => '//android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.Button[contains(@content-desc,"评论")]',
  558. '视频分享按钮' => '//android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.Button[@content-desc="分享"]',
  559. '视频获取账号名称' => '//android.widget.Button[contains(@content-desc,"作者") and @class="android.widget.Button"]/android.widget.LinearLayout[@class="android.widget.LinearLayout"]/android.widget.TextView[@class="android.widget.TextView"]',
  560. "视频获取点赞按钮" => '//android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.Button[contains(@content-desc,"点赞")]',
  561. "视频获取收藏按钮" => '//android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.Button[contains(@content-desc,"收藏")]',
  562. "视频详情返回按钮" => '//android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.Button[contains(@content-desc,"返回")]'
  563. ];
  564. return $data;
  565. }
  566. public static function getXhsDefaultU2()
  567. {
  568. $data = [
  569. '默认' => ''
  570. ];
  571. return $data;
  572. }
  573. public static function getXhsAppuim_1()
  574. {
  575. $data = [
  576. "默认" => '',
  577. "搜索列表" => '//androidx.recyclerview.widget.RecyclerView[@class="androidx.recyclerview.widget.RecyclerView"]/android.widget.FrameLayout[@class="android.widget.FrameLayout"]/android.widget.RelativeLayout[@class="android.widget.RelativeLayout"]/android.widget.TextView[@class="android.widget.TextView" and @text!=""]',
  578. "推荐列表" => '//androidx.recyclerview.widget.RecyclerView[@class="androidx.recyclerview.widget.RecyclerView"]/android.widget.LinearLayout[@class="android.widget.LinearLayout" and @content-desc!=""]',
  579. '推荐列表元素' => '//android.widget.LinearLayout[@content-desc="变量1"]',
  580. '搜索列表元素' => '//android.widget.TextView[@text="变量1"]',
  581. "私信发送按钮" => '//android.widget.RelativeLayout[@class="android.widget.RelativeLayout"]/android.widget.TextView[contains(@text,"发送")]',
  582. '判断当前是否视频' => '//android.widget.FrameLayout[@class="android.widget.FrameLayout" and @index="1"]/android.widget.LinearLayout[@index="0"]/android.widget.LinearLayout[@index="3"]/android.widget.TextView[@class="android.widget.TextView"]',
  583. '视频评论数' => '//android.widget.FrameLayout[@class="android.widget.FrameLayout" and @index="1"]/android.widget.LinearLayout[@index="0"]/android.widget.LinearLayout[@index="1"]/android.widget.TextView[@class="android.widget.TextView"]',
  584. '视频分享按钮' => '//android.widget.FrameLayout[@class="android.widget.FrameLayout" and @index="1"]/android.widget.LinearLayout[@index="0"]/android.widget.LinearLayout[@index="4"]/android.widget.ImageView[@class="android.widget.ImageView"]',
  585. '视频获取账号名称' => '//android.widget.FrameLayout[@class="android.widget.FrameLayout"]/android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.LinearLayout[@class="android.widget.LinearLayout"]/android.widget.LinearLayout[@class="android.widget.LinearLayout"]/android.widget.TextView[@class="android.widget.TextView"]',
  586. "视频获取点赞按钮" => '//android.widget.FrameLayout[@class="android.widget.FrameLayout" and @index="1"]/android.widget.LinearLayout[@index="0"]/android.widget.LinearLayout[@index="0"]/android.widget.TextView[@class="android.widget.TextView"]',
  587. "视频获取收藏按钮" => '//android.widget.FrameLayout[@class="android.widget.FrameLayout" and @index="1"]/android.widget.LinearLayout[@index="0"]/android.widget.LinearLayout[@index="2"]/android.widget.TextView[@class="android.widget.TextView"]',
  588. "视频详情返回按钮" => '//android.view.ViewGroup[@class="android.view.ViewGroup"]/android.widget.ImageView[contains(@content-desc,"返回")]'
  589. ];
  590. return $data;
  591. }
  592. public static function getXhsU2_1()
  593. {
  594. $data = [
  595. '默认' => ''
  596. ];
  597. return $data;
  598. }
  599. }