Merchant.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php namespace Pay\Yspay;
  2. use Dever;
  3. class Merchant
  4. {
  5. public function selectRelate_api()
  6. {
  7. $value = Dever::input('value');
  8. $id = Dever::input('id');
  9. $data = array();
  10. if ($id) {
  11. $data = Dever::db('pay/yspay_merchant')->find($id);
  12. if ($value != $data['project_id']) {
  13. $data['relate_id'] = -1;
  14. }
  15. }
  16. $config['relate_id'] = Dever::db('pay/yspay_merchant')->config['struct']['relate_id'];
  17. $config['relate_id']['update'] = 'select';
  18. $config['relate_id']['update_search'] = 'pay/yspay/merchant.search?project_id=' . $value;
  19. $result = Dever::load('manage/database')->update_struct(array('struct' => $config), false, $data, -1, '', true);
  20. return $result;
  21. }
  22. public function search_api()
  23. {
  24. $id = Dever::input('id');
  25. $keyword = Dever::input('keyword');
  26. $where = array();
  27. if ($keyword) {
  28. $where['name'] = $keyword;
  29. }
  30. $id = Dever::input('where_id');
  31. if ($id) {
  32. $where['id_no'] = $id;
  33. }
  34. $project_id = Dever::input('project_id', 1);
  35. $project = Dever::db('pay/yspay_project')->find($project_id);
  36. return Dever::search($project['table'], $where);
  37. }
  38. }