find($id);
if ($value != $data['project_id']) {
$data['relate_id'] = -1;
}
}
$config['relate_id'] = Dever::db('pay/yspay_merchant')->config['struct']['relate_id'];
$config['relate_id']['update'] = 'select';
$config['relate_id']['update_search'] = 'pay/yspay/merchant.search?project_id=' . $value;
$result = Dever::load('manage/database')->update_struct(array('struct' => $config), false, $data, -1, '', true);
return $result;
}
public function search_api()
{
$id = Dever::input('id');
$keyword = Dever::input('keyword');
$where = array();
if ($keyword) {
$where['name'] = $keyword;
}
$id = Dever::input('where_id');
if ($id) {
$where['id_no'] = $id;
}
$project_id = Dever::input('project_id', 1);
$project = Dever::db('pay/yspay_project')->find($project_id);
return Dever::search($project['table'], $where);
}
public function up($account_id, $project_id, $id, $name)
{
$data = array();
$data['account_id'] = $account_id;
$data['project_id'] = $project_id;
$data['relate_id'] = $id;
$info = Dever::db('pay/yspay_merchant')->find($data);
if (!$info) {
$data['name'] = $name;
$data['type'] = 1;
$data['status'] = 2;
return Dever::db('pay/yspay_merchant')->insert($data);
}
return false;
}
public function getInfo($account_id, $project_id, $id, $parent)
{
$where = array();
$where['account_id'] = $account_id;
$where['project_id'] = $project_id;
$where['relate_id'] = $id;
$data = Dever::db('pay/yspay_merchant')->find($where);
$html = '';
if ($data) {
$url = Dever::url('project/database/update?project=pay&table=yspay_merchant&set=1&where_id='.$data['id'], 'manage');
$html .= ''.$data['mid'].'';
$step = false;
if ($data['status'] == 2) {
$sign = Dever::db('pay/yspay_sign')->one(array('merchant_id' => $data['id']));
if ($sign && $sign['step']) {
$step = $sign['step'];
}
}
if ($data['status'] == 1) {
$url = Dever::url('project/database/list?project=pay&table=yspay_cash&search_option_merchant_id='.$data['id'].'&search_option_account_id='.$data['account_id'].'&parent='.$parent, 'manage');
$html .= ' [资金流水]';
}
if ($data['status'] == 2) {
$url = Dever::url('project/database/update?project=pay&table=yspay_sign&search_option_merchant_id='.$data['id'].'&search_option_account_id='.$data['account_id'].'&where_id='.$data['id'].'&parent='.$parent, 'manage');
$html .= ' [签约资料]';
if ($step == -1) {
$content = '';
$title = '';
$url = Dever::url('pay/yspay/sign.handle?sign_id=' . $data['id']);
$html .= ' [签约提审]';
}
if ($step == 2) {
$url = Dever::url('project/database/update?project=pay&table=yspay_sign&col=cashwhere_id='.$data['id'], 'manage');
$html .= ' [签约打款]';
}
if ($step == 4) {
$url = Dever::load('pay/yspay/sign.getAgreement', $data['id']);
$html .= ' ';
}
}
return $html;
} else {
return '暂无';
}
}
}